diff options
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc index 2dd03d8..e7b5926 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc @@ -112,6 +112,23 @@ const char* kAtomsToCache[] = { NULL }; +class ScopedCapturer { + public: + explicit ScopedCapturer(DesktopRootWindowHostX11* host) + : host_(host) { + host_->SetCapture(); + } + + ~ScopedCapturer() { + host_->ReleaseCapture(); + } + + private: + aura::RootWindowHost* host_; + + DISALLOW_COPY_AND_ASSIGN(ScopedCapturer); +}; + } // namespace //////////////////////////////////////////////////////////////////////////////// @@ -550,7 +567,7 @@ Widget::MoveLoopResult DesktopRootWindowHostX11::RunMoveLoop( const gfx::Vector2d& drag_offset, Widget::MoveLoopSource source, Widget::MoveLoopEscapeBehavior escape_behavior) { - SetCapture(); + ScopedCapturer capturer(this); aura::client::WindowMoveSource window_move_source = source == Widget::MOVE_LOOP_SOURCE_MOUSE ? |