----
diff --git a/surf.c b/surf.c
index d75e589..64e6789 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -513,20 +513,42 @@ runscript(WebKitWebFrame *frame)
}
}
+/*
+ * arg is copy/paste/primary/clipboard
+ * paste: 0 ==> URI --> primary [copy]
+ * paste: 1 ==> primary --> URI [paste]
+ * paste: 2 ==> URI --> clipboard and primary [copy]
+ * paste: 3 ==> clipboard --> URI [paste]
+ */
void
clipboard(Client *c, const Arg *arg)
{
- gboolean paste = *(gboolean *)arg;
-
- if (paste) {
- gtk_clipboard_request_text(gtk_clipboard_get(
- GDK_SELECTION_PRIMARY),
+ switch (arg->i) {
+ case 2:
+ /* XXX for paste == 2, it seems weird to have s.th. in
+ * clipboard that was never in the primary. so, we put in
+ * both. thus, people expecting it in primary will see it.
+ * not clear this is the right choice.
+ */
+ gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD),
+ c->linkhover ? c->linkhover : geturi(c), -1);
+ /* fall through to set primary */
+ case 0:
+ gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY),
+ c->linkhover ? c->linkhover : geturi(c), -1);
+ break;
+ case 1:
+ gtk_clipboard_request_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY),
pasteuri, c);
- } else {
- gtk_clipboard_set_text(gtk_clipboard_get(
- GDK_SELECTION_PRIMARY), c->linkhover
- ? c->linkhover : geturi(c), -1);
- }
+ break;
+ case 3:
+ gtk_clipboard_request_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD),
+ pasteuri, c);
+ break;
+ default:
+ g_warning("%s:%d: clipboard called with arg outside {0,1,2,3}, i.e., %d. error in config.h?", __FILE__, __LINE__, arg->i);
+ break;
+ }
}
char *
Received on Tue May 02 2017 - 02:03:06 CEST
This archive was generated by hypermail 2.3.0 : Tue May 02 2017 - 02:12:13 CEST