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

Side by Side Diff: ui/aura/window_tree_host_x11.cc

Issue 183853037: aura: Remove client::UserActionClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unrevert Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/aura/window_tree_host_x11.h" 5 #include "ui/aura/window_tree_host_x11.h"
6 6
7 #include <strings.h> 7 #include <strings.h>
8 #include <X11/cursorfont.h> 8 #include <X11/cursorfont.h>
9 #include <X11/extensions/Xfixes.h> 9 #include <X11/extensions/Xfixes.h>
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
(...skipping 11 matching lines...) Expand all
22 #include "base/debug/trace_event.h" 22 #include "base/debug/trace_event.h"
23 #include "base/message_loop/message_loop.h" 23 #include "base/message_loop/message_loop.h"
24 #include "base/message_loop/message_pump_x11.h" 24 #include "base/message_loop/message_pump_x11.h"
25 #include "base/stl_util.h" 25 #include "base/stl_util.h"
26 #include "base/strings/string_number_conversions.h" 26 #include "base/strings/string_number_conversions.h"
27 #include "base/strings/string_util.h" 27 #include "base/strings/string_util.h"
28 #include "base/strings/stringprintf.h" 28 #include "base/strings/stringprintf.h"
29 #include "base/sys_info.h" 29 #include "base/sys_info.h"
30 #include "ui/aura/client/cursor_client.h" 30 #include "ui/aura/client/cursor_client.h"
31 #include "ui/aura/client/screen_position_client.h" 31 #include "ui/aura/client/screen_position_client.h"
32 #include "ui/aura/client/user_action_client.h"
33 #include "ui/aura/env.h" 32 #include "ui/aura/env.h"
34 #include "ui/aura/window_event_dispatcher.h" 33 #include "ui/aura/window_event_dispatcher.h"
35 #include "ui/base/cursor/cursor.h" 34 #include "ui/base/cursor/cursor.h"
36 #include "ui/base/ui_base_switches.h" 35 #include "ui/base/ui_base_switches.h"
37 #include "ui/base/view_prop.h" 36 #include "ui/base/view_prop.h"
38 #include "ui/base/x/x11_util.h" 37 #include "ui/base/x/x11_util.h"
39 #include "ui/compositor/dip_util.h" 38 #include "ui/compositor/dip_util.h"
40 #include "ui/compositor/layer.h" 39 #include "ui/compositor/layer.h"
41 #include "ui/events/event.h" 40 #include "ui/events/event.h"
42 #include "ui/events/event_utils.h" 41 #include "ui/events/event_utils.h"
43 #include "ui/events/keycodes/keyboard_codes.h" 42 #include "ui/events/keycodes/keyboard_codes.h"
44 #include "ui/events/x/device_data_manager.h" 43 #include "ui/events/x/device_data_manager.h"
45 #include "ui/events/x/device_list_cache_x.h" 44 #include "ui/events/x/device_list_cache_x.h"
46 #include "ui/events/x/touch_factory_x11.h" 45 #include "ui/events/x/touch_factory_x11.h"
47 #include "ui/gfx/screen.h" 46 #include "ui/gfx/screen.h"
48 47
49 using std::max; 48 using std::max;
50 using std::min; 49 using std::min;
51 50
52 namespace aura { 51 namespace aura {
53 52
54 namespace { 53 namespace {
55 54
56 // Standard Linux mouse buttons for going back and forward.
57 const int kBackMouseButton = 8;
58 const int kForwardMouseButton = 9;
59
60 const char* kAtomsToCache[] = { 55 const char* kAtomsToCache[] = {
61 "WM_DELETE_WINDOW", 56 "WM_DELETE_WINDOW",
62 "_NET_WM_PING", 57 "_NET_WM_PING",
63 "_NET_WM_PID", 58 "_NET_WM_PID",
64 "WM_S0", 59 "WM_S0",
65 #if defined(OS_CHROMEOS) 60 #if defined(OS_CHROMEOS)
66 "Tap Paused", // Defined in the gestures library. 61 "Tap Paused", // Defined in the gestures library.
67 #endif 62 #endif
68 NULL 63 NULL
69 }; 64 };
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 case KeyPress: { 387 case KeyPress: {
393 ui::KeyEvent keydown_event(xev, false); 388 ui::KeyEvent keydown_event(xev, false);
394 SendEventToProcessor(&keydown_event); 389 SendEventToProcessor(&keydown_event);
395 break; 390 break;
396 } 391 }
397 case KeyRelease: { 392 case KeyRelease: {
398 ui::KeyEvent keyup_event(xev, false); 393 ui::KeyEvent keyup_event(xev, false);
399 SendEventToProcessor(&keyup_event); 394 SendEventToProcessor(&keyup_event);
400 break; 395 break;
401 } 396 }
402 case ButtonPress: { 397 case ButtonPress:
403 if (static_cast<int>(xev->xbutton.button) == kBackMouseButton ||
404 static_cast<int>(xev->xbutton.button) == kForwardMouseButton) {
405 client::UserActionClient* gesture_client =
406 client::GetUserActionClient(delegate_->AsDispatcher()->window());
407 if (gesture_client) {
408 gesture_client->OnUserAction(
409 static_cast<int>(xev->xbutton.button) == kBackMouseButton ?
410 client::UserActionClient::BACK :
411 client::UserActionClient::FORWARD);
412 }
413 break;
414 }
415 } // fallthrough
416 case ButtonRelease: { 398 case ButtonRelease: {
417 switch (ui::EventTypeFromNative(xev)) { 399 switch (ui::EventTypeFromNative(xev)) {
418 case ui::ET_MOUSEWHEEL: { 400 case ui::ET_MOUSEWHEEL: {
419 ui::MouseWheelEvent mouseev(xev); 401 ui::MouseWheelEvent mouseev(xev);
420 TranslateAndDispatchMouseEvent(&mouseev); 402 TranslateAndDispatchMouseEvent(&mouseev);
421 break; 403 break;
422 } 404 }
423 case ui::ET_MOUSE_PRESSED: 405 case ui::ET_MOUSE_PRESSED:
424 case ui::ET_MOUSE_RELEASED: { 406 case ui::ET_MOUSE_RELEASED: {
425 ui::MouseEvent mouseev(xev); 407 ui::MouseEvent mouseev(xev);
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 case ui::ET_MOUSE_PRESSED: 840 case ui::ET_MOUSE_PRESSED:
859 case ui::ET_MOUSE_RELEASED: 841 case ui::ET_MOUSE_RELEASED:
860 case ui::ET_MOUSE_ENTERED: 842 case ui::ET_MOUSE_ENTERED:
861 case ui::ET_MOUSE_EXITED: { 843 case ui::ET_MOUSE_EXITED: {
862 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_DRAGGED) { 844 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_DRAGGED) {
863 // If this is a motion event, we want to coalesce all pending motion 845 // If this is a motion event, we want to coalesce all pending motion
864 // events that are at the top of the queue. 846 // events that are at the top of the queue.
865 num_coalesced = ui::CoalescePendingMotionEvents(xev, &last_event); 847 num_coalesced = ui::CoalescePendingMotionEvents(xev, &last_event);
866 if (num_coalesced > 0) 848 if (num_coalesced > 0)
867 xev = &last_event; 849 xev = &last_event;
868 } else if (type == ui::ET_MOUSE_PRESSED ||
869 type == ui::ET_MOUSE_RELEASED) {
870 XIDeviceEvent* xievent =
871 static_cast<XIDeviceEvent*>(xev->xcookie.data);
872 int button = xievent->detail;
873 if (button == kBackMouseButton || button == kForwardMouseButton) {
874 if (type == ui::ET_MOUSE_RELEASED)
875 break;
876 client::UserActionClient* gesture_client =
877 client::GetUserActionClient(delegate_->AsDispatcher()->window());
878 if (gesture_client) {
879 bool reverse_direction =
880 ui::IsTouchpadEvent(xev) && ui::IsNaturalScrollEnabled();
881 gesture_client->OnUserAction(
882 (button == kBackMouseButton && !reverse_direction) ||
883 (button == kForwardMouseButton && reverse_direction) ?
884 client::UserActionClient::BACK :
885 client::UserActionClient::FORWARD);
886 }
887 break;
888 }
889 } 850 }
890 ui::MouseEvent mouseev(xev); 851 ui::MouseEvent mouseev(xev);
891 TranslateAndDispatchMouseEvent(&mouseev); 852 TranslateAndDispatchMouseEvent(&mouseev);
892 break; 853 break;
893 } 854 }
894 case ui::ET_MOUSEWHEEL: { 855 case ui::ET_MOUSEWHEEL: {
895 ui::MouseWheelEvent mouseev(xev); 856 ui::MouseWheelEvent mouseev(xev);
896 TranslateAndDispatchMouseEvent(&mouseev); 857 TranslateAndDispatchMouseEvent(&mouseev);
897 break; 858 break;
898 } 859 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 } 959 }
999 960
1000 namespace test { 961 namespace test {
1001 962
1002 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { 963 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) {
1003 default_override_redirect = override_redirect; 964 default_override_redirect = override_redirect;
1004 } 965 }
1005 966
1006 } // namespace test 967 } // namespace test
1007 } // namespace aura 968 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/client/user_action_client.cc ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698