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

Side by Side Diff: ui/aura/test/ui_controls_factory_aurax11.cc

Issue 623293004: replace OVERRIDE and FINAL with override and final in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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/test/test_window_tree_client.h ('k') | ui/aura/test/ui_controls_factory_ozone.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <X11/keysym.h> 5 #include <X11/keysym.h>
6 #include <X11/Xlib.h> 6 #include <X11/Xlib.h>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/aura/client/screen_position_client.h" 10 #include "ui/aura/client/screen_position_client.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 class UIControlsX11 : public UIControlsAura { 48 class UIControlsX11 : public UIControlsAura {
49 public: 49 public:
50 UIControlsX11(WindowTreeHost* host) : host_(host) { 50 UIControlsX11(WindowTreeHost* host) : host_(host) {
51 } 51 }
52 52
53 virtual bool SendKeyPress(gfx::NativeWindow window, 53 virtual bool SendKeyPress(gfx::NativeWindow window,
54 ui::KeyboardCode key, 54 ui::KeyboardCode key,
55 bool control, 55 bool control,
56 bool shift, 56 bool shift,
57 bool alt, 57 bool alt,
58 bool command) OVERRIDE { 58 bool command) override {
59 return SendKeyPressNotifyWhenDone( 59 return SendKeyPressNotifyWhenDone(
60 window, key, control, shift, alt, command, base::Closure()); 60 window, key, control, shift, alt, command, base::Closure());
61 } 61 }
62 virtual bool SendKeyPressNotifyWhenDone( 62 virtual bool SendKeyPressNotifyWhenDone(
63 gfx::NativeWindow window, 63 gfx::NativeWindow window,
64 ui::KeyboardCode key, 64 ui::KeyboardCode key,
65 bool control, 65 bool control,
66 bool shift, 66 bool shift,
67 bool alt, 67 bool alt,
68 bool command, 68 bool command,
69 const base::Closure& closure) OVERRIDE { 69 const base::Closure& closure) override {
70 XEvent xevent = {0}; 70 XEvent xevent = {0};
71 xevent.xkey.type = KeyPress; 71 xevent.xkey.type = KeyPress;
72 if (control) 72 if (control)
73 SetKeycodeAndSendThenMask(&xevent, XK_Control_L, ControlMask); 73 SetKeycodeAndSendThenMask(&xevent, XK_Control_L, ControlMask);
74 if (shift) 74 if (shift)
75 SetKeycodeAndSendThenMask(&xevent, XK_Shift_L, ShiftMask); 75 SetKeycodeAndSendThenMask(&xevent, XK_Shift_L, ShiftMask);
76 if (alt) 76 if (alt)
77 SetKeycodeAndSendThenMask(&xevent, XK_Alt_L, Mod1Mask); 77 SetKeycodeAndSendThenMask(&xevent, XK_Alt_L, Mod1Mask);
78 if (command) 78 if (command)
79 SetKeycodeAndSendThenMask(&xevent, XK_Meta_L, Mod4Mask); 79 SetKeycodeAndSendThenMask(&xevent, XK_Meta_L, Mod4Mask);
(...skipping 11 matching lines...) Expand all
91 UnmaskAndSetKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L); 91 UnmaskAndSetKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L);
92 if (control) 92 if (control)
93 UnmaskAndSetKeycodeThenSend(&xevent, ControlMask, XK_Control_L); 93 UnmaskAndSetKeycodeThenSend(&xevent, ControlMask, XK_Control_L);
94 if (command) 94 if (command)
95 UnmaskAndSetKeycodeThenSend(&xevent, Mod4Mask, XK_Meta_L); 95 UnmaskAndSetKeycodeThenSend(&xevent, Mod4Mask, XK_Meta_L);
96 DCHECK(!xevent.xkey.state); 96 DCHECK(!xevent.xkey.state);
97 RunClosureAfterAllPendingUIEvents(closure); 97 RunClosureAfterAllPendingUIEvents(closure);
98 return true; 98 return true;
99 } 99 }
100 100
101 virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE { 101 virtual bool SendMouseMove(long screen_x, long screen_y) override {
102 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); 102 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure());
103 } 103 }
104 virtual bool SendMouseMoveNotifyWhenDone( 104 virtual bool SendMouseMoveNotifyWhenDone(
105 long screen_x, 105 long screen_x,
106 long screen_y, 106 long screen_y,
107 const base::Closure& closure) OVERRIDE { 107 const base::Closure& closure) override {
108 gfx::Point root_location(screen_x, screen_y); 108 gfx::Point root_location(screen_x, screen_y);
109 aura::client::ScreenPositionClient* screen_position_client = 109 aura::client::ScreenPositionClient* screen_position_client =
110 aura::client::GetScreenPositionClient(host_->window()); 110 aura::client::GetScreenPositionClient(host_->window());
111 if (screen_position_client) { 111 if (screen_position_client) {
112 screen_position_client->ConvertPointFromScreen(host_->window(), 112 screen_position_client->ConvertPointFromScreen(host_->window(),
113 &root_location); 113 &root_location);
114 } 114 }
115 gfx::Point root_current_location = 115 gfx::Point root_current_location =
116 QueryLatestMousePositionRequestInHost(host_); 116 QueryLatestMousePositionRequestInHost(host_);
117 host_->ConvertPointFromHost(&root_current_location); 117 host_->ConvertPointFromHost(&root_current_location);
118 118
119 if (root_location != root_current_location && button_down_mask == 0) { 119 if (root_location != root_current_location && button_down_mask == 0) {
120 // Move the cursor because EnterNotify/LeaveNotify are generated with the 120 // Move the cursor because EnterNotify/LeaveNotify are generated with the
121 // current mouse position as a result of XGrabPointer() 121 // current mouse position as a result of XGrabPointer()
122 host_->window()->MoveCursorTo(root_location); 122 host_->window()->MoveCursorTo(root_location);
123 } else { 123 } else {
124 XEvent xevent = {0}; 124 XEvent xevent = {0};
125 XMotionEvent* xmotion = &xevent.xmotion; 125 XMotionEvent* xmotion = &xevent.xmotion;
126 xmotion->type = MotionNotify; 126 xmotion->type = MotionNotify;
127 xmotion->x = root_location.x(); 127 xmotion->x = root_location.x();
128 xmotion->y = root_location.y(); 128 xmotion->y = root_location.y();
129 xmotion->state = button_down_mask; 129 xmotion->state = button_down_mask;
130 xmotion->same_screen = True; 130 xmotion->same_screen = True;
131 // WindowTreeHost will take care of other necessary fields. 131 // WindowTreeHost will take care of other necessary fields.
132 host_->PostNativeEvent(&xevent); 132 host_->PostNativeEvent(&xevent);
133 } 133 }
134 RunClosureAfterAllPendingUIEvents(closure); 134 RunClosureAfterAllPendingUIEvents(closure);
135 return true; 135 return true;
136 } 136 }
137 virtual bool SendMouseEvents(MouseButton type, int state) OVERRIDE { 137 virtual bool SendMouseEvents(MouseButton type, int state) override {
138 return SendMouseEventsNotifyWhenDone(type, state, base::Closure()); 138 return SendMouseEventsNotifyWhenDone(type, state, base::Closure());
139 } 139 }
140 virtual bool SendMouseEventsNotifyWhenDone( 140 virtual bool SendMouseEventsNotifyWhenDone(
141 MouseButton type, 141 MouseButton type,
142 int state, 142 int state,
143 const base::Closure& closure) OVERRIDE { 143 const base::Closure& closure) override {
144 XEvent xevent = {0}; 144 XEvent xevent = {0};
145 XButtonEvent* xbutton = &xevent.xbutton; 145 XButtonEvent* xbutton = &xevent.xbutton;
146 gfx::Point mouse_loc = aura::Env::GetInstance()->last_mouse_location(); 146 gfx::Point mouse_loc = aura::Env::GetInstance()->last_mouse_location();
147 aura::client::ScreenPositionClient* screen_position_client = 147 aura::client::ScreenPositionClient* screen_position_client =
148 aura::client::GetScreenPositionClient(host_->window()); 148 aura::client::GetScreenPositionClient(host_->window());
149 if (screen_position_client) { 149 if (screen_position_client) {
150 screen_position_client->ConvertPointFromScreen(host_->window(), 150 screen_position_client->ConvertPointFromScreen(host_->window(),
151 &mouse_loc); 151 &mouse_loc);
152 } 152 }
153 xbutton->x = mouse_loc.x(); 153 xbutton->x = mouse_loc.x();
(...skipping 20 matching lines...) Expand all
174 button_down_mask |= xbutton->state; 174 button_down_mask |= xbutton->state;
175 } 175 }
176 if (state & UP) { 176 if (state & UP) {
177 xevent.xbutton.type = ButtonRelease; 177 xevent.xbutton.type = ButtonRelease;
178 host_->PostNativeEvent(&xevent); 178 host_->PostNativeEvent(&xevent);
179 button_down_mask = (button_down_mask | xbutton->state) ^ xbutton->state; 179 button_down_mask = (button_down_mask | xbutton->state) ^ xbutton->state;
180 } 180 }
181 RunClosureAfterAllPendingUIEvents(closure); 181 RunClosureAfterAllPendingUIEvents(closure);
182 return true; 182 return true;
183 } 183 }
184 virtual bool SendMouseClick(MouseButton type) OVERRIDE { 184 virtual bool SendMouseClick(MouseButton type) override {
185 return SendMouseEvents(type, UP | DOWN); 185 return SendMouseEvents(type, UP | DOWN);
186 } 186 }
187 virtual void RunClosureAfterAllPendingUIEvents( 187 virtual void RunClosureAfterAllPendingUIEvents(
188 const base::Closure& closure) OVERRIDE { 188 const base::Closure& closure) override {
189 if (closure.is_null()) 189 if (closure.is_null())
190 return; 190 return;
191 static XEvent* marker_event = NULL; 191 static XEvent* marker_event = NULL;
192 if (!marker_event) { 192 if (!marker_event) {
193 marker_event = new XEvent(); 193 marker_event = new XEvent();
194 marker_event->xclient.type = ClientMessage; 194 marker_event->xclient.type = ClientMessage;
195 marker_event->xclient.display = NULL; 195 marker_event->xclient.display = NULL;
196 marker_event->xclient.window = None; 196 marker_event->xclient.window = None;
197 marker_event->xclient.format = 8; 197 marker_event->xclient.format = 8;
198 } 198 }
(...skipping 26 matching lines...) Expand all
225 }; 225 };
226 226
227 } // namespace 227 } // namespace
228 228
229 UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) { 229 UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) {
230 return new UIControlsX11(host); 230 return new UIControlsX11(host);
231 } 231 }
232 232
233 } // namespace test 233 } // namespace test
234 } // namespace aura 234 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/test_window_tree_client.h ('k') | ui/aura/test/ui_controls_factory_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698