OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/menu/menu_host_gtk.h" | 5 #include "views/controls/menu/menu_host_gtk.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 | 8 |
9 #if defined(HAVE_XINPUT2) && defined(TOUCH_UI) | 9 #if defined(HAVE_XINPUT2) && defined(TOUCH_UI) |
10 #include <gdk/gdkx.h> | 10 #include <gdk/gdkx.h> |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 // events from other apps. | 155 // events from other apps. |
156 GdkGrabStatus pointer_grab_status = | 156 GdkGrabStatus pointer_grab_status = |
157 gdk_pointer_grab(window_contents()->window, FALSE, | 157 gdk_pointer_grab(window_contents()->window, FALSE, |
158 static_cast<GdkEventMask>( | 158 static_cast<GdkEventMask>( |
159 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | | 159 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | |
160 GDK_POINTER_MOTION_MASK), | 160 GDK_POINTER_MOTION_MASK), |
161 NULL, NULL, GDK_CURRENT_TIME); | 161 NULL, NULL, GDK_CURRENT_TIME); |
162 GdkGrabStatus keyboard_grab_status = | 162 GdkGrabStatus keyboard_grab_status = |
163 gdk_keyboard_grab(window_contents()->window, FALSE, | 163 gdk_keyboard_grab(window_contents()->window, FALSE, |
164 GDK_CURRENT_TIME); | 164 GDK_CURRENT_TIME); |
165 if (pointer_grab_status == GDK_GRAB_NOT_VIEWABLE) { | |
zel
2011/03/15 18:39:45
does this file belong in this CL? does not seem re
| |
166 DCHECK_EQ(GDK_GRAB_NOT_VIEWABLE, keyboard_grab_status); | |
167 GtkWidget* current_grab_window = gtk_grab_get_current(); | |
168 if (current_grab_window) | |
169 gtk_grab_remove(current_grab_window); | |
170 return; | |
171 } | |
165 | 172 |
166 did_input_grab_ = pointer_grab_status == GDK_GRAB_SUCCESS && | 173 did_input_grab_ = pointer_grab_status == GDK_GRAB_SUCCESS && |
167 keyboard_grab_status == GDK_GRAB_SUCCESS; | 174 keyboard_grab_status == GDK_GRAB_SUCCESS; |
168 | 175 |
169 #if defined(HAVE_XINPUT2) && defined(TOUCH_UI) | 176 #if defined(HAVE_XINPUT2) && defined(TOUCH_UI) |
170 ::Window window = GDK_WINDOW_XID(window_contents()->window); | 177 ::Window window = GDK_WINDOW_XID(window_contents()->window); |
171 Display* display = GDK_WINDOW_XDISPLAY(window_contents()->window); | 178 Display* display = GDK_WINDOW_XDISPLAY(window_contents()->window); |
172 bool xi2grab = TouchFactory::GetInstance()->GrabTouchDevices(display, window); | 179 bool xi2grab = TouchFactory::GetInstance()->GrabTouchDevices(display, window); |
173 did_input_grab_ = did_input_grab_ && xi2grab; | 180 did_input_grab_ = did_input_grab_ && xi2grab; |
174 #endif | 181 #endif |
175 | 182 |
176 DCHECK(did_input_grab_); | 183 DCHECK_EQ(GDK_GRAB_SUCCESS, pointer_grab_status); |
184 DCHECK_EQ(GDK_GRAB_SUCCESS, keyboard_grab_status); | |
177 // need keyboard grab. | 185 // need keyboard grab. |
178 } | 186 } |
179 | 187 |
180 } // namespace views | 188 } // namespace views |
OLD | NEW |