Adapt clipboard()

Replace linkhover with target uri and add some comments
This commit is contained in:
Quentin Rameau 2015-11-20 00:09:21 +01:00
parent d6794e0d75
commit 701815a5f2

14
surf.c
View file

@ -107,7 +107,7 @@ static char *buildfile(const char *path);
static char *buildpath(const char *path); static char *buildpath(const char *path);
static gboolean buttonreleased(GtkWidget *w, GdkEventKey *e, Client *c); static gboolean buttonreleased(GtkWidget *w, GdkEventKey *e, Client *c);
static void cleanup(void); static void cleanup(void);
static void clipboard(Client *c, const Arg *arg); static void clipboard(Client *c, const Arg *a);
static WebKitCookieAcceptPolicy cookiepolicy_get(void); static WebKitCookieAcceptPolicy cookiepolicy_get(void);
static char cookiepolicy_set(const WebKitCookieAcceptPolicy p); static char cookiepolicy_set(const WebKitCookieAcceptPolicy p);
@ -362,18 +362,16 @@ runscript(Client *c)
} }
void void
clipboard(Client *c, const Arg *arg) clipboard(Client *c, const Arg *a)
{ {
gboolean paste = *(gboolean *)arg; if (a->b) { /* load clipboard uri */
if (paste) {
gtk_clipboard_request_text(gtk_clipboard_get( gtk_clipboard_request_text(gtk_clipboard_get(
GDK_SELECTION_PRIMARY), GDK_SELECTION_PRIMARY),
pasteuri, c); pasteuri, c);
} else { } else { /* copy uri */
gtk_clipboard_set_text(gtk_clipboard_get( gtk_clipboard_set_text(gtk_clipboard_get(
GDK_SELECTION_PRIMARY), c->linkhover GDK_SELECTION_PRIMARY), c->targeturi
? c->linkhover : geturi(c), -1); ? c->targeturi : geturi(c), -1);
} }
} }