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

Side by Side Diff: ui/aura/window_tree_host_x11.cc

Issue 2319933002: X11: Remove calls to XSelectInput (Closed)
Patch Set: Created 4 years, 3 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/aura/window_tree_host_x11.h" 5 #include "ui/aura/window_tree_host_x11.h"
6 6
7 #include <strings.h> 7 #include <strings.h>
8 #include <X11/cursorfont.h> 8 #include <X11/cursorfont.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 #include <X11/extensions/Xrandr.h> 10 #include <X11/extensions/Xrandr.h>
(...skipping 16 matching lines...) Expand all
27 #include "base/trace_event/trace_event.h" 27 #include "base/trace_event/trace_event.h"
28 #include "build/build_config.h" 28 #include "build/build_config.h"
29 #include "ui/aura/client/cursor_client.h" 29 #include "ui/aura/client/cursor_client.h"
30 #include "ui/aura/env.h" 30 #include "ui/aura/env.h"
31 #include "ui/aura/window.h" 31 #include "ui/aura/window.h"
32 #include "ui/aura/window_event_dispatcher.h" 32 #include "ui/aura/window_event_dispatcher.h"
33 #include "ui/base/cursor/cursor.h" 33 #include "ui/base/cursor/cursor.h"
34 #include "ui/base/ui_base_switches.h" 34 #include "ui/base/ui_base_switches.h"
35 #include "ui/base/view_prop.h" 35 #include "ui/base/view_prop.h"
36 #include "ui/base/x/x11_util.h" 36 #include "ui/base/x/x11_util.h"
37 #include "ui/base/x/x11_window_event_manager.h"
37 #include "ui/compositor/compositor.h" 38 #include "ui/compositor/compositor.h"
38 #include "ui/compositor/dip_util.h" 39 #include "ui/compositor/dip_util.h"
39 #include "ui/compositor/layer.h" 40 #include "ui/compositor/layer.h"
40 #include "ui/display/screen.h" 41 #include "ui/display/screen.h"
41 #include "ui/events/devices/x11/device_data_manager_x11.h" 42 #include "ui/events/devices/x11/device_data_manager_x11.h"
42 #include "ui/events/devices/x11/device_list_cache_x11.h" 43 #include "ui/events/devices/x11/device_list_cache_x11.h"
43 #include "ui/events/devices/x11/touch_factory_x11.h" 44 #include "ui/events/devices/x11/touch_factory_x11.h"
44 #include "ui/events/event.h" 45 #include "ui/events/event.h"
45 #include "ui/events/event_switches.h" 46 #include "ui/events/event_switches.h"
46 #include "ui/events/event_utils.h" 47 #include "ui/events/event_utils.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 bounds.x(), bounds.y(), bounds.width(), bounds.height(), 126 bounds.x(), bounds.y(), bounds.width(), bounds.height(),
126 0, // border width 127 0, // border width
127 CopyFromParent, // depth 128 CopyFromParent, // depth
128 InputOutput, 129 InputOutput,
129 CopyFromParent, // visual 130 CopyFromParent, // visual
130 CWBackPixmap | CWBitGravity | CWOverrideRedirect, 131 CWBackPixmap | CWBitGravity | CWOverrideRedirect,
131 &swa); 132 &swa);
132 if (ui::PlatformEventSource::GetInstance()) 133 if (ui::PlatformEventSource::GetInstance())
133 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); 134 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
134 135
135 long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask | 136 long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask |
Daniel Erat 2016/09/07 22:58:36 mind moving this mask into a kEventMask constant i
136 KeyPressMask | KeyReleaseMask | 137 KeyPressMask | KeyReleaseMask | EnterWindowMask |
137 EnterWindowMask | LeaveWindowMask | 138 LeaveWindowMask | ExposureMask | VisibilityChangeMask |
138 ExposureMask | VisibilityChangeMask |
139 StructureNotifyMask | PropertyChangeMask | 139 StructureNotifyMask | PropertyChangeMask |
140 PointerMotionMask; 140 PointerMotionMask;
141 XSelectInput(xdisplay_, xwindow_, event_mask); 141 xwindow_events_.reset(new ui::XScopedEventSelector(xwindow_, event_mask));
142 XFlush(xdisplay_); 142 XFlush(xdisplay_);
143 143
144 if (ui::IsXInput2Available()) { 144 if (ui::IsXInput2Available()) {
145 ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_); 145 ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_);
146 SelectXInput2EventsForRootWindow(xdisplay_, x_root_window_); 146 SelectXInput2EventsForRootWindow(xdisplay_, x_root_window_);
147 } 147 }
148 148
149 // TODO(erg): We currently only request window deletion events. We also 149 // TODO(erg): We currently only request window deletion events. We also
150 // should listen for activation events and anything else that GTK+ listens 150 // should listen for activation events and anything else that GTK+ listens
151 // for, and do something useful. 151 // for, and do something useful.
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 463
464 void WindowTreeHostX11::MoveCursorToNative(const gfx::Point& location) { 464 void WindowTreeHostX11::MoveCursorToNative(const gfx::Point& location) {
465 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0, 465 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0,
466 bounds_.x() + location.x(), 466 bounds_.x() + location.x(),
467 bounds_.y() + location.y()); 467 bounds_.y() + location.y());
468 } 468 }
469 469
470 void WindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) { 470 void WindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) {
471 } 471 }
472 472
473 void WindowTreeHostX11::DisableInput() {
474 long event_mask = ExposureMask | VisibilityChangeMask | StructureNotifyMask |
475 PropertyChangeMask;
476 auto event_selector = new ui::XScopedEventSelector(xwindow_, event_mask);
477 xwindow_events_.reset(event_selector);
Daniel Erat 2016/09/07 22:58:36 xwindow_events_.reset(new ui::XScopedEventSelector
Tom (Use chromium acct) 2016/09/07 23:31:16 Done.
478 unsigned char mask[XIMaskLen(XI_LASTEVENT)] = {0};
479 XIEventMask evmask;
480 evmask.deviceid = XIAllDevices;
481 evmask.mask_len = sizeof(mask);
482 evmask.mask = mask;
483 XISelectEvents(gfx::GetXDisplay(), xwindow_, &evmask, 1);
484 }
485
473 void WindowTreeHostX11::DispatchXI2Event(const base::NativeEvent& event) { 486 void WindowTreeHostX11::DispatchXI2Event(const base::NativeEvent& event) {
474 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); 487 ui::TouchFactory* factory = ui::TouchFactory::GetInstance();
475 XEvent* xev = event; 488 XEvent* xev = event;
476 if (!factory->ShouldProcessXI2Event(xev)) 489 if (!factory->ShouldProcessXI2Event(xev))
477 return; 490 return;
478 491
479 TRACE_EVENT1("input", "WindowTreeHostX11::DispatchXI2Event", 492 TRACE_EVENT1("input", "WindowTreeHostX11::DispatchXI2Event",
480 "event_latency_us", 493 "event_latency_us",
481 (ui::EventTimeForNow() - ui::EventTimeFromNative(event)). 494 (ui::EventTimeForNow() - ui::EventTimeFromNative(event)).
482 InMicroseconds()); 495 InMicroseconds());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 } 573 }
561 574
562 namespace test { 575 namespace test {
563 576
564 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { 577 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) {
565 default_override_redirect = override_redirect; 578 default_override_redirect = override_redirect;
566 } 579 }
567 580
568 } // namespace test 581 } // namespace test
569 } // namespace aura 582 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698