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

Unified Diff: ui/views/widget/desktop_aura/x11_scoped_capture.cc

Issue 110223004: linux-aura: Fix some dragging behaviour. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years 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
Index: ui/views/widget/desktop_aura/x11_scoped_capture.cc
diff --git a/ui/views/widget/desktop_aura/x11_scoped_capture.cc b/ui/views/widget/desktop_aura/x11_scoped_capture.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b48bb5005ba2dbcc03b37047016ffe5c60252fd4
--- /dev/null
+++ b/ui/views/widget/desktop_aura/x11_scoped_capture.cc
@@ -0,0 +1,31 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/views/widget/desktop_aura/x11_scoped_capture.h"
+
+#include <X11/X.h>
+#include <X11/Xlib.h>
+
+#include "ui/gfx/x/x11_types.h"
+
+namespace views {
+
+X11ScopedCapture::X11ScopedCapture(XID window)
+ : captured_(false) {
+ // TODO(sad): Use XI2 API instead.
+ unsigned int event_mask = PointerMotionMask | ButtonReleaseMask |
+ ButtonPressMask;
+ int status = XGrabPointer(gfx::GetXDisplay(), window, True, event_mask,
+ GrabModeAsync, GrabModeAsync, None, None,
+ CurrentTime);
+ captured_ = status == GrabSuccess;
+}
+
+X11ScopedCapture::~X11ScopedCapture() {
+ if (captured_) {
+ XUngrabPointer(gfx::GetXDisplay(), CurrentTime);
+ }
+}
+
+} // namespace views
« no previous file with comments | « ui/views/widget/desktop_aura/x11_scoped_capture.h ('k') | ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698