OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/widget/x11_window_event_filter.h" | 5 #include "ui/views/widget/x11_window_event_filter.h" |
6 | 6 |
7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #include <X11/extensions/XInput.h> | 9 #include <X11/extensions/XInput.h> |
10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 ui::MouseEvent* event) { | 99 ui::MouseEvent* event) { |
100 if (event->type() != ui::ET_MOUSE_PRESSED) | 100 if (event->type() != ui::ET_MOUSE_PRESSED) |
101 return false; | 101 return false; |
102 | 102 |
103 int component = | 103 int component = |
104 target->delegate()->GetNonClientComponent(event->location()); | 104 target->delegate()->GetNonClientComponent(event->location()); |
105 if (component == HTCLIENT) | 105 if (component == HTCLIENT) |
106 return false; | 106 return false; |
107 | 107 |
108 // Get the |x_root_window_| location out of the native event. | 108 // Get the |x_root_window_| location out of the native event. |
109 gfx::Point root_location; | 109 gfx::Point root_location = event->system_location(); |
110 const base::NativeEvent& native_event = event->native_event(); | |
111 switch (native_event->type) { | |
112 case ButtonPress: { | |
113 root_location.SetPoint(native_event->xbutton.x_root, | |
114 native_event->xbutton.y_root); | |
115 break; | |
116 } | |
117 case GenericEvent: { | |
118 XIDeviceEvent* xievent = | |
119 static_cast<XIDeviceEvent*>(native_event->xcookie.data); | |
120 root_location.SetPoint(xievent->root_x, xievent->root_y); | |
121 break; | |
122 } | |
123 default: { | |
124 NOTREACHED(); | |
125 return false; | |
126 } | |
127 } | |
128 | |
129 return DispatchHostWindowDragMovement(component, root_location); | 110 return DispatchHostWindowDragMovement(component, root_location); |
130 } | 111 } |
131 | 112 |
132 ui::TouchStatus X11WindowEventFilter::PreHandleTouchEvent( | 113 ui::TouchStatus X11WindowEventFilter::PreHandleTouchEvent( |
133 aura::Window* target, | 114 aura::Window* target, |
134 ui::TouchEvent* event) { | 115 ui::TouchEvent* event) { |
135 return ui::TOUCH_STATUS_UNKNOWN; | 116 return ui::TOUCH_STATUS_UNKNOWN; |
136 } | 117 } |
137 | 118 |
138 ui::GestureStatus X11WindowEventFilter::PreHandleGestureEvent( | 119 ui::GestureStatus X11WindowEventFilter::PreHandleGestureEvent( |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 179 |
199 XSendEvent(xdisplay_, x_root_window_, False, | 180 XSendEvent(xdisplay_, x_root_window_, False, |
200 SubstructureRedirectMask | SubstructureNotifyMask, | 181 SubstructureRedirectMask | SubstructureNotifyMask, |
201 &event); | 182 &event); |
202 | 183 |
203 return true; | 184 return true; |
204 } | 185 } |
205 | 186 |
206 } // namespace views | 187 } // namespace views |
207 | 188 |
OLD | NEW |