From de2c912fc1e7a43022933d03e095af3fcb90b775 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Sun, 11 Nov 2007 23:22:34 +0000 Subject: Implement grab_focus in EphyBaseEmbed. We still need a custom implementation in MozillaEmbed because the child of the embed won't exist until the widget is realized, so there is no point in grabbing focus until then. svn path=/trunk/; revision=7668 --- embed/mozilla/mozilla-embed.cpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'embed/mozilla') diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index 6a2af9279..6470a739d 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -144,23 +144,6 @@ G_DEFINE_TYPE_WITH_CODE (MozillaEmbed, mozilla_embed, EPHY_TYPE_BASE_EMBED, G_IMPLEMENT_INTERFACE (EPHY_TYPE_COMMAND_MANAGER, ephy_command_manager_iface_init)) -static void -mozilla_embed_grab_focus (GtkWidget *widget) -{ - GtkWidget *child; - - child = gtk_bin_get_child (GTK_BIN (widget)); - - if (child != NULL) - { - gtk_widget_grab_focus (child); - } - else - { - g_warning ("Need to realize the embed before grabbing focus!\n"); - } -} - static void impl_close (EphyEmbed *embed) { @@ -222,6 +205,19 @@ mozilla_embed_size_allocate (GtkWidget *widget, } } +static void +mozilla_embed_grab_focus (GtkWidget *widget) +{ + GtkWidget *child; + + child = gtk_bin_get_child (GTK_BIN (widget)); + + if (child && GTK_WIDGET_REALIZED (child)) + gtk_widget_grab_focus (child); + else + g_warning ("Need to realize the embed before grabbing focus!\n"); +} + static void mozilla_embed_class_init (MozillaEmbedClass *klass) { @@ -234,9 +230,9 @@ mozilla_embed_class_init (MozillaEmbedClass *klass) gtk_object_class->destroy = mozilla_embed_destroy; - widget_class->grab_focus = mozilla_embed_grab_focus; widget_class->realize = mozilla_embed_realize; widget_class->size_allocate = mozilla_embed_size_allocate; + widget_class->grab_focus = mozilla_embed_grab_focus; g_type_class_add_private (object_class, sizeof(MozillaEmbedPrivate)); } -- cgit v1.2.3