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

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

Issue 8521001: Touch to Mouse conversion validation of views::GestureManager (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 1 month 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
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/extensions/XInput2.h> 7 #include <X11/extensions/XInput2.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/base/keycodes/keyboard_code_conversion_x.h" 10 #include "ui/base/keycodes/keyboard_code_conversion_x.h"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 0.0); 347 0.0);
348 unsigned int deviceid = 348 unsigned int deviceid =
349 static_cast<XIDeviceEvent*>(native_event->xcookie.data)->sourceid; 349 static_cast<XIDeviceEvent*>(native_event->xcookie.data)->sourceid;
350 // Force is normalized to fall into [0, 1] 350 // Force is normalized to fall into [0, 1]
351 if (!ui::TouchFactory::GetInstance()->NormalizeTouchParam( 351 if (!ui::TouchFactory::GetInstance()->NormalizeTouchParam(
352 deviceid, ui::TouchFactory::TP_PRESSURE, &force)) 352 deviceid, ui::TouchFactory::TP_PRESSURE, &force))
353 force = 0.0; 353 force = 0.0;
354 return force; 354 return force;
355 } 355 }
356 356
357 base::NativeEvent GetNativeEventForTesting() {
rjkroege 2011/11/10 16:34:40 see comment in .h file -- move this to the test.
Gajen 2011/11/11 13:39:07 Done.
358 XEvent* event = new XEvent;
359 memset(event, 0, sizeof(*event));
360 XGenericEventCookie* cookie = &(event->xcookie);
361 cookie->type = GenericEvent;
362 XIDeviceEvent* dev_event = new XIDeviceEvent;
363 memset(dev_event, 0, sizeof(*dev_event));
364 cookie->data = dev_event;
365 return event;
366 }
367
368 void SetNativeEventLocationForTesting(const base::NativeEvent& native_event,
369 int x, int y) {
370 XIDeviceEvent* xievent =
371 static_cast<XIDeviceEvent*>(native_event->xcookie.data);
372 xievent->event_x = x;
373 xievent->event_y = y;
374 return;
375 }
376
357 } // namespace ui 377 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698