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

Side by Side Diff: ui/base/x/events_x.cc

Issue 8624010: Revert 111016 - aura: Re-enable XInput2 events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/desktop_host_linux.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/base/events.h" 5 #include "ui/base/events.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 "base/logging.h" 10 #include "base/logging.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) { 241 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) {
242 switch (native_event->type) { 242 switch (native_event->type) {
243 case ButtonPress: 243 case ButtonPress:
244 case ButtonRelease: 244 case ButtonRelease:
245 return gfx::Point(native_event->xbutton.x, native_event->xbutton.y); 245 return gfx::Point(native_event->xbutton.x, native_event->xbutton.y);
246 case MotionNotify: 246 case MotionNotify:
247 return gfx::Point(native_event->xmotion.x, native_event->xmotion.y); 247 return gfx::Point(native_event->xmotion.x, native_event->xmotion.y);
248 case GenericEvent: { 248 case GenericEvent: {
249 XIDeviceEvent* xievent = 249 XIDeviceEvent* xievent =
250 static_cast<XIDeviceEvent*>(native_event->xcookie.data); 250 static_cast<XIDeviceEvent*>(native_event->xcookie.data);
251 251 return gfx::Point(static_cast<int>(xievent->event_x),
252 if (xievent->sourceid == xievent->deviceid) { 252 static_cast<int>(xievent->event_y));
253 // This event is coming from a slave device. Read the position from the
254 // valuators, because the events reported for a slave device seems to be
255 // behind the master device by one event. See more on crbug.com/103981.
256 // The position in the valuators is in the global screen coordinates.
257 // But it is necessary to convert it into the window's coordinates.
258 // Prepare to be revolted.
259 double x = xievent->valuators.values[0] - (xievent->root_x -
260 xievent->event_x);
261 double y = xievent->valuators.values[1] - (xievent->root_y -
262 xievent->event_y);
263 return gfx::Point(static_cast<int>(x), static_cast<int>(y));
264 } else {
265 return gfx::Point(static_cast<int>(xievent->event_x),
266 static_cast<int>(xievent->event_y));
267 }
268 } 253 }
269 } 254 }
270 return gfx::Point(); 255 return gfx::Point();
271 } 256 }
272 257
273 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { 258 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) {
274 return KeyboardCodeFromXKeyEvent(native_event); 259 return KeyboardCodeFromXKeyEvent(native_event);
275 } 260 }
276 261
277 bool IsMouseEvent(const base::NativeEvent& native_event) { 262 bool IsMouseEvent(const base::NativeEvent& native_event) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 static XEvent* noop = new XEvent(); 359 static XEvent* noop = new XEvent();
375 noop->xclient.type = ClientMessage; 360 noop->xclient.type = ClientMessage;
376 noop->xclient.display = NULL; 361 noop->xclient.display = NULL;
377 noop->xclient.window = None; 362 noop->xclient.window = None;
378 noop->xclient.message_type = 0; 363 noop->xclient.message_type = 0;
379 noop->xclient.format = 0; 364 noop->xclient.format = 0;
380 return noop; 365 return noop;
381 } 366 }
382 367
383 } // namespace ui 368 } // namespace ui
OLDNEW
« no previous file with comments | « ui/aura/desktop_host_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698