diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-05 03:24:02 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-05 03:24:02 +0000 |
commit | efb66c9d45ab1831eb66d377661ee85892a74126 (patch) | |
tree | 7398fac8e06d0aa7851b6c862268567d88882d81 | |
parent | 6e850920ee154c82047f1c0ac21e78433c8e3017 (diff) | |
download | chromium_src-efb66c9d45ab1831eb66d377661ee85892a74126.zip chromium_src-efb66c9d45ab1831eb66d377661ee85892a74126.tar.gz chromium_src-efb66c9d45ab1831eb66d377661ee85892a74126.tar.bz2 |
aura-x11: Select for non-touch events before selecting for touch events.
Selecting for touch-events seem to fail when loggin in incognito.
This causes all XI2 events to fail. To avoid this, select for non-touch
XI2 events first, and then select for touch events. So even if the
latter select fails, the rest of the XI2 events will be received
correctly. This fixes some key events in incognito (e.g. top-row keys
etc.).
BUG=163988
Review URL: https://codereview.chromium.org/11437005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171142 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/aura/root_window_host_linux.cc | 22 | ||||
-rw-r--r-- | ui/base/touch/touch_factory.cc | 13 |
2 files changed, 15 insertions, 20 deletions
diff --git a/ui/aura/root_window_host_linux.cc b/ui/aura/root_window_host_linux.cc index f2d0032..ce51c6d 100644 --- a/ui/aura/root_window_host_linux.cc +++ b/ui/aura/root_window_host_linux.cc @@ -93,25 +93,33 @@ void SelectEventsForRootWindow() { StructureNotifyMask | attr.your_event_mask); } - XIEventMask evmask; + if (!base::MessagePumpForUI::HasXInput2()) + return; + unsigned char mask[XIMaskLen(XI_LASTEVENT)] = {}; memset(mask, 0, sizeof(mask)); XISetMask(mask, XI_HierarchyChanged); - XISetMask(mask, XI_KeyPress); XISetMask(mask, XI_KeyRelease); -#if defined(USE_XI2_MT) - XISetMask(mask, XI_TouchBegin); - XISetMask(mask, XI_TouchUpdate); - XISetMask(mask, XI_TouchEnd); -#endif + XIEventMask evmask; evmask.deviceid = XIAllDevices; evmask.mask_len = sizeof(mask); evmask.mask = mask; + XISelectEvents(display, root_window, &evmask, 1); + // Selecting for touch events seems to fail on some cases (e.g. when logging + // in incognito). So select for non-touch events first, and then select for + // touch-events (but keep the other events in the mask, i.e. do not memset + // |mask| back to 0). + // TODO(sad): Figure out why this happens. http://crbug.com/153976 +#if defined(USE_XI2_MT) + XISetMask(mask, XI_TouchBegin); + XISetMask(mask, XI_TouchUpdate); + XISetMask(mask, XI_TouchEnd); XISelectEvents(display, root_window, &evmask, 1); +#endif } // We emulate Windows' WM_KEYDOWN and WM_CHAR messages. WM_CHAR events are only diff --git a/ui/base/touch/touch_factory.cc b/ui/base/touch/touch_factory.cc index 0f1c661..14c5b96 100644 --- a/ui/base/touch/touch_factory.cc +++ b/ui/base/touch/touch_factory.cc @@ -53,19 +53,6 @@ TouchFactory::TouchFactory() SetCursorVisible(false, false); UpdateDeviceList(display); - // Make sure the list of devices is kept up-to-date by listening for - // XI_HierarchyChanged event on the root window. - unsigned char mask[XIMaskLen(XI_LASTEVENT)]; - memset(mask, 0, sizeof(mask)); - - XISetMask(mask, XI_HierarchyChanged); - - XIEventMask evmask; - evmask.deviceid = XIAllDevices; - evmask.mask_len = sizeof(mask); - evmask.mask = mask; - XISelectEvents(display, ui::GetX11RootWindow(), &evmask, 1); - CommandLine* cmdline = CommandLine::ForCurrentProcess(); touch_events_disabled_ = cmdline->HasSwitch(switches::kTouchEvents) && cmdline->GetSwitchValueASCII(switches::kTouchEvents) == |