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

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

Issue 404423002: Listen for key events in SetupXI2ForXWindow() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restrict to ChromeOS (plus rebase) Created 6 years, 4 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
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/x/touch_factory_x11.h" 5 #include "ui/events/x/touch_factory_x11.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/cursorfont.h> 8 #include <X11/cursorfont.h>
9 #include <X11/extensions/XInput.h> 9 #include <X11/extensions/XInput.h>
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
11 #include <X11/extensions/XIproto.h> 11 #include <X11/extensions/XIproto.h>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/singleton.h" 17 #include "base/memory/singleton.h"
18 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/string_split.h" 20 #include "base/strings/string_split.h"
21 #include "base/sys_info.h"
21 #include "ui/events/event_switches.h" 22 #include "ui/events/event_switches.h"
22 #include "ui/events/x/device_data_manager_x11.h" 23 #include "ui/events/x/device_data_manager_x11.h"
23 #include "ui/events/x/device_list_cache_x.h" 24 #include "ui/events/x/device_list_cache_x.h"
24 #include "ui/gfx/x/x11_types.h" 25 #include "ui/gfx/x/x11_types.h"
25 26
26 namespace ui { 27 namespace ui {
27 28
28 TouchFactory::TouchFactory() 29 TouchFactory::TouchFactory()
29 : pointer_device_lookup_(), 30 : pointer_device_lookup_(),
30 touch_device_available_(false), 31 touch_device_available_(false),
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 memset(mask, 0, sizeof(mask)); 204 memset(mask, 0, sizeof(mask));
204 205
205 #if defined(USE_XI2_MT) 206 #if defined(USE_XI2_MT)
206 XISetMask(mask, XI_TouchBegin); 207 XISetMask(mask, XI_TouchBegin);
207 XISetMask(mask, XI_TouchUpdate); 208 XISetMask(mask, XI_TouchUpdate);
208 XISetMask(mask, XI_TouchEnd); 209 XISetMask(mask, XI_TouchEnd);
209 #endif 210 #endif
210 XISetMask(mask, XI_ButtonPress); 211 XISetMask(mask, XI_ButtonPress);
211 XISetMask(mask, XI_ButtonRelease); 212 XISetMask(mask, XI_ButtonRelease);
212 XISetMask(mask, XI_Motion); 213 XISetMask(mask, XI_Motion);
214 #if defined(OS_CHROMEOS)
215 if (base::SysInfo::IsRunningOnChromeOS()) {
216 XISetMask(mask, XI_KeyPress);
217 XISetMask(mask, XI_KeyRelease);
218 }
219 #endif
213 220
214 XIEventMask evmask; 221 XIEventMask evmask;
215 evmask.deviceid = XIAllDevices; 222 evmask.deviceid = XIAllDevices;
216 evmask.mask_len = sizeof(mask); 223 evmask.mask_len = sizeof(mask);
217 evmask.mask = mask; 224 evmask.mask = mask;
218 XISelectEvents(display, window, &evmask, 1); 225 XISelectEvents(display, window, &evmask, 1);
219 XFlush(display); 226 XFlush(display);
220 } 227 }
221 228
222 void TouchFactory::SetTouchDeviceList( 229 void TouchFactory::SetTouchDeviceList(
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 if (ptr[0] || ptr[1]) 347 if (ptr[0] || ptr[1])
341 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1])); 348 touchscreen_ids_.insert(std::make_pair(ptr[0], ptr[1]));
342 } 349 }
343 XFree(prop_return); 350 XFree(prop_return);
344 } 351 }
345 352
346 XCloseDevice(display, device); 353 XCloseDevice(display, device);
347 } 354 }
348 355
349 } // namespace ui 356 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698