Remove contextmenu() and menuactivate() for "context-menu" signal
authorQuentin Rameau <quinq@fifth.space>
Thu, 19 Nov 2015 12:40:35 +0000 (13:40 +0100)
committerQuentin Rameau <quinq@fifth.space>
Thu, 19 Nov 2015 23:34:21 +0000 (00:34 +0100)
Those were added because “right click menu to copy the link URI will now
work” (would not work) in 2013. It's been a while since that works without
intervention.

surf.c

diff --git a/surf.c b/surf.c
index b79438d..74851ee 100644 (file)
--- a/surf.c
+++ b/surf.c
@@ -166,10 +166,6 @@ static WebKitWebView *newview(Client *c, WebKitWebView *rv);
 static void showview(WebKitWebView *v, Client *c);
 static void newwindow(Client *c, const Arg *arg, gboolean noembed);
 static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d);
-static gboolean contextmenu(WebKitWebView *view, GtkWidget *menu,
-                            WebKitHitTestResult *target, gboolean keyboard,
-                           Client *c);
-static void menuactivate(GtkMenuItem *item, Client *c);
 static void print(Client *c, const Arg *arg);
 static GdkFilterReturn processx(GdkXEvent *xevent, GdkEvent *event,
                                 gpointer d);
@@ -1015,9 +1011,6 @@ newview(Client *c, WebKitWebView *rv)
        g_signal_connect(G_OBJECT(v),
                         "button-release-event",
                         G_CALLBACK(buttonreleased), c);
-       g_signal_connect(G_OBJECT(v),
-                        "context-menu",
-                        G_CALLBACK(contextmenu), c);
        g_signal_connect(G_OBJECT(v),
                         "resource-request-starting",
                         G_CALLBACK(beforerequest), c);
@@ -1146,53 +1139,6 @@ newwindow(Client *c, const Arg *arg, gboolean noembed)
        spawn(NULL, &a);
 }
 
-gboolean
-contextmenu(WebKitWebView *view, GtkWidget *menu, WebKitHitTestResult *target,
-            gboolean keyboard, Client *c)
-{
-       GList *items = gtk_container_get_children(GTK_CONTAINER(GTK_MENU(menu)));
-
-       for (GList *l = items; l; l = l->next)
-               g_signal_connect(l->data, "activate", G_CALLBACK(menuactivate), c);
-
-       g_list_free(items);
-       return FALSE;
-}
-
-void
-menuactivate(GtkMenuItem *item, Client *c)
-{
-       /*
-        * context-menu-action-2000 open link
-        * context-menu-action-1    open link in window
-        * context-menu-action-2    download linked file
-        * context-menu-action-3    copy link location
-        * context-menu-action-7    copy image address
-        * context-menu-action-13   reload
-        * context-menu-action-10   back
-        * context-menu-action-11   forward
-        * context-menu-action-12   stop
-        */
-
-       const gchar *name, *uri;
-       GtkClipboard *prisel, *clpbrd;
-
-       name = gtk_actionable_get_action_name(GTK_ACTIONABLE(item));
-       if (name == NULL)
-               return;
-
-       if (!g_strcmp0(name, "context-menu-action-3")) {
-               prisel = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
-               gtk_clipboard_set_text(prisel, c->linkhover, -1);
-       } else if (!g_strcmp0(name, "context-menu-action-7")) {
-               prisel = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
-               clpbrd = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
-               uri = gtk_clipboard_wait_for_text(clpbrd);
-               if (uri)
-                       gtk_clipboard_set_text(prisel, uri, -1);
-       }
-}
-
 void
 pasteuri(GtkClipboard *clipboard, const char *text, gpointer d)
 {