diff options
author | Sadrul Habib Chowdhury <sadrul@chromium.org> | 2014-11-12 18:21:51 -0500 |
---|---|---|
committer | Sadrul Habib Chowdhury <sadrul@chromium.org> | 2014-11-12 23:22:39 +0000 |
commit | 4ae87941c77264d9271afdf939381962c4f45bd2 (patch) | |
tree | 7906ec3824f4f4575660fc3f22e1403de5e17716 /ui | |
parent | 2cab606effc4c7feda7bd5392f171f356d21a9e8 (diff) | |
download | chromium_src-4ae87941c77264d9271afdf939381962c4f45bd2.zip chromium_src-4ae87941c77264d9271afdf939381962c4f45bd2.tar.gz chromium_src-4ae87941c77264d9271afdf939381962c4f45bd2.tar.bz2 |
x11: Always require XI2.2 for X11.
This removes the use_xi2_mt gyp variable, and USE_XI2_MT define from the
code. XI2.2 is now available on all supported linux platforms.
BUG=291141
R=brettw@chromium.org, derat@chromium.org, erg@chromium.org
Review URL: https://codereview.chromium.org/706763003
Cr-Commit-Position: refs/heads/master@{#303918}
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/window_tree_host_x11.cc | 6 | ||||
-rw-r--r-- | ui/events/devices/x11/device_data_manager_x11.cc | 21 | ||||
-rw-r--r-- | ui/events/devices/x11/touch_factory_x11.cc | 12 | ||||
-rw-r--r-- | ui/events/event_switches.cc | 2 | ||||
-rw-r--r-- | ui/events/event_switches.h | 2 | ||||
-rw-r--r-- | ui/events/platform/x11/x11_event_source.cc | 13 | ||||
-rw-r--r-- | ui/events/platform/x11/x11_hotplug_event_handler.cc | 6 | ||||
-rw-r--r-- | ui/events/x/events_x.cc | 6 | ||||
-rw-r--r-- | ui/events/x/events_x_unittest.cc | 4 |
9 files changed, 12 insertions, 60 deletions
diff --git a/ui/aura/window_tree_host_x11.cc b/ui/aura/window_tree_host_x11.cc index 16096b7..7239b04 100644 --- a/ui/aura/window_tree_host_x11.cc +++ b/ui/aura/window_tree_host_x11.cc @@ -115,7 +115,6 @@ class TouchEventCalibrate : public ui::PlatformEventObserver { TouchEventCalibrate() : left_(0), right_(0), top_(0), bottom_(0) { if (ui::PlatformEventSource::GetInstance()) ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this); -#if defined(USE_XI2_MT) std::vector<std::string> parts; if (Tokenize(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kTouchCalibration), @@ -130,7 +129,6 @@ class TouchEventCalibrate : public ui::PlatformEventObserver { if (!base::StringToInt(parts[3], &bottom_)) DLOG(ERROR) << "Incorrect bottom border calibration value passed."; } -#endif // defined(USE_XI2_MT) } ~TouchEventCalibrate() override { @@ -145,7 +143,6 @@ class TouchEventCalibrate : public ui::PlatformEventObserver { // which need to be expanded when converting to screen coordinates, // so that location on bezels will be outside of screen area. void Calibrate(ui::TouchEvent* event, const gfx::Rect& bounds) { -#if defined(USE_XI2_MT) int x = event->x(); int y = event->y(); @@ -197,13 +194,11 @@ class TouchEventCalibrate : public ui::PlatformEventObserver { event->set_root_location(gfx::Point(x, y)); } event->set_location(gfx::Point(x, y)); -#endif // defined(USE_XI2_MT) } private: // ui::PlatformEventObserver: void WillProcessEvent(const ui::PlatformEvent& event) override { -#if defined(USE_XI2_MT) if (event->type == GenericEvent && (event->xgeneric.evtype == XI_TouchBegin || event->xgeneric.evtype == XI_TouchUpdate || @@ -213,7 +208,6 @@ class TouchEventCalibrate : public ui::PlatformEventObserver { xievent->event_x = xievent->root_x; xievent->event_y = xievent->root_y; } -#endif // defined(USE_XI2_MT) } void DidProcessEvent(const ui::PlatformEvent& event) override {} diff --git a/ui/events/devices/x11/device_data_manager_x11.cc b/ui/events/devices/x11/device_data_manager_x11.cc index 11e03eb..9db81c1 100644 --- a/ui/events/devices/x11/device_data_manager_x11.cc +++ b/ui/events/devices/x11/device_data_manager_x11.cc @@ -165,22 +165,16 @@ bool DeviceDataManagerX11::InitializeXInputInternal() { } // Check the XInput version. -#if defined(USE_XI2_MT) - int major = 2, minor = USE_XI2_MT; -#else - int major = 2, minor = 0; -#endif + int major = 2, minor = 2; if (XIQueryVersion(gfx::GetXDisplay(), &major, &minor) == BadRequest) { VLOG(1) << "XInput2 not supported in the server."; return false; } -#if defined(USE_XI2_MT) - if (major < 2 || (major == 2 && minor < USE_XI2_MT)) { + if (major < 2 || (major == 2 && minor < 2)) { DVLOG(1) << "XI version on server is " << major << "." << minor << ". " - << "But 2." << USE_XI2_MT << " is required."; + << "But 2.2 is required."; return false; } -#endif xi_opcode_ = opcode; CHECK_NE(-1, xi_opcode_); @@ -290,17 +284,12 @@ void DeviceDataManagerX11::UpdateDeviceList(Display* display) { } bool DeviceDataManagerX11::GetSlotNumber(const XIDeviceEvent* xiev, int* slot) { -#if defined(USE_XI2_MT) ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); if (!factory->IsMultiTouchDevice(xiev->sourceid)) { *slot = 0; return true; } return factory->QuerySlotForTrackingID(xiev->detail, slot); -#else - *slot = 0; - return true; -#endif } void DeviceDataManagerX11::GetEventRawData(const XEvent& xev, EventData* data) { @@ -674,13 +663,13 @@ void DeviceDataManagerX11::InitializeValuatorsForTest(int deviceid, bool DeviceDataManagerX11::TouchEventNeedsCalibrate( unsigned int touch_device_id) const { -#if defined(OS_CHROMEOS) && defined(USE_XI2_MT) +#if defined(OS_CHROMEOS) && defined(USE_X11) int64 touch_display_id = GetDisplayForTouchDevice(touch_device_id); if (base::SysInfo::IsRunningOnChromeOS() && touch_display_id == gfx::Display::InternalDisplayId()) { return true; } -#endif // defined(OS_CHROMEOS) && defined(USE_XI2_MT) +#endif // defined(OS_CHROMEOS) && defined(USE_X11) return false; } diff --git a/ui/events/devices/x11/touch_factory_x11.cc b/ui/events/devices/x11/touch_factory_x11.cc index e6713cd1..0a35527 100644 --- a/ui/events/devices/x11/touch_factory_x11.cc +++ b/ui/events/devices/x11/touch_factory_x11.cc @@ -85,7 +85,6 @@ void TouchFactory::UpdateDeviceList(Display* display) { touchscreen_ids_.clear(); max_touch_points_ = -1; -#if !defined(USE_XI2_MT) // NOTE: The new API for retrieving the list of devices (XIQueryDevice) does // not provide enough information to detect a touch device. As a result, the // old version of query function (XListInputDevices) is used instead. @@ -101,7 +100,6 @@ void TouchFactory::UpdateDeviceList(Display* display) { touch_device_list_[dev_list[i].id] = false; } } -#endif if (!DeviceDataManagerX11::GetInstance()->IsXInput2Available()) return; @@ -124,7 +122,6 @@ void TouchFactory::UpdateDeviceList(Display* display) { for (int i = 0; i < xi_dev_list.count; i++) { XIDeviceInfo* devinfo = xi_dev_list.devices + i; if (devinfo->use == XIFloatingSlave || devinfo->use == XIMasterPointer) { -#if defined(USE_XI2_MT) for (int k = 0; k < devinfo->num_classes; ++k) { XIAnyClassInfo* xiclassinfo = devinfo->classes[k]; if (xiclassinfo->type == XITouchClass) { @@ -139,13 +136,11 @@ void TouchFactory::UpdateDeviceList(Display* display) { } } } -#endif pointer_device_lookup_[devinfo->deviceid] = true; } else if (devinfo->use == XIMasterKeyboard) { virtual_core_keyboard_device_ = devinfo->deviceid; } -#if defined(USE_XI2_MT) if (devinfo->use == XIFloatingSlave || devinfo->use == XISlavePointer) { for (int k = 0; k < devinfo->num_classes; ++k) { XIAnyClassInfo* xiclassinfo = devinfo->classes[k]; @@ -158,7 +153,6 @@ void TouchFactory::UpdateDeviceList(Display* display) { } } } -#endif } } @@ -167,13 +161,12 @@ bool TouchFactory::ShouldProcessXI2Event(XEvent* xev) { XIEvent* event = static_cast<XIEvent*>(xev->xcookie.data); XIDeviceEvent* xiev = reinterpret_cast<XIDeviceEvent*>(event); -#if defined(USE_XI2_MT) if (event->evtype == XI_TouchBegin || event->evtype == XI_TouchUpdate || event->evtype == XI_TouchEnd) { return !touch_events_disabled_ && IsTouchDevice(xiev->deviceid); } -#endif + // Make sure only key-events from the virtual core keyboard are processed. if (event->evtype == XI_KeyPress || event->evtype == XI_KeyRelease) { return (virtual_core_keyboard_device_ < 0) || @@ -204,11 +197,10 @@ void TouchFactory::SetupXI2ForXWindow(Window window) { unsigned char mask[XIMaskLen(XI_LASTEVENT)]; memset(mask, 0, sizeof(mask)); -#if defined(USE_XI2_MT) XISetMask(mask, XI_TouchBegin); XISetMask(mask, XI_TouchUpdate); XISetMask(mask, XI_TouchEnd); -#endif + XISetMask(mask, XI_ButtonPress); XISetMask(mask, XI_ButtonRelease); XISetMask(mask, XI_Motion); diff --git a/ui/events/event_switches.cc b/ui/events/event_switches.cc index 198113f..4e4405e 100644 --- a/ui/events/event_switches.cc +++ b/ui/events/event_switches.cc @@ -34,7 +34,7 @@ const char kCompensateForUnstablePinchZoom[] = const char kTouchDevices[] = "touch-devices"; #endif -#if defined(USE_XI2_MT) || defined(USE_OZONE) +#if defined(USE_X11) || defined(USE_OZONE) // The calibration factors given as "<left>,<right>,<top>,<bottom>". const char kTouchCalibration[] = "touch-calibration"; #endif diff --git a/ui/events/event_switches.h b/ui/events/event_switches.h index ff73d9c..2cd2bcd 100644 --- a/ui/events/event_switches.h +++ b/ui/events/event_switches.h @@ -21,7 +21,7 @@ EVENTS_BASE_EXPORT extern const char kCompensateForUnstablePinchZoom[]; EVENTS_BASE_EXPORT extern const char kTouchDevices[]; #endif -#if defined(USE_XI2_MT) || defined(USE_OZONE) +#if defined(USE_X11) || defined(USE_OZONE) EVENTS_BASE_EXPORT extern const char kTouchCalibration[]; #endif diff --git a/ui/events/platform/x11/x11_event_source.cc b/ui/events/platform/x11/x11_event_source.cc index 424b4be..5101f27 100644 --- a/ui/events/platform/x11/x11_event_source.cc +++ b/ui/events/platform/x11/x11_event_source.cc @@ -35,23 +35,16 @@ bool InitializeXInput2(XDisplay* display) { } g_xinput_opcode = xiopcode; -#if defined(USE_XI2_MT) - // USE_XI2_MT also defines the required XI2 minor minimum version. - int major = 2, minor = USE_XI2_MT; -#else - int major = 2, minor = 0; -#endif + int major = 2, minor = 2; if (XIQueryVersion(display, &major, &minor) == BadRequest) { DVLOG(1) << "XInput2 not supported in the server."; return false; } -#if defined(USE_XI2_MT) - if (major < 2 || (major == 2 && minor < USE_XI2_MT)) { + if (major < 2 || (major == 2 && minor < 2)) { DVLOG(1) << "XI version on server is " << major << "." << minor << ". " - << "But 2." << USE_XI2_MT << " is required."; + << "But 2.2 is required."; return false; } -#endif return true; } diff --git a/ui/events/platform/x11/x11_hotplug_event_handler.cc b/ui/events/platform/x11/x11_hotplug_event_handler.cc index b615897..7637fb4 100644 --- a/ui/events/platform/x11/x11_hotplug_event_handler.cc +++ b/ui/events/platform/x11/x11_hotplug_event_handler.cc @@ -100,12 +100,10 @@ struct DeviceInfo { valuator_class_infos.push_back(ValuatorClassInfo( *reinterpret_cast<XIValuatorClassInfo*>(device.classes[i]))); break; -#if defined(USE_XI2_MT) case XITouchClass: touch_class_infos.push_back(TouchClassInfo( *reinterpret_cast<XITouchClassInfo*>(device.classes[i]))); break; -#endif default: break; } @@ -129,9 +127,7 @@ struct DeviceInfo { std::vector<ValuatorClassInfo> valuator_class_infos; -#if defined(USE_XI2_MT) std::vector<TouchClassInfo> touch_class_infos; -#endif }; // X11 display cache used on worker threads. This is filled on the UI thread and @@ -281,11 +277,9 @@ void HandleTouchscreenDevicesInWorker( } } -#if defined(USE_XI2_MT) for (const TouchClassInfo& info : device_info.touch_class_infos) { is_direct_touch = info.mode == XIDirectTouch; } -#endif // Touchscreens should have absolute X and Y axes, and be direct touch // devices. diff --git a/ui/events/x/events_x.cc b/ui/events/x/events_x.cc index a491884..8c1b180 100644 --- a/ui/events/x/events_x.cc +++ b/ui/events/x/events_x.cc @@ -109,7 +109,6 @@ class XModifierStateWatcher{ DISALLOW_COPY_AND_ASSIGN(XModifierStateWatcher); }; -#if defined(USE_XI2_MT) // Detects if a touch event is a driver-generated 'special event'. // A 'special event' is a touch event with maximum radius and pressure at // location (0, 0). @@ -139,7 +138,6 @@ bool TouchEventIsGeneratedHack(const base::NativeEvent& native_event) { return radius * 2 == max; } -#endif int GetEventFlagsFromXState(unsigned int state) { int flags = 0; @@ -246,7 +244,6 @@ int GetButtonMaskForX2Event(XIDeviceEvent* xievent) { ui::EventType GetTouchEventType(const base::NativeEvent& native_event) { XIDeviceEvent* event = static_cast<XIDeviceEvent*>(native_event->xcookie.data); -#if defined(USE_XI2_MT) switch(event->evtype) { case XI_TouchBegin: return TouchEventIsGeneratedHack(native_event) ? ui::ET_UNKNOWN : @@ -258,7 +255,6 @@ ui::EventType GetTouchEventType(const base::NativeEvent& native_event) { return TouchEventIsGeneratedHack(native_event) ? ui::ET_TOUCH_CANCELLED : ui::ET_TOUCH_RELEASED; } -#endif // defined(USE_XI2_MT) DCHECK(ui::TouchFactory::GetInstance()->IsTouchDevice(event->sourceid)); switch (event->evtype) { @@ -487,7 +483,6 @@ int EventFlagsFromNative(const base::NativeEvent& native_event) { static_cast<XIDeviceEvent*>(native_event->xcookie.data); switch (xievent->evtype) { -#if defined(USE_XI2_MT) case XI_TouchBegin: case XI_TouchUpdate: case XI_TouchEnd: @@ -496,7 +491,6 @@ int EventFlagsFromNative(const base::NativeEvent& native_event) { GetEventFlagsFromXState( XModifierStateWatcher::GetInstance()->state()); break; -#endif case XI_ButtonPress: case XI_ButtonRelease: { const bool touch = diff --git a/ui/events/x/events_x_unittest.cc b/ui/events/x/events_x_unittest.cc index f33661f..86ecfec 100644 --- a/ui/events/x/events_x_unittest.cc +++ b/ui/events/x/events_x_unittest.cc @@ -215,7 +215,6 @@ TEST_F(EventsXTest, ClickCount) { } } -#if defined(USE_XI2_MT) TEST_F(EventsXTest, TouchEventBasic) { std::vector<unsigned int> devices; devices.push_back(0); @@ -350,7 +349,6 @@ TEST_F(EventsXTest, TouchEventIdRefcounting) { urelease0.reset(); EXPECT_EQ(-1, GetTouchIdForTrackingId(kTrackingId0)); } -#endif TEST_F(EventsXTest, NumpadKeyEvents) { XEvent event; @@ -508,7 +506,6 @@ TEST_F(EventsXTest, FunctionKeyEvents) { EXPECT_FALSE(HasFunctionKeyFlagSetIfSupported(display, XK_F35 + 1)); } -#if defined(USE_XI2_MT) // Verifies that the type of events from a disabled keyboard is ET_UNKNOWN, but // that an exception list of keys can still be processed. TEST_F(EventsXTest, DisableKeyboard) { @@ -597,7 +594,6 @@ TEST_F(EventsXTest, DisableMouse) { EF_LEFT_MOUSE_BUTTON); EXPECT_EQ(ui::ET_MOUSE_PRESSED, ui::EventTypeFromNative(xev)); } -#endif // defined(USE_XI2_MT) #if !defined(OS_CHROMEOS) TEST_F(EventsXTest, ImeFabricatedKeyEvents) { |