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/platform_window/x11/x11_window.h" | 5 #include "ui/platform_window/x11/x11_window.h" |
6 | 6 |
7 #include <X11/extensions/XInput2.h> | 7 #include <X11/extensions/XInput2.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #include <X11/Xutil.h> | 9 #include <X11/Xutil.h> |
10 | 10 |
11 #include "ui/events/devices/x11/touch_factory_x11.h" | 11 #include "ui/events/devices/x11/touch_factory_x11.h" |
12 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
13 #include "ui/events/event_utils.h" | 13 #include "ui/events/event_utils.h" |
14 #include "ui/events/platform/platform_event_source.h" | 14 #include "ui/events/platform/platform_event_source.h" |
15 #include "ui/events/platform/x11/x11_event_source.h" | 15 #include "ui/events/platform/x11/x11_event_source.h" |
16 #include "ui/platform_window/platform_window_delegate.h" | 16 #include "ui/platform_window/platform_window_delegate.h" |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 | 19 |
20 X11Window::X11Window(PlatformWindowDelegate* delegate, const gfx::Rect& bounds) | 20 X11Window::X11Window(PlatformWindowDelegate* delegate, const gfx::Rect& bounds) |
21 : X11WindowBase(delegate, bounds) { | 21 : X11WindowBase(delegate, bounds) { |
22 DCHECK(PlatformEventSource::GetInstance()); | 22 DCHECK(PlatformEventSource::GetInstance()); |
23 PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); | 23 PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
24 } | 24 } |
25 | 25 |
26 X11Window::~X11Window() { | 26 X11Window::~X11Window() { |
| 27 X11Window::PrepareForShutdown(); |
| 28 } |
| 29 |
| 30 void X11Window::PrepareForShutdown() { |
27 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | 31 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
28 } | 32 } |
29 | 33 |
30 void X11Window::SetCursor(PlatformCursor cursor) { | 34 void X11Window::SetCursor(PlatformCursor cursor) { |
31 XDefineCursor(xdisplay(), xwindow(), cursor); | 35 XDefineCursor(xdisplay(), xwindow(), cursor); |
32 } | 36 } |
33 | 37 |
34 void X11Window::ProcessXInput2Event(XEvent* xev) { | 38 void X11Window::ProcessXInput2Event(XEvent* xev) { |
35 if (!TouchFactory::GetInstance()->ShouldProcessXI2Event(xev)) | 39 if (!TouchFactory::GetInstance()->ShouldProcessXI2Event(xev)) |
36 return; | 40 return; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 142 |
139 case GenericEvent: { | 143 case GenericEvent: { |
140 ProcessXInput2Event(xev); | 144 ProcessXInput2Event(xev); |
141 break; | 145 break; |
142 } | 146 } |
143 } | 147 } |
144 return POST_DISPATCH_STOP_PROPAGATION; | 148 return POST_DISPATCH_STOP_PROPAGATION; |
145 } | 149 } |
146 | 150 |
147 } // namespace ui | 151 } // namespace ui |
OLD | NEW |