Index: ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc |
diff --git a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc |
index d8c1575e04df7667dd4e52773be993793eb9f3e1..eea5bcb706df72f302aba9bf1d5220b5556dd8eb 100644 |
--- a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc |
+++ b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc |
@@ -20,6 +20,7 @@ |
#include "ui/aura/window_event_dispatcher.h" |
#include "ui/aura/window_tree_host.h" |
#include "ui/base/x/x11_util.h" |
+#include "ui/base/x/x11_window_event_manager.h" |
#include "ui/events/event.h" |
#include "ui/events/event_utils.h" |
#include "ui/events/keycodes/keyboard_code_conversion_x.h" |
@@ -137,7 +138,7 @@ bool X11WholeScreenMoveLoop::RunMoveLoop(aura::Window* source, |
// restored when the move loop finishes. |
initial_cursor_ = source->GetHost()->last_cursor(); |
- grab_input_window_ = CreateDragInputWindow(gfx::GetXDisplay()); |
+ CreateDragInputWindow(gfx::GetXDisplay()); |
// Only grab mouse capture of |grab_input_window_| if |source| does not have |
// capture. |
@@ -228,6 +229,7 @@ void X11WholeScreenMoveLoop::EndMoveLoop() { |
// Restore the previous dispatcher. |
nested_dispatcher_.reset(); |
delegate_->OnMoveLoopEnded(); |
+ grab_input_window_events_.reset(); |
XDestroyWindow(display, grab_input_window_); |
grab_input_window_ = None; |
@@ -260,21 +262,22 @@ void X11WholeScreenMoveLoop::GrabEscKey() { |
} |
} |
-Window X11WholeScreenMoveLoop::CreateDragInputWindow(XDisplay* display) { |
+void X11WholeScreenMoveLoop::CreateDragInputWindow(XDisplay* display) { |
unsigned long attribute_mask = CWEventMask | CWOverrideRedirect; |
XSetWindowAttributes swa; |
memset(&swa, 0, sizeof(swa)); |
- swa.event_mask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask | |
- KeyPressMask | KeyReleaseMask | StructureNotifyMask; |
swa.override_redirect = True; |
- Window window = XCreateWindow(display, |
- DefaultRootWindow(display), |
- -100, -100, 10, 10, |
- 0, CopyFromParent, InputOnly, CopyFromParent, |
- attribute_mask, &swa); |
- XMapRaised(display, window); |
- ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(window); |
- return window; |
+ grab_input_window_ = XCreateWindow(display, DefaultRootWindow(display), -100, |
+ -100, 10, 10, 0, CopyFromParent, InputOnly, |
+ CopyFromParent, attribute_mask, &swa); |
+ uint32_t event_mask = ButtonPressMask | ButtonReleaseMask | |
+ PointerMotionMask | KeyPressMask | KeyReleaseMask | |
+ StructureNotifyMask; |
+ grab_input_window_events_.reset( |
+ new ui::XScopedEventSelector(grab_input_window_, event_mask)); |
+ |
+ XMapRaised(display, grab_input_window_); |
+ ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(grab_input_window_); |
} |
} // namespace views |