Chromium Code Reviews| Index: chrome/browser/chromeos/login/screen_locker.cc |
| diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc |
| index a2b72de0a809c1d62a52c1b90da93c9a5e3ea0de..62fb61672c5799b07d7973f31fbb4af7f1d4d243 100644 |
| --- a/chrome/browser/chromeos/login/screen_locker.cc |
| +++ b/chrome/browser/chromeos/login/screen_locker.cc |
| @@ -6,8 +6,11 @@ |
| #include <string> |
| #include <vector> |
| +#include <X11/extensions/XTest.h> |
| +#include <X11/keysym.h> |
| #include "app/l10n_util.h" |
| +#include "app/x11_util.h" |
|
Daniel Erat
2010/11/16 15:38:13
nit: sort
oshima
2010/11/16 21:06:29
Done.
|
| #include "app/resource_bundle.h" |
| #include "base/command_line.h" |
| #include "base/metrics/histogram.h" |
| @@ -278,9 +281,30 @@ class GrabWidget : public views::WidgetGtk { |
| void ClearGrab() { |
| GtkWidget* current_grab_window; |
| - // Grab gtk input first so that the menu holding grab will close itself. |
| + // Grab gtk input first so that the menu holding gtk grab will |
| + // close itself. |
| gtk_grab_add(window_contents()); |
| + if (mouse_grab_status_ != GDK_GRAB_INVALID_TIME || |
|
Daniel Erat
2010/11/16 17:26:50
This is wrong: if _only_ the pointer is grabbed, y
oshima
2010/11/16 21:06:29
BTW, this *was* how view menu was implemented. Onl
|
| + kbd_grab_status_ != GDK_GRAB_INVALID_TIME) { |
| + // Send escape key if the input is grabbed by other client. |
| + // This happen when a plugin has a menu opened and sending |
|
Daniel Erat
2010/11/16 15:38:13
s/happen/happens/
oshima
2010/11/16 21:06:29
Done.
|
| + // escape key should close the menu. |
| + Display* display = x11_util::GetXDisplay(); |
| + KeyCode escape = XKeysymToKeycode(display, XK_Escape); // escape |
| + int event_base, error_base; |
| + int major, minor; |
| + // Make sure we have XTest extension. |
| + DCHECK(XTestQueryExtension(display, &event_base, &error_base, |
| + &major, &minor)); |
| + |
| + XTestGrabControl(display, True); |
|
Daniel Erat
2010/11/16 15:38:13
I don't think that you need this. It lets you sid
oshima
2010/11/16 21:06:29
Done.
|
| + XTestFakeKeyEvent(display, escape, True, 0); |
| + XTestFakeKeyEvent(display, escape, False, 0); |
| + XSync(display, False); |
|
Daniel Erat
2010/11/16 15:38:13
This can just be XFlush(display) instead.
oshima
2010/11/16 21:06:29
Done.
|
| + XTestGrabControl(display, False); |
| + } |
| + |
| // Make sure there is no grab widget so that gtk simply propagates |
| // an event. This is necessary to allow message bubble and password |
| // field, button to process events simultaneously. GTK |