diff options
Diffstat (limited to 'apps/x11_main.c')
-rw-r--r-- | apps/x11_main.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/x11_main.c b/apps/x11_main.c index 987e3594..1c0ca0b0 100644 --- a/apps/x11_main.c +++ b/apps/x11_main.c @@ -63,6 +63,7 @@ void windrawstringxor(pdfapp_t *app, int x, int y, char *s); void cleanup(pdfapp_t *app); static Display *xdpy; +static Atom XA_CLIPBOARD; static Atom XA_TARGETS; static Atom XA_TIMESTAMP; static Atom XA_UTF8_STRING; @@ -174,6 +175,7 @@ static void winopen(void) if (!xdpy) fz_throw(gapp.ctx, "cannot open display"); + XA_CLIPBOARD = XInternAtom(xdpy, "CLIPBOARD", False); XA_TARGETS = XInternAtom(xdpy, "TARGETS", False); XA_TIMESTAMP = XInternAtom(xdpy, "TIMESTAMP", False); XA_UTF8_STRING = XInternAtom(xdpy, "UTF8_STRING", False); @@ -552,7 +554,7 @@ void windrawstring(pdfapp_t *app, int x, int y, char *s) XDrawString(xdpy, xwin, xgc, x, y, s, strlen(s)); } -void windocopy(pdfapp_t *app) +void docopy(pdfapp_t *app, Atom copy_target) { unsigned short copyucs2[16 * 1024]; char *latin1 = copylatin1; @@ -577,11 +579,16 @@ void windocopy(pdfapp_t *app) *utf8 = 0; *latin1 = 0; - XSetSelectionOwner(xdpy, XA_PRIMARY, xwin, copytime); + XSetSelectionOwner(xdpy, copy_target, xwin, copytime); justcopied = 1; } +void windocopy(pdfapp_t *app) +{ + docopy(app, XA_PRIMARY); +} + void onselreq(Window requestor, Atom selection, Atom target, Atom property, Time time) { XEvent nevt; @@ -835,7 +842,9 @@ int main(int argc, char **argv) len = 1; buf[0] = '.'; break; } - if (len) + if (xevt.xkey.state & ControlMask && keysym == XK_c) + docopy(&gapp, XA_CLIPBOARD); + else if (len) onkey(buf[0]); onmouse(oldx, oldy, 0, 0, 0); |