From 27b3a31636135db43034b5cbebb996e4b6d86db2 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 18 Aug 2003 22:42:39 +0000 Subject: Add activate api. 2003-08-19 Marco Pesenti Gritti * embed/ephy-embed.c: (ephy_embed_activate): * embed/ephy-embed.h: * embed/mozilla/mozilla-embed.cpp: Add activate api. * src/window-commands.c: (window_cmd_go_back), (window_cmd_go_up), (window_cmd_go_forward), (window_cmd_view_stop), (window_cmd_view_reload): Activate on navigation commands. It seem like a better beahvior and it avoid some mozilla focus craziness. --- ChangeLog | 15 +++++++++++++++ embed/ephy-embed.c | 7 +++++++ embed/ephy-embed.h | 3 +++ embed/mozilla/mozilla-embed.cpp | 11 +++++++++++ src/window-commands.c | 10 ++++++++++ 5 files changed, 46 insertions(+) diff --git a/ChangeLog b/ChangeLog index 50929017a..757fefdd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2003-08-19 Marco Pesenti Gritti + + * embed/ephy-embed.c: (ephy_embed_activate): + * embed/ephy-embed.h: + * embed/mozilla/mozilla-embed.cpp: + + Add activate api. + + * src/window-commands.c: (window_cmd_go_back), (window_cmd_go_up), + (window_cmd_go_forward), (window_cmd_view_stop), + (window_cmd_view_reload): + + Activate on navigation commands. It seem like a better + beahvior and it avoid some mozilla focus craziness. + 2003-08-17 Marco Pesenti Gritti * embed/mozilla/EphyWrapper.cpp: diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index f9bf0dc7b..48e9cdcf3 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -557,6 +557,13 @@ ephy_embed_find_next (EphyEmbed *embed, return klass->find_next (embed, backwards); } +gresult +ephy_embed_activate (EphyEmbed *embed) +{ + EphyEmbedClass *klass = EPHY_EMBED_GET_CLASS (embed); + return klass->activate (embed); +} + gresult ephy_embed_set_encoding (EphyEmbed *embed, const char *encoding) diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h index 27fe2e504..24006c039 100644 --- a/embed/ephy-embed.h +++ b/embed/ephy-embed.h @@ -260,6 +260,7 @@ struct EphyEmbedClass gboolean wrap_around); gresult (* find_next) (EphyEmbed *embed, gboolean backwards); + gresult (* activate) (EphyEmbed *embed); gresult (* print) (EphyEmbed *embed, EmbedPrintInfo *info); gresult (* print_preview_close) (EphyEmbed *embed); @@ -390,6 +391,8 @@ gresult ephy_embed_find_next (EphyEmbed *embed, gresult ephy_embed_set_encoding (EphyEmbed *embed, const char *encoding); +gresult ephy_embed_activate (EphyEmbed *embed); + /* Printing */ gresult ephy_embed_print (EphyEmbed *embed, diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index 63c696d80..66695ef64 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -308,6 +308,16 @@ impl_find_next (EphyEmbed *embed, return didFind ? G_OK : G_FAILED; } +static gresult +impl_activate (EphyEmbed *embed) +{ + g_return_val_if_fail (IS_EPHY_EMBED (embed), G_FAILED); + + gtk_widget_grab_focus (GTK_BIN (embed)->child); + + return G_OK; +} + static gresult impl_find_set_properties (EphyEmbed *embed, char *search_string, @@ -363,6 +373,7 @@ ephy_embed_init (EphyEmbedClass *embed_class) embed_class->shistory_copy = impl_shistory_copy; embed_class->get_security_level = impl_get_security_level; embed_class->find_next = impl_find_next; + embed_class->activate = impl_activate; embed_class->find_set_properties = impl_find_set_properties; embed_class->set_encoding = impl_set_encoding; embed_class->select_all = impl_select_all; diff --git a/src/window-commands.c b/src/window-commands.c index 2ea06e6b3..66145daf4 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -79,6 +79,8 @@ window_cmd_go_back (EggAction *action, embed = ephy_window_get_active_embed (window); g_return_if_fail (embed != NULL); + ephy_embed_activate (embed); + ephy_embed_go_back (embed); } @@ -91,6 +93,8 @@ window_cmd_go_up (EggAction *action, embed = ephy_window_get_active_embed (window); g_return_if_fail (embed != NULL); + ephy_embed_activate (embed); + ephy_embed_go_up (embed); } @@ -146,6 +150,8 @@ window_cmd_go_forward (EggAction *action, embed = ephy_window_get_active_embed (window); g_return_if_fail (embed != NULL); + ephy_embed_activate (embed); + ephy_embed_go_forward (embed); } @@ -185,6 +191,8 @@ window_cmd_view_stop (EggAction *action, embed = ephy_window_get_active_embed (window); g_return_if_fail (embed != NULL); + ephy_embed_activate (embed); + ephy_embed_stop_load (embed); } @@ -220,6 +228,8 @@ window_cmd_view_reload (EggAction *action, force = TRUE; } + ephy_embed_activate (embed); + ephy_embed_reload (embed, force ? EMBED_RELOAD_NORMAL : EMBED_RELOAD_BYPASSCACHE); } -- cgit v1.2.3