Index: ui/events/platform/x11/x11_event_source.cc |
diff --git a/ui/events/platform/x11/x11_event_source.cc b/ui/events/platform/x11/x11_event_source.cc |
index 6688d6146fb3c5d66e5db9ef8c091fc5cacefea9..5101f2703a3bff44f677e1c64db1a2ec09532980 100644 |
--- a/ui/events/platform/x11/x11_event_source.cc |
+++ b/ui/events/platform/x11/x11_event_source.cc |
@@ -6,14 +6,14 @@ |
#include <X11/extensions/XInput2.h> |
#include <X11/X.h> |
-#include <X11/XKBlib.h> |
#include <X11/Xlib.h> |
+#include <X11/XKBlib.h> |
#include "base/logging.h" |
+#include "ui/events/devices/x11/device_data_manager_x11.h" |
+#include "ui/events/event_utils.h" |
#include "ui/events/platform/platform_event_dispatcher.h" |
-#include "ui/events/platform/platform_event_utils.h" |
-#include "ui/events/platform/x11/device_data_manager_x11.h" |
-#include "ui/events/platform/x11/hotplug_event_handler_x11.h" |
+#include "ui/events/platform/x11/x11_hotplug_event_handler.h" |
#include "ui/gfx/x/x11_types.h" |
namespace ui { |
@@ -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; |
} |
@@ -86,13 +79,8 @@ X11EventSource::X11EventSource(XDisplay* display) |
continue_stream_(true) { |
CHECK(display_); |
DeviceDataManagerX11::CreateInstance(); |
- hotplug_event_handler_.reset( |
- new HotplugEventHandlerX11(DeviceDataManager::GetInstance())); |
InitializeXInput2(display_); |
InitializeXkb(display_); |
- |
- // Force the initial device query to have an update list of active devices. |
- hotplug_event_handler_->OnHotplugEvent(); |
} |
X11EventSource::~X11EventSource() { |
@@ -155,4 +143,12 @@ void X11EventSource::StopCurrentEventStream() { |
continue_stream_ = false; |
} |
+void X11EventSource::OnDispatcherListChanged() { |
+ if (!hotplug_event_handler_) { |
+ hotplug_event_handler_.reset(new X11HotplugEventHandler()); |
+ // Force the initial device query to have an update list of active devices. |
+ hotplug_event_handler_->OnHotplugEvent(); |
+ } |
+} |
+ |
} // namespace ui |