| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/events/platform/x11/x11_event_source.h" | 5 #include "ui/events/platform/x11/x11_event_source.h" |
| 6 | 6 |
| 7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 #include <X11/XKBlib.h> | 8 #include <X11/XKBlib.h> |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 InitializeXkb(display_); | 107 InitializeXkb(display_); |
| 108 } | 108 } |
| 109 | 109 |
| 110 X11EventSource::~X11EventSource() { | 110 X11EventSource::~X11EventSource() { |
| 111 DCHECK_EQ(this, instance_); | 111 DCHECK_EQ(this, instance_); |
| 112 instance_ = nullptr; | 112 instance_ = nullptr; |
| 113 if (dummy_initialized_) | 113 if (dummy_initialized_) |
| 114 XDestroyWindow(display_, dummy_window_); | 114 XDestroyWindow(display_, dummy_window_); |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool X11EventSource::HasInstance() { |
| 118 return instance_; |
| 119 } |
| 120 |
| 117 // static | 121 // static |
| 118 X11EventSource* X11EventSource::GetInstance() { | 122 X11EventSource* X11EventSource::GetInstance() { |
| 119 DCHECK(instance_); | 123 DCHECK(instance_); |
| 120 return instance_; | 124 return instance_; |
| 121 } | 125 } |
| 122 | 126 |
| 123 //////////////////////////////////////////////////////////////////////////////// | 127 //////////////////////////////////////////////////////////////////////////////// |
| 124 // X11EventSource, public | 128 // X11EventSource, public |
| 125 | 129 |
| 126 void X11EventSource::DispatchXEvents() { | 130 void X11EventSource::DispatchXEvents() { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 231 |
| 228 void X11EventSource::OnDispatcherListChanged() { | 232 void X11EventSource::OnDispatcherListChanged() { |
| 229 if (!hotplug_event_handler_) { | 233 if (!hotplug_event_handler_) { |
| 230 hotplug_event_handler_.reset(new X11HotplugEventHandler()); | 234 hotplug_event_handler_.reset(new X11HotplugEventHandler()); |
| 231 // Force the initial device query to have an update list of active devices. | 235 // Force the initial device query to have an update list of active devices. |
| 232 hotplug_event_handler_->OnHotplugEvent(); | 236 hotplug_event_handler_->OnHotplugEvent(); |
| 233 } | 237 } |
| 234 } | 238 } |
| 235 | 239 |
| 236 } // namespace ui | 240 } // namespace ui |
| OLD | NEW |