surf

my build of surf
git clone git://git.ckyln.com/~cem/surf.git
Log | Files | Refs | README | LICENSE

commit d542773e7527758060c188f734bd6b612bbaa529
parent f6a35e5fbfb4a5e9f92a126dae0cca103727d9d4
Author: Quentin Rameau <quinq@fifth.space>
Date:   Thu, 19 Nov 2015 13:40:35 +0100

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.

Diffstat:
Msurf.c | 54------------------------------------------------------
1 file changed, 0 insertions(+), 54 deletions(-)

diff --git 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); @@ -1016,9 +1012,6 @@ newview(Client *c, WebKitWebView *rv) "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); g_signal_connect(G_OBJECT(v), @@ -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) {