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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 749063003: Fix grabbing capture when the mouse is pressed on Desktop Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 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/views/widget/desktop_aura/desktop_window_tree_host_x11.h" 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
6 6
7 #include <X11/extensions/shape.h> 7 #include <X11/extensions/shape.h>
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <X11/Xregion.h> 10 #include <X11/Xregion.h>
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 // aura::WindowEventDispatcher which has capture. This makes capture 949 // aura::WindowEventDispatcher which has capture. This makes capture
950 // synchronous for all intents and purposes if either: 950 // synchronous for all intents and purposes if either:
951 // - |g_current_capture|'s X window has capture. 951 // - |g_current_capture|'s X window has capture.
952 // OR 952 // OR
953 // - The topmost window underneath the mouse is managed by Chrome. 953 // - The topmost window underneath the mouse is managed by Chrome.
954 DesktopWindowTreeHostX11* old_capturer = g_current_capture; 954 DesktopWindowTreeHostX11* old_capturer = g_current_capture;
955 g_current_capture = this; 955 g_current_capture = this;
956 if (old_capturer) 956 if (old_capturer)
957 old_capturer->OnHostLostWindowCapture(); 957 old_capturer->OnHostLostWindowCapture();
958 958
959 unsigned int event_mask = PointerMotionMask | ButtonReleaseMask | 959 ui::GrabPointer(xwindow_, true, None);
960 ButtonPressMask;
961 XGrabPointer(xdisplay_, xwindow_, True, event_mask, GrabModeAsync,
962 GrabModeAsync, None, None, CurrentTime);
963 } 960 }
964 961
965 void DesktopWindowTreeHostX11::ReleaseCapture() { 962 void DesktopWindowTreeHostX11::ReleaseCapture() {
966 if (g_current_capture == this) { 963 if (g_current_capture == this) {
967 // Release mouse grab asynchronously. A window managed by Chrome is likely 964 // Release mouse grab asynchronously. A window managed by Chrome is likely
968 // the topmost window underneath the mouse so the capture release being 965 // the topmost window underneath the mouse so the capture release being
969 // asynchronous is likely inconsequential. 966 // asynchronous is likely inconsequential.
970 g_current_capture = NULL; 967 g_current_capture = NULL;
971 XUngrabPointer(xdisplay_, CurrentTime); 968 ui::UngrabPointer();
972 969
973 OnHostLostWindowCapture(); 970 OnHostLostWindowCapture();
974 } 971 }
975 } 972 }
976 973
977 void DesktopWindowTreeHostX11::SetCursorNative(gfx::NativeCursor cursor) { 974 void DesktopWindowTreeHostX11::SetCursorNative(gfx::NativeCursor cursor) {
978 XDefineCursor(xdisplay_, xwindow_, cursor.platform()); 975 XDefineCursor(xdisplay_, xwindow_, cursor.platform());
979 } 976 }
980 977
981 void DesktopWindowTreeHostX11::MoveCursorToNative(const gfx::Point& location) { 978 void DesktopWindowTreeHostX11::MoveCursorToNative(const gfx::Point& location) {
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 if (linux_ui) { 1924 if (linux_ui) {
1928 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); 1925 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window);
1929 if (native_theme) 1926 if (native_theme)
1930 return native_theme; 1927 return native_theme;
1931 } 1928 }
1932 1929
1933 return ui::NativeTheme::instance(); 1930 return ui::NativeTheme::instance();
1934 } 1931 }
1935 1932
1936 } // namespace views 1933 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698