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

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

Issue 8585015: Implement ui_controls for aura (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
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 #include <string.h>
9 10
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "ui/base/keycodes/keyboard_code_conversion_x.h" 12 #include "ui/base/keycodes/keyboard_code_conversion_x.h"
12 #include "ui/base/touch/touch_factory.h" 13 #include "ui/base/touch/touch_factory.h"
13 #include "ui/gfx/point.h" 14 #include "ui/gfx/point.h"
14 15
16 #if !defined(TOOLKIT_USES_GTK)
17 #include "base/message_pump_x.h"
18 #endif
19
15 namespace { 20 namespace {
16 21
17 // Scroll amount for each wheelscroll event. 53 is also the value used for GTK+. 22 // Scroll amount for each wheelscroll event. 53 is also the value used for GTK+.
18 static const int kWheelScrollAmount = 53; 23 static const int kWheelScrollAmount = 53;
19 24
20 static const int kMinWheelButton = 4; 25 static const int kMinWheelButton = 4;
21 #if defined(OS_CHROMEOS) 26 #if defined(OS_CHROMEOS)
22 // Chrome OS also uses buttons 8 and 9 for scrolling. 27 // Chrome OS also uses buttons 8 and 9 for scrolling.
23 static const int kMaxWheelButton = 9; 28 static const int kMaxWheelButton = 9;
24 #else 29 #else
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 unsigned int deviceid = 369 unsigned int deviceid =
365 static_cast<XIDeviceEvent*>(native_event->xcookie.data)->sourceid; 370 static_cast<XIDeviceEvent*>(native_event->xcookie.data)->sourceid;
366 // Force is normalized to fall into [0, 1] 371 // Force is normalized to fall into [0, 1]
367 if (!ui::TouchFactory::GetInstance()->NormalizeTouchParam( 372 if (!ui::TouchFactory::GetInstance()->NormalizeTouchParam(
368 deviceid, ui::TouchFactory::TP_PRESSURE, &force)) 373 deviceid, ui::TouchFactory::TP_PRESSURE, &force))
369 force = 0.0; 374 force = 0.0;
370 return force; 375 return force;
371 } 376 }
372 377
373 base::NativeEvent CreateNoopEvent() { 378 base::NativeEvent CreateNoopEvent() {
374 static XEvent* noop = new XEvent(); 379 static XEvent* noop = NULL;
375 noop->xclient.type = ClientMessage; 380 if (!noop) {
376 noop->xclient.display = NULL; 381 noop = new XEvent();
377 noop->xclient.window = None; 382 memset(noop, 0, sizeof(XEvent));
378 noop->xclient.message_type = 0; 383 noop->xclient.type = ClientMessage;
379 noop->xclient.format = 0; 384 noop->xclient.window = None;
385 noop->xclient.format = 8;
386 DCHECK(!noop->xclient.display);
387 }
388 // TODO(oshima): Remove ifdef once gtk is removed from views.
389 #if defined(TOOLKIT_USES_GTK)
390 NOTREACHED();
391 #else
392 // Make sure we use atom from current xdisplay, which may
393 // change during the test.
394 noop->xclient.message_type = XInternAtom(
395 base::MessagePumpX::GetDefaultXDisplay(),
396 "noop", False);
397 #endif
380 return noop; 398 return noop;
381 } 399 }
382 400
383 } // namespace ui 401 } // namespace ui
OLDNEW
« ui/aura/desktop_host_linux.cc ('K') | « ui/aura/desktop_host_win.cc ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698