| 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_libevent.h" | 5 #include "ui/events/platform/x11/x11_event_source_libevent.h" |
| 6 | 6 |
| 7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 return nullptr; | 81 return nullptr; |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Translates a XEvent into a ui::Event. | 84 // Translates a XEvent into a ui::Event. |
| 85 std::unique_ptr<ui::Event> TranslateXEventToEvent(const XEvent& xev) { | 85 std::unique_ptr<ui::Event> TranslateXEventToEvent(const XEvent& xev) { |
| 86 int flags = EventFlagsFromXEvent(xev); | 86 int flags = EventFlagsFromXEvent(xev); |
| 87 switch (xev.type) { | 87 switch (xev.type) { |
| 88 case LeaveNotify: | 88 case LeaveNotify: |
| 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 if (xev.type == EnterNotify) | |
| 93 flags |= EF_IS_SYNTHESIZED; | |
| 94 return base::MakeUnique<MouseEvent>(ET_MOUSE_MOVED, | 90 return base::MakeUnique<MouseEvent>(ET_MOUSE_MOVED, |
| 95 EventLocationFromXEvent(xev), | 91 EventLocationFromXEvent(xev), |
| 96 EventSystemLocationFromXEvent(xev), | 92 EventSystemLocationFromXEvent(xev), |
| 97 EventTimeFromXEvent(xev), flags, 0); | 93 EventTimeFromXEvent(xev), flags, 0); |
| 98 | 94 |
| 99 case KeyPress: | 95 case KeyPress: |
| 100 case KeyRelease: | 96 case KeyRelease: |
| 101 return base::MakeUnique<KeyEvent>(EventTypeFromXEvent(xev), | 97 return base::MakeUnique<KeyEvent>(EventTypeFromXEvent(xev), |
| 102 KeyboardCodeFromXKeyEvent(&xev), flags); | 98 KeyboardCodeFromXKeyEvent(&xev), flags); |
| 103 | 99 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 193 |
| 198 void X11EventSourceLibevent::OnFileCanReadWithoutBlocking(int fd) { | 194 void X11EventSourceLibevent::OnFileCanReadWithoutBlocking(int fd) { |
| 199 event_source_.DispatchXEvents(); | 195 event_source_.DispatchXEvents(); |
| 200 } | 196 } |
| 201 | 197 |
| 202 void X11EventSourceLibevent::OnFileCanWriteWithoutBlocking(int fd) { | 198 void X11EventSourceLibevent::OnFileCanWriteWithoutBlocking(int fd) { |
| 203 NOTREACHED(); | 199 NOTREACHED(); |
| 204 } | 200 } |
| 205 | 201 |
| 206 } // namespace ui | 202 } // namespace ui |
| OLD | NEW |