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

Unified Diff: ui/aura/window_tree_host_x11.cc

Issue 2319933002: X11: Remove calls to XSelectInput (Closed)
Patch Set: Comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/window_tree_host_x11.h ('k') | ui/base/clipboard/clipboard_aurax11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_tree_host_x11.cc
diff --git a/ui/aura/window_tree_host_x11.cc b/ui/aura/window_tree_host_x11.cc
index 0bbd0a0ce0e799f47c777b9438f6d89e5cb8fea0..37efdf4b65b98773ed5e6c2d276d375c6a7f76bc 100644
--- a/ui/aura/window_tree_host_x11.cc
+++ b/ui/aura/window_tree_host_x11.cc
@@ -34,6 +34,7 @@
#include "ui/base/ui_base_switches.h"
#include "ui/base/view_prop.h"
#include "ui/base/x/x11_util.h"
+#include "ui/base/x/x11_window_event_manager.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/dip_util.h"
#include "ui/compositor/layer.h"
@@ -63,6 +64,14 @@ const char* kAtomsToCache[] = {
NULL
};
+constexpr uint32_t kInputEventMask =
+ ButtonPressMask | ButtonReleaseMask | FocusChangeMask | KeyPressMask |
+ KeyReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask;
+
+constexpr uint32_t kEventMask = kInputEventMask | ExposureMask |
+ VisibilityChangeMask | StructureNotifyMask |
+ PropertyChangeMask;
+
::Window FindEventTarget(const base::NativeEvent& xev) {
::Window target = xev->xany.window;
if (xev->type == GenericEvent)
@@ -132,13 +141,7 @@ WindowTreeHostX11::WindowTreeHostX11(const gfx::Rect& bounds)
if (ui::PlatformEventSource::GetInstance())
ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
- long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask |
- KeyPressMask | KeyReleaseMask |
- EnterWindowMask | LeaveWindowMask |
- ExposureMask | VisibilityChangeMask |
- StructureNotifyMask | PropertyChangeMask |
- PointerMotionMask;
- XSelectInput(xdisplay_, xwindow_, event_mask);
+ xwindow_events_.reset(new ui::XScopedEventSelector(xwindow_, kEventMask));
XFlush(xdisplay_);
if (ui::IsXInput2Available()) {
@@ -470,6 +473,17 @@ void WindowTreeHostX11::MoveCursorToNative(const gfx::Point& location) {
void WindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) {
}
+void WindowTreeHostX11::DisableInput() {
+ xwindow_events_.reset(
+ new ui::XScopedEventSelector(xwindow_, kEventMask & ~kInputEventMask));
+ unsigned char mask[XIMaskLen(XI_LASTEVENT)] = {0};
+ XIEventMask evmask;
+ evmask.deviceid = XIAllDevices;
+ evmask.mask_len = sizeof(mask);
+ evmask.mask = mask;
+ XISelectEvents(gfx::GetXDisplay(), xwindow_, &evmask, 1);
+}
+
void WindowTreeHostX11::DispatchXI2Event(const base::NativeEvent& event) {
ui::TouchFactory* factory = ui::TouchFactory::GetInstance();
XEvent* xev = event;
« no previous file with comments | « ui/aura/window_tree_host_x11.h ('k') | ui/base/clipboard/clipboard_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698