diff --git a/gtk/gtk_scaffolding.c b/gtk/gtk_scaffolding.c
index 693d246e5..bbb8074fb 100644
--- a/gtk/gtk_scaffolding.c
+++ b/gtk/gtk_scaffolding.c
@@ -59,6 +59,9 @@ struct gtk_scaffolding {
GladeXML *xml;
+ GladeXML *popup_xml;
+ GtkMenu *popup_menu;
+
struct gtk_history_window *history_window;
int throb_frame;
@@ -757,6 +760,22 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
g->being_destroyed = 0;
g->fullscreen = false;
+
+ /* create the popup version of the menu */
+ g->popup_xml = glade_xml_new(glade_file_location, "menuPopup", NULL);
+ g->popup_menu = GTK_MENU(glade_xml_get_widget(g->popup_xml, "menuPopup"));
+
+#define POPUP_ATTACH(x, y) gtk_menu_item_set_submenu( \
+ GTK_MENU_ITEM(glade_xml_get_widget(g->popup_xml, x)),\
+ GTK_WIDGET(glade_xml_get_widget(g->xml, y)))
+
+ POPUP_ATTACH("menupopup_file", "menumain_file");
+ POPUP_ATTACH("menupopup_edit", "menumain_edit");
+ POPUP_ATTACH("menupopup_view", "menumain_view");
+ POPUP_ATTACH("menupopup_navigate", "menumain_navigate");
+ POPUP_ATTACH("menupopup_help", "menumain_help");
+
+#undef POPUP_ATTACH
/* finally, show the window. */
gtk_widget_show(GTK_WIDGET(g->window));
@@ -833,3 +852,9 @@ gboolean nsgtk_scaffolding_is_busy(nsgtk_scaffolding *scaffold)
/* We are considered "busy" if the stop button is sensitive */
return GTK_WIDGET_SENSITIVE((GTK_WIDGET(scaffold->stop_button)));
}
+
+void nsgtk_scaffolding_popup_menu(nsgtk_scaffolding *g, guint button)
+{
+ printf("foo.\n");
+ gtk_menu_popup(g->popup_menu, NULL, NULL, NULL, NULL, button, 0);
+}
diff --git a/gtk/gtk_scaffolding.h b/gtk/gtk_scaffolding.h
index 5f786d94f..361b0d42f 100644
--- a/gtk/gtk_scaffolding.h
+++ b/gtk/gtk_scaffolding.h
@@ -22,4 +22,6 @@ void nsgtk_attach_toplevel_viewport(nsgtk_scaffolding *g, GtkViewport *vp);
void nsgtk_scaffolding_destroy(nsgtk_scaffolding *scaffold);
+void nsgtk_scaffolding_popup_menu(nsgtk_scaffolding *g, guint button);
+
#endif /* NETSURF_GTK_SCAFFOLDING_H */
diff --git a/gtk/gtk_window.c b/gtk/gtk_window.c
index 43380647d..068756a17 100644
--- a/gtk/gtk_window.c
+++ b/gtk/gtk_window.c
@@ -334,8 +334,11 @@ gboolean nsgtk_window_button_press_event(GtkWidget *widget,
if (event->button == 2) /* 2 == middle button on X */
button = BROWSER_MOUSE_CLICK_2;
- if (event->button == 3) /* 3 == right button on X */
- return TRUE; /* Do nothing for right click for now */
+ if (event->button == 3) {
+ /* 3 == right button on X */
+ nsgtk_scaffolding_popup_menu(g->scaffold, event->button);
+ return TRUE;
+ }
browser_window_mouse_click(g->bw, button,
event->x / g->scale, event->y / g->scale);
diff --git a/gtk/res/netsurf.glade b/gtk/res/netsurf.glade
index ff3aadae3..7676963af 100644
--- a/gtk/res/netsurf.glade
+++ b/gtk/res/netsurf.glade
@@ -37,7 +37,7 @@
True
-