Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1496)

Side by Side Diff: ui/events/platform/x11/x11_event_source_libevent.cc

Issue 2933353003: Mark the ET_MOUSE_MOVED created from a pointer grab as synthesized. (Closed)
Patch Set: Clarify comment. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/aura/window_tree_host_x11.cc ('k') | ui/events/x/events_x_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/aura/window_tree_host_x11.cc ('k') | ui/events/x/events_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698