From: Quentin Rameau Date: Thu, 19 Nov 2015 12:40:35 +0000 (+0100) Subject: Remove contextmenu() and menuactivate() for "context-menu" signal X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=d542773e7527758060c188f734bd6b612bbaa529;p=surf.git Remove contextmenu() and menuactivate() for "context-menu" signal 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. --- diff --git a/surf.c b/surf.c index b79438d..74851ee 100644 --- 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) {