| 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 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool X11Window::CanDispatchEvent(const PlatformEvent& xev) { | 82 bool X11Window::CanDispatchEvent(const PlatformEvent& xev) { |
| 83 return IsEventForXWindow(*xev); | 83 return IsEventForXWindow(*xev); |
| 84 } | 84 } |
| 85 | 85 |
| 86 uint32_t X11Window::DispatchEvent(const PlatformEvent& event) { | 86 uint32_t X11Window::DispatchEvent(const PlatformEvent& event) { |
| 87 XEvent* xev = event; | 87 XEvent* xev = event; |
| 88 switch (xev->type) { | 88 switch (xev->type) { |
| 89 case EnterNotify: { | 89 case EnterNotify: { |
| 90 // EnterNotify creates ET_MOUSE_MOVED. Mark as synthesized as this is | |
| 91 // not real mouse move event. | |
| 92 MouseEvent mouse_event(xev); | 90 MouseEvent mouse_event(xev); |
| 93 CHECK_EQ(ET_MOUSE_MOVED, mouse_event.type()); | 91 CHECK_EQ(ET_MOUSE_MOVED, mouse_event.type()); |
| 94 mouse_event.set_flags(mouse_event.flags() | EF_IS_SYNTHESIZED); | |
| 95 delegate()->DispatchEvent(&mouse_event); | 92 delegate()->DispatchEvent(&mouse_event); |
| 96 break; | 93 break; |
| 97 } | 94 } |
| 98 case LeaveNotify: { | 95 case LeaveNotify: { |
| 99 MouseEvent mouse_event(xev); | 96 MouseEvent mouse_event(xev); |
| 100 delegate()->DispatchEvent(&mouse_event); | 97 delegate()->DispatchEvent(&mouse_event); |
| 101 break; | 98 break; |
| 102 } | 99 } |
| 103 | 100 |
| 104 case KeyPress: | 101 case KeyPress: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 139 |
| 143 case GenericEvent: { | 140 case GenericEvent: { |
| 144 ProcessXInput2Event(xev); | 141 ProcessXInput2Event(xev); |
| 145 break; | 142 break; |
| 146 } | 143 } |
| 147 } | 144 } |
| 148 return POST_DISPATCH_STOP_PROPAGATION; | 145 return POST_DISPATCH_STOP_PROPAGATION; |
| 149 } | 146 } |
| 150 | 147 |
| 151 } // namespace ui | 148 } // namespace ui |
| OLD | NEW |