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

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_gtk.cc

Issue 149506: GTK: For the render view, count keyboard grab shadows the same as focus event... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698