diff options
Diffstat (limited to 'chromium/ui/base/x/events_x.cc')
-rw-r--r-- | chromium/ui/base/x/events_x.cc | 68 |
1 files changed, 8 insertions, 60 deletions
diff --git a/chromium/ui/base/x/events_x.cc b/chromium/ui/base/x/events_x.cc index 51521689bf1..06301a9b086 100644 --- a/chromium/ui/base/x/events_x.cc +++ b/chromium/ui/base/x/events_x.cc @@ -2,24 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/base/events/event_constants.h" +#include "ui/events/event_constants.h" #include <string.h> #include <X11/extensions/XInput.h> #include <X11/extensions/XInput2.h> #include <X11/Xlib.h> -#include "base/command_line.h" #include "base/logging.h" #include "base/memory/singleton.h" -#include "base/message_loop/message_pump_aurax11.h" -#include "ui/base/events/event_utils.h" -#include "ui/base/keycodes/keyboard_code_conversion_x.h" +#include "base/message_loop/message_pump_x11.h" #include "ui/base/touch/touch_factory_x11.h" #include "ui/base/x/device_data_manager.h" #include "ui/base/x/device_list_cache_x.h" #include "ui/base/x/x11_atom_cache.h" #include "ui/base/x/x11_util.h" +#include "ui/events/event_utils.h" +#include "ui/events/keycodes/keyboard_code_conversion_x.h" #include "ui/gfx/display.h" #include "ui/gfx/point.h" #include "ui/gfx/rect.h" @@ -33,19 +32,6 @@ const int kWheelScrollAmount = 53; const int kMinWheelButton = 4; const int kMaxWheelButton = 7; -// A workaround for some incorrect implemented input drivers: -// Ignore their mouse input valuators. -bool IgnoreMouseValuators() { - static bool initialized = false; - static bool ignore_valuators = true; - if (initialized) - return ignore_valuators; - ignore_valuators = - CommandLine::ForCurrentProcess()->HasSwitch("disable-mouse-valuators"); - initialized = true; - return ignore_valuators; -} - // A class to track current modifier state on master device. Only track ctrl, // alt, shift and caps lock keys currently. The tracked state can then be used // by floating device. @@ -274,13 +260,7 @@ double GetTouchParamFromXEvent(XEvent* xev, } Atom GetNoopEventAtom() { - return XInternAtom( -#if defined(USE_AURA) - base::MessagePumpAuraX11::GetDefaultXDisplay(), -#else - XOpenDisplay(NULL), -#endif - "noop", False); + return XInternAtom(gfx::GetXDisplay(), "noop", False); } } // namespace @@ -288,7 +268,7 @@ Atom GetNoopEventAtom() { namespace ui { void UpdateDeviceList() { - Display* display = GetXDisplay(); + XDisplay* display = gfx::GetXDisplay(); DeviceListCacheX::GetInstance()->UpdateDeviceList(display); TouchFactory::GetInstance()->UpdateDeviceList(display); DeviceDataManager::GetInstance()->UpdateDeviceList(display); @@ -480,40 +460,8 @@ gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) { case GenericEvent: { XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(native_event->xcookie.data); - -#if defined(USE_XI2_MT) - // Touch event valuators aren't coordinates. - // Return the |event_x|/|event_y| directly as event's position. - if (xievent->evtype == XI_TouchBegin || - xievent->evtype == XI_TouchUpdate || - xievent->evtype == XI_TouchEnd) - // Note: Touch events are always touch screen events. - return gfx::Point(static_cast<int>(xievent->event_x), - static_cast<int>(xievent->event_y)); -#endif - if (IgnoreMouseValuators()) { - return gfx::Point(static_cast<int>(xievent->event_x), - static_cast<int>(xievent->event_y)); - } - // Read the position from the valuators, because the location reported in - // event_x/event_y seems to be different (and doesn't match for events - // coming from slave device and master device) from the values in the - // valuators. See more on crbug.com/103981. The position in the valuators - // is in the global screen coordinates. But it is necessary to convert it - // into the window's coordinates. If the valuator is not set, that means - // the value hasn't changed, and so we can use the value from - // event_x/event_y (which are in the window's coordinates). - double* valuators = xievent->valuators.values; - - double x = xievent->event_x; - if (XIMaskIsSet(xievent->valuators.mask, 0)) - x = *valuators++ - (xievent->root_x - xievent->event_x); - - double y = xievent->event_y; - if (XIMaskIsSet(xievent->valuators.mask, 1)) - y = *valuators++ - (xievent->root_y - xievent->event_y); - - return gfx::Point(static_cast<int>(x), static_cast<int>(y)); + return gfx::Point(static_cast<int>(xievent->event_x), + static_cast<int>(xievent->event_y)); } } return gfx::Point(); |