Chromium Code Reviews| 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 #include "ui/aura/root_window_host_linux.h" | 5 #include "ui/aura/root_window_host_linux.h" |
| 6 | 6 |
| 7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 #include <X11/Xcursor/Xcursor.h> | 8 #include <X11/Xcursor/Xcursor.h> |
| 9 #include <X11/cursorfont.h> | 9 #include <X11/cursorfont.h> |
| 10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 | 40 |
| 41 // Standard Linux mouse buttons for going back and forward. | 41 // Standard Linux mouse buttons for going back and forward. |
| 42 const int kBackMouseButton = 8; | 42 const int kBackMouseButton = 8; |
| 43 const int kForwardMouseButton = 9; | 43 const int kForwardMouseButton = 9; |
| 44 | 44 |
| 45 const char kRootWindowHostLinuxKey[] = "__AURA_ROOT_WINDOW_HOST_LINUX__"; | 45 const char kRootWindowHostLinuxKey[] = "__AURA_ROOT_WINDOW_HOST_LINUX__"; |
| 46 | 46 |
| 47 // The events reported for slave devices can have incorrect information for some | 47 // The events reported for slave devices can have incorrect information for some |
| 48 // fields. This utility function is used to check for such inconsistencies. | 48 // fields. This utility function is used to check for such inconsistencies. |
| 49 void CheckXEventForConsistency(XEvent* xevent) { | 49 void CheckXEventForConsistency(XEvent* xevent) { |
| 50 #if defined(USE_XI2_MT) | 50 #if defined(USE_XI2_MT) && !defined(NDEBUG) |
|
sadrul
2012/05/16 17:07:01
I was tempted to just remove this check since we h
| |
| 51 static bool expect_master_event = false; | 51 static bool expect_master_event = false; |
| 52 static XIDeviceEvent slave_event; | 52 static XIDeviceEvent slave_event; |
| 53 static gfx::Point slave_location; | 53 static gfx::Point slave_location; |
| 54 static int slave_button; | 54 static int slave_button; |
| 55 | 55 |
| 56 // Note: If an event comes from a slave pointer device, then it will be | 56 // Note: If an event comes from a slave pointer device, then it will be |
| 57 // followed by the same event, but reported from its master pointer device. | 57 // followed by the same event, but reported from its master pointer device. |
| 58 // However, if the event comes from a floating slave device (e.g. a | 58 // However, if the event comes from a floating slave device (e.g. a |
| 59 // touchscreen), then it will not be followed by a duplicate event, since the | 59 // touchscreen), then it will not be followed by a duplicate event, since the |
| 60 // floating slave isn't attached to a master. | 60 // floating slave isn't attached to a master. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 85 CHECK_EQ(slave_event.evtype, xievent->evtype); | 85 CHECK_EQ(slave_event.evtype, xievent->evtype); |
| 86 CHECK_EQ(slave_button, ui::EventButtonFromNative(xevent)); | 86 CHECK_EQ(slave_button, ui::EventButtonFromNative(xevent)); |
| 87 CHECK_EQ(slave_event.flags, xievent->flags); | 87 CHECK_EQ(slave_event.flags, xievent->flags); |
| 88 CHECK_EQ(slave_event.buttons.mask_len, xievent->buttons.mask_len); | 88 CHECK_EQ(slave_event.buttons.mask_len, xievent->buttons.mask_len); |
| 89 CHECK_EQ(slave_event.valuators.mask_len, xievent->valuators.mask_len); | 89 CHECK_EQ(slave_event.valuators.mask_len, xievent->valuators.mask_len); |
| 90 CHECK_EQ(slave_event.mods.base, xievent->mods.base); | 90 CHECK_EQ(slave_event.mods.base, xievent->mods.base); |
| 91 CHECK_EQ(slave_event.mods.latched, xievent->mods.latched); | 91 CHECK_EQ(slave_event.mods.latched, xievent->mods.latched); |
| 92 CHECK_EQ(slave_event.mods.locked, xievent->mods.locked); | 92 CHECK_EQ(slave_event.mods.locked, xievent->mods.locked); |
| 93 CHECK_EQ(slave_event.mods.effective, xievent->mods.effective); | 93 CHECK_EQ(slave_event.mods.effective, xievent->mods.effective); |
| 94 } | 94 } |
| 95 #endif // defined(USE_XI2_MT) | 95 #endif // defined(USE_XI2_MT) && !defined(NDEBUG) |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Returns X font cursor shape from an Aura cursor. | 98 // Returns X font cursor shape from an Aura cursor. |
| 99 int CursorShapeFromNative(gfx::NativeCursor native_cursor) { | 99 int CursorShapeFromNative(gfx::NativeCursor native_cursor) { |
| 100 switch (native_cursor.native_type()) { | 100 switch (native_cursor.native_type()) { |
| 101 case ui::kCursorNull: | 101 case ui::kCursorNull: |
| 102 return XC_left_ptr; | 102 return XC_left_ptr; |
| 103 case ui::kCursorPointer: | 103 case ui::kCursorPointer: |
| 104 return XC_left_ptr; | 104 return XC_left_ptr; |
| 105 case ui::kCursorCross: | 105 case ui::kCursorCross: |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 867 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); | 867 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); |
| 868 } | 868 } |
| 869 | 869 |
| 870 // static | 870 // static |
| 871 gfx::Size RootWindowHost::GetNativeScreenSize() { | 871 gfx::Size RootWindowHost::GetNativeScreenSize() { |
| 872 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay(); | 872 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay(); |
| 873 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); | 873 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); |
| 874 } | 874 } |
| 875 | 875 |
| 876 } // namespace aura | 876 } // namespace aura |
| OLD | NEW |