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

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

Issue 1017473002: [Merge] Make mouse buttons 8 - 11 navigate forward and back in history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2311
Patch Set: Created 5 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
« no previous file with comments | « ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.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) 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/events/event_constants.h" 5 #include "ui/events/event_constants.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <X11/extensions/XInput.h> 8 #include <X11/extensions/XInput.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 #include <X11/XKBlib.h> 10 #include <X11/XKBlib.h>
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 if (state & Mod4Mask) 154 if (state & Mod4Mask)
155 flags |= ui::EF_COMMAND_DOWN; 155 flags |= ui::EF_COMMAND_DOWN;
156 if (state & Mod5Mask) 156 if (state & Mod5Mask)
157 flags |= ui::EF_ALTGR_DOWN; 157 flags |= ui::EF_ALTGR_DOWN;
158 if (state & Button1Mask) 158 if (state & Button1Mask)
159 flags |= ui::EF_LEFT_MOUSE_BUTTON; 159 flags |= ui::EF_LEFT_MOUSE_BUTTON;
160 if (state & Button2Mask) 160 if (state & Button2Mask)
161 flags |= ui::EF_MIDDLE_MOUSE_BUTTON; 161 flags |= ui::EF_MIDDLE_MOUSE_BUTTON;
162 if (state & Button3Mask) 162 if (state & Button3Mask)
163 flags |= ui::EF_RIGHT_MOUSE_BUTTON; 163 flags |= ui::EF_RIGHT_MOUSE_BUTTON;
164 // There are no masks for EF_BACK_MOUSE_BUTTON and
165 // EF_FORWARD_MOUSE_BUTTON.
164 return flags; 166 return flags;
165 } 167 }
166 168
167 int GetEventFlagsFromXKeyEvent(XEvent* xevent) { 169 int GetEventFlagsFromXKeyEvent(XEvent* xevent) {
168 DCHECK(xevent->type == KeyPress || xevent->type == KeyRelease); 170 DCHECK(xevent->type == KeyPress || xevent->type == KeyRelease);
169 171
170 #if defined(OS_CHROMEOS) 172 #if defined(OS_CHROMEOS)
171 const int ime_fabricated_flag = 0; 173 const int ime_fabricated_flag = 0;
172 #else 174 #else
173 // XIM fabricates key events for the character compositions by XK_Multi_key. 175 // XIM fabricates key events for the character compositions by XK_Multi_key.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // event, |state| would have Button1Mask set but not Button3Mask, and |button| 219 // event, |state| would have Button1Mask set but not Button3Mask, and |button|
218 // would be 3. 220 // would be 3.
219 int GetEventFlagsForButton(int button) { 221 int GetEventFlagsForButton(int button) {
220 switch (button) { 222 switch (button) {
221 case 1: 223 case 1:
222 return ui::EF_LEFT_MOUSE_BUTTON; 224 return ui::EF_LEFT_MOUSE_BUTTON;
223 case 2: 225 case 2:
224 return ui::EF_MIDDLE_MOUSE_BUTTON; 226 return ui::EF_MIDDLE_MOUSE_BUTTON;
225 case 3: 227 case 3:
226 return ui::EF_RIGHT_MOUSE_BUTTON; 228 return ui::EF_RIGHT_MOUSE_BUTTON;
229 case 8:
230 return ui::EF_BACK_MOUSE_BUTTON;
231 case 9:
232 return ui::EF_FORWARD_MOUSE_BUTTON;
227 default: 233 default:
228 return 0; 234 return 0;
229 } 235 }
230 } 236 }
231 237
232 int GetButtonMaskForX2Event(XIDeviceEvent* xievent) { 238 int GetButtonMaskForX2Event(XIDeviceEvent* xievent) {
233 int buttonflags = 0; 239 int buttonflags = 0;
234 for (int i = 0; i < 8 * xievent->buttons.mask_len; i++) { 240 for (int i = 0; i < 8 * xievent->buttons.mask_len; i++) {
235 if (XIMaskIsSet(xievent->buttons.mask, i)) { 241 if (XIMaskIsSet(xievent->buttons.mask, i)) {
236 int button = (xievent->sourceid == xievent->deviceid) ? 242 int button = (xievent->sourceid == xievent->deviceid) ?
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 xievent->detail = 908 xievent->detail =
903 UpdateX11EventButton(event->changed_button_flags(), xievent->detail); 909 UpdateX11EventButton(event->changed_button_flags(), xievent->detail);
904 break; 910 break;
905 } 911 }
906 default: 912 default:
907 break; 913 break;
908 } 914 }
909 } 915 }
910 916
911 } // namespace ui 917 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698