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

Side by Side Diff: content/browser/renderer_host/web_input_event_aurax11.cc

Issue 8793002: aura-x11: Add support for xmodmap'ed pointer buttons. (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
« no previous file with comments | « no previous file | ui/aura/root_window_host_linux.cc » ('j') | ui/base/x/x11_util.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Portions based heavily on: 5 // Portions based heavily on:
6 // third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.cpp 6 // third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.cpp
7 // 7 //
8 /* 8 /*
9 * Copyright (C) 2006-2011 Google Inc. All rights reserved. 9 * Copyright (C) 2006-2011 Google Inc. All rights reserved.
10 * 10 *
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 case ui::VKEY_RETURN: 144 case ui::VKEY_RETURN:
145 return 0x0A; 145 return 0x0A;
146 // Returns 0 for all other keys to avoid inputting unexpected chars. 146 // Returns 0 for all other keys to avoid inputting unexpected chars.
147 default: 147 default:
148 break; 148 break;
149 } 149 }
150 } 150 }
151 return 0; 151 return 0;
152 } 152 }
153 153
154 WebKit::WebMouseEvent::Button ButtonFromXButton(int button) {
155 switch (button) {
156 case 1:
157 return WebKit::WebMouseEvent::ButtonLeft;
158 case 2:
159 return WebKit::WebMouseEvent::ButtonMiddle;
160 case 3:
161 return WebKit::WebMouseEvent::ButtonRight;
162 default:
163 break;
164 }
165 return WebKit::WebMouseEvent::ButtonNone;
166 }
167
168 WebKit::WebMouseEvent::Button ButtonFromXState(int state) {
169 if (state & Button1MotionMask)
170 return WebKit::WebMouseEvent::ButtonLeft;
171 if (state & Button2MotionMask)
172 return WebKit::WebMouseEvent::ButtonMiddle;
173 if (state & Button3MotionMask)
174 return WebKit::WebMouseEvent::ButtonRight;
175 return WebKit::WebMouseEvent::ButtonNone;
176 }
177
178 // We have to count clicks (for double-clicks) manually. 154 // We have to count clicks (for double-clicks) manually.
179 unsigned int g_num_clicks = 0; 155 unsigned int g_num_clicks = 0;
180 double g_last_click_time = 0.0; 156 double g_last_click_time = 0.0;
181 int g_last_click_x = 0; 157 int g_last_click_x = 0;
182 int g_last_click_y = 0; 158 int g_last_click_y = 0;
183 WebKit::WebMouseEvent::Button g_last_click_button = 159 WebKit::WebMouseEvent::Button g_last_click_button =
184 WebKit::WebMouseEvent::ButtonNone; 160 WebKit::WebMouseEvent::ButtonNone;
185 161
186 bool ShouldForgetPreviousClick(double time, int x, int y) { 162 bool ShouldForgetPreviousClick(double time, int x, int y) {
187 const double double_click_time = 0.250; // in seconds 163 const double double_click_time = 0.250; // in seconds
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 385 }
410 386
411 // Update the type of the touch event. 387 // Update the type of the touch event.
412 web_event->type = TouchEventTypeFromEvent(event); 388 web_event->type = TouchEventTypeFromEvent(event);
413 web_event->timeStampSeconds = event->time_stamp().ToDoubleT(); 389 web_event->timeStampSeconds = event->time_stamp().ToDoubleT();
414 390
415 return point; 391 return point;
416 } 392 }
417 393
418 } // namespace content 394 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/aura/root_window_host_linux.cc » ('j') | ui/base/x/x11_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698