| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file defines utility functions for X11 (Linux only). This code has been | 5 // This file defines utility functions for X11 (Linux only). This code has been |
| 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support | 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support |
| 7 // remains woefully incomplete. | 7 // remains woefully incomplete. |
| 8 | 8 |
| 9 #include "ui/base/x/x11_util.h" | 9 #include "ui/base/x/x11_util.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "base/strings/stringprintf.h" | 33 #include "base/strings/stringprintf.h" |
| 34 #include "base/sys_byteorder.h" | 34 #include "base/sys_byteorder.h" |
| 35 #include "base/threading/thread.h" | 35 #include "base/threading/thread.h" |
| 36 #include "skia/ext/image_operations.h" | 36 #include "skia/ext/image_operations.h" |
| 37 #include "third_party/skia/include/core/SkBitmap.h" | 37 #include "third_party/skia/include/core/SkBitmap.h" |
| 38 #include "third_party/skia/include/core/SkPostConfig.h" | 38 #include "third_party/skia/include/core/SkPostConfig.h" |
| 39 #include "ui/base/x/x11_menu_list.h" | 39 #include "ui/base/x/x11_menu_list.h" |
| 40 #include "ui/base/x/x11_util_internal.h" | 40 #include "ui/base/x/x11_util_internal.h" |
| 41 #include "ui/events/event_utils.h" | 41 #include "ui/events/event_utils.h" |
| 42 #include "ui/events/keycodes/keyboard_code_conversion_x.h" | 42 #include "ui/events/keycodes/keyboard_code_conversion_x.h" |
| 43 #include "ui/events/x/device_data_manager.h" | 43 #include "ui/events/x/device_data_manager_x11.h" |
| 44 #include "ui/events/x/touch_factory_x11.h" | 44 #include "ui/events/x/touch_factory_x11.h" |
| 45 #include "ui/gfx/canvas.h" | 45 #include "ui/gfx/canvas.h" |
| 46 #include "ui/gfx/image/image_skia.h" | 46 #include "ui/gfx/image/image_skia.h" |
| 47 #include "ui/gfx/image/image_skia_rep.h" | 47 #include "ui/gfx/image/image_skia_rep.h" |
| 48 #include "ui/gfx/point.h" | 48 #include "ui/gfx/point.h" |
| 49 #include "ui/gfx/point_conversions.h" | 49 #include "ui/gfx/point_conversions.h" |
| 50 #include "ui/gfx/rect.h" | 50 #include "ui/gfx/rect.h" |
| 51 #include "ui/gfx/size.h" | 51 #include "ui/gfx/size.h" |
| 52 #include "ui/gfx/skia_util.h" | 52 #include "ui/gfx/skia_util.h" |
| 53 #include "ui/gfx/x/x11_error_tracker.h" | 53 #include "ui/gfx/x/x11_error_tracker.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 Clear(); | 220 Clear(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 std::map< ::Cursor, XCustomCursor*> cache_; | 223 std::map< ::Cursor, XCustomCursor*> cache_; |
| 224 DISALLOW_COPY_AND_ASSIGN(XCustomCursorCache); | 224 DISALLOW_COPY_AND_ASSIGN(XCustomCursorCache); |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 } // namespace | 227 } // namespace |
| 228 | 228 |
| 229 bool IsXInput2Available() { | 229 bool IsXInput2Available() { |
| 230 return DeviceDataManager::GetInstance()->IsXInput2Available(); | 230 return DeviceDataManagerX11::GetInstance()->IsXInput2Available(); |
| 231 } | 231 } |
| 232 | 232 |
| 233 static SharedMemorySupport DoQuerySharedMemorySupport(XDisplay* dpy) { | 233 static SharedMemorySupport DoQuerySharedMemorySupport(XDisplay* dpy) { |
| 234 int dummy; | 234 int dummy; |
| 235 Bool pixmaps_supported; | 235 Bool pixmaps_supported; |
| 236 // Query the server's support for XSHM. | 236 // Query the server's support for XSHM. |
| 237 if (!XShmQueryVersion(dpy, &dummy, &dummy, &pixmaps_supported)) | 237 if (!XShmQueryVersion(dpy, &dummy, &dummy, &pixmaps_supported)) |
| 238 return SHARED_MEMORY_NONE; | 238 return SHARED_MEMORY_NONE; |
| 239 | 239 |
| 240 #if defined(OS_FREEBSD) | 240 #if defined(OS_FREEBSD) |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // with one from the master and one from the slave so there will | 392 // with one from the master and one from the slave so there will |
| 393 // always be at least one pending. | 393 // always be at least one pending. |
| 394 if (!ui::TouchFactory::GetInstance()->ShouldProcessXI2Event(&next_event)) { | 394 if (!ui::TouchFactory::GetInstance()->ShouldProcessXI2Event(&next_event)) { |
| 395 XFreeEventData(display, &next_event.xcookie); | 395 XFreeEventData(display, &next_event.xcookie); |
| 396 XNextEvent(display, &next_event); | 396 XNextEvent(display, &next_event); |
| 397 continue; | 397 continue; |
| 398 } | 398 } |
| 399 | 399 |
| 400 if (next_event.type == GenericEvent && | 400 if (next_event.type == GenericEvent && |
| 401 next_event.xgeneric.evtype == event_type && | 401 next_event.xgeneric.evtype == event_type && |
| 402 !ui::DeviceDataManager::GetInstance()->IsCMTGestureEvent( | 402 !ui::DeviceDataManagerX11::GetInstance()->IsCMTGestureEvent( |
| 403 &next_event)) { | 403 &next_event)) { |
| 404 XIDeviceEvent* next_xievent = | 404 XIDeviceEvent* next_xievent = |
| 405 static_cast<XIDeviceEvent*>(next_event.xcookie.data); | 405 static_cast<XIDeviceEvent*>(next_event.xcookie.data); |
| 406 // Confirm that the motion event is targeted at the same window | 406 // Confirm that the motion event is targeted at the same window |
| 407 // and that no buttons or modifiers have changed. | 407 // and that no buttons or modifiers have changed. |
| 408 if (xievent->event == next_xievent->event && | 408 if (xievent->event == next_xievent->event && |
| 409 xievent->child == next_xievent->child && | 409 xievent->child == next_xievent->child && |
| 410 xievent->detail == next_xievent->detail && | 410 xievent->detail == next_xievent->detail && |
| 411 xievent->buttons.mask_len == next_xievent->buttons.mask_len && | 411 xievent->buttons.mask_len == next_xievent->buttons.mask_len && |
| 412 (memcmp(xievent->buttons.mask, | 412 (memcmp(xievent->buttons.mask, |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 1371 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
| 1372 << "minor_code " << static_cast<int>(error_event.minor_code) | 1372 << "minor_code " << static_cast<int>(error_event.minor_code) |
| 1373 << " (" << request_str << ")"; | 1373 << " (" << request_str << ")"; |
| 1374 } | 1374 } |
| 1375 | 1375 |
| 1376 // ---------------------------------------------------------------------------- | 1376 // ---------------------------------------------------------------------------- |
| 1377 // End of x11_util_internal.h | 1377 // End of x11_util_internal.h |
| 1378 | 1378 |
| 1379 | 1379 |
| 1380 } // namespace ui | 1380 } // namespace ui |
| OLD | NEW |