[hackers] [dmenu] add paste from clipboard || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Wed, 26 Oct 2011 14:28:36 +0200 (CEST)

changeset: 457:0efd920c91f6
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Wed Oct 26 13:28:15 2011 +0100
files: dmenu.c
description:
add paste from clipboard


diff -r 72669cb1b8c7 -r 0efd920c91f6 dmenu.c
--- a/dmenu.c Wed Oct 26 13:20:14 2011 +0100
+++ b/dmenu.c Wed Oct 26 13:28:15 2011 +0100
_AT_@ -52,7 +52,7 @@
 static unsigned int lines = 0;
 static unsigned long normcol[ColLast];
 static unsigned long selcol[ColLast];
-static Atom utf8;
+static Atom clip, utf8;
 static Bool topbar = True;
 static DC *dc;
 static Item *items = NULL;
_AT_@ -275,7 +275,8 @@
                                 insert(NULL, nextrune(-1) - cursor);
                         break;
                 case XK_y: /* paste selection */
- XConvertSelection(dc->dpy, XA_PRIMARY, utf8, utf8, win, CurrentTime);
+ XConvertSelection(dc->dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY,
+ utf8, utf8, win, CurrentTime);
                         return;
                 default:
                         return;
_AT_@ -517,6 +518,7 @@
         selcol[ColBG] = getcolor(dc, selbgcolor);
         selcol[ColFG] = getcolor(dc, selfgcolor);
 
+ clip = XInternAtom(dc->dpy, "CLIPBOARD", False);
         utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False);
 
         /* calculate menu geometry */
Received on Wed Oct 26 2011 - 14:28:36 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 26 2011 - 14:36:06 CEST