summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFran├žois Revol <revol@free.fr>2012-12-06 22:35:16 (GMT)
committer Fran├žois Revol <revol@free.fr>2012-12-06 22:35:16 (GMT)
commit6167b8862d25178fb6fec5f4b9848da758753ee6 (patch)
tree3c8f8ea9031e51681c4ef2ed46b3d4d64b67f0d3
parent912b9de92808c43a78680d41bba1ad982e120d86 (diff)
downloadnetsurf-mmu_man/xf86keys.tar.gz
netsurf-mmu_man/xf86keys.tar.bz2
gtk: Handle Back and Forward keysmmu_man/xf86keys
Those extra keys are available on some keyboards, like on thinkpads.
-rw-r--r--gtk/scaffolding.c2
-rw-r--r--gtk/scaffolding.h1
-rw-r--r--gtk/window.c28
3 files changed, 30 insertions, 1 deletions
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index 91288a2..687ade8 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -313,7 +313,7 @@ void nsgtk_scaffolding_destroy(nsgtk_scaffolding *g)
/**
* Update the back and forward button sensitivity.
*/
-static void nsgtk_window_update_back_forward(struct gtk_scaffolding *g)
+void nsgtk_window_update_back_forward(struct gtk_scaffolding *g)
{
int width, height;
struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
diff --git a/gtk/scaffolding.h b/gtk/scaffolding.h
index cf75f0a..0781584 100644
--- a/gtk/scaffolding.h
+++ b/gtk/scaffolding.h
@@ -144,6 +144,7 @@ void nsgtk_scaffolding_set_top_level(struct gui_window *g);
void nsgtk_scaffolding_destroy(nsgtk_scaffolding *g);
+void nsgtk_window_update_back_forward(struct gtk_scaffolding *g);
void nsgtk_scaffolding_set_sensitivity(struct gtk_scaffolding *g);
void nsgtk_scaffolding_initial_sensitivity(struct gtk_scaffolding *g);
void nsgtk_scaffolding_popup_menu(struct gtk_scaffolding *g, gdouble x,
diff --git a/gtk/window.c b/gtk/window.c
index 8a3a085..42344e6 100644
--- a/gtk/window.c
+++ b/gtk/window.c
@@ -29,6 +29,7 @@
#include "content/hlcache.h"
#include "gtk/window.h"
#include "desktop/browser_private.h"
+#include "desktop/history_core.h"
#include "desktop/mouse.h"
#include "desktop/options.h"
#include "desktop/searchweb.h"
@@ -37,6 +38,7 @@
#include "gtk/compat.h"
#include "gtk/gui.h"
#include "gtk/scaffolding.h"
+#include "gtk/search.h"
#include "gtk/plotters.h"
#include "gtk/schedule.h"
#include "gtk/tabs.h"
@@ -579,6 +581,32 @@ static gboolean nsgtk_window_keypress_event(GtkWidget *widget,
gtk_adjustment_set_value(vscroll, value);
break;
+ case GDK_KEY(Forward):
+ if (g->bw && history_back_available(g->bw->history)) {
+ /* clear potential search effects */
+ browser_window_search_destroy_context(g->bw);
+
+ nsgtk_search_set_forward_state(true, g->bw);
+ nsgtk_search_set_back_state(true, g->bw);
+
+ history_forward(g->bw, g->bw->history);
+ nsgtk_window_update_back_forward(g->scaffold);
+ }
+ break;
+
+ case GDK_KEY(Back):
+ if (g->bw && history_back_available(g->bw->history)) {
+ /* clear potential search effects */
+ browser_window_search_destroy_context(g->bw);
+
+ nsgtk_search_set_forward_state(true, g->bw);
+ nsgtk_search_set_back_state(true, g->bw);
+
+ history_back(g->bw, g->bw->history);
+ nsgtk_window_update_back_forward(g->scaffold);
+ }
+ break;
+
default:
break;