Chromium Code Reviews| Index: chrome/browser/renderer_host/render_widget_host_view_gtk.cc |
| =================================================================== |
| --- chrome/browser/renderer_host/render_widget_host_view_gtk.cc (revision 20424) |
| +++ chrome/browser/renderer_host/render_widget_host_view_gtk.cc (working copy) |
| @@ -63,6 +63,8 @@ |
| G_CALLBACK(OnFocusIn), host_view); |
| g_signal_connect(widget, "focus-out-event", |
| G_CALLBACK(OnFocusOut), host_view); |
| + g_signal_connect(widget, "grab-notify", |
| + G_CALLBACK(OnGrabNotify), host_view); |
| g_signal_connect(widget, "button-press-event", |
| G_CALLBACK(ButtonPressReleaseEvent), host_view); |
| g_signal_connect(widget, "button-release-event", |
| @@ -154,6 +156,8 @@ |
| return TRUE; |
| } |
| + // WARNING: OnGrabNotify relies on the fact this function doesn't try to |
| + // dereference |focus|. |
| static gboolean OnFocusIn(GtkWidget* widget, GdkEventFocus* focus, |
| RenderWidgetHostViewGtk* host_view) { |
| int x, y; |
| @@ -191,6 +195,8 @@ |
| return FALSE; |
| } |
| + // WARNING: OnGrabNotify relies on the fact this function doesn't try to |
| + // dereference |focus|. |
| static gboolean OnFocusOut(GtkWidget* widget, GdkEventFocus* focus, |
| RenderWidgetHostViewGtk* host_view) { |
| // Whenever we lose focus, set the cursor back to that of our parent window, |
| @@ -208,6 +214,18 @@ |
| return FALSE; |
| } |
| + // Called when we are shadowed or unshadowed by a keyboard grab (which will |
| + // occur for activatable popups, such as dropdown menus). Popup windows do not |
| + // take focus, so we never get a focus out or focus in event when they are |
| + // shown, and must rely on this signal instead. |
| + static void OnGrabNotify(GtkWidget* widget, gboolean was_grabbed, |
| + RenderWidgetHostViewGtk* host_view) { |
| + if (was_grabbed) |
|
Evan Stade
2009/07/11 01:14:06
this check seems backward, but is not
|
| + OnFocusIn(widget, NULL, host_view); |
| + else |
| + OnFocusOut(widget, NULL, host_view); |
| + } |
| + |
| static gboolean ButtonPressReleaseEvent( |
| GtkWidget* widget, GdkEventButton* event, |
| RenderWidgetHostViewGtk* host_view) { |