2023-05-24 07:36:40 +02:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
|
|
|
|
void pastesel_x11(void) {
|
|
|
|
char *p, *q;
|
|
|
|
int di;
|
|
|
|
unsigned long dl;
|
|
|
|
Atom da;
|
|
|
|
|
|
|
|
// we have been given the current selection, now insert it into input
|
2023-06-23 03:38:21 +02:00
|
|
|
if (XGetWindowProperty(dpy, win, utf8, 0, (sizeof tx.text / 4) + 1, False,
|
2023-05-24 07:36:40 +02:00
|
|
|
utf8, &da, &di, &dl, &dl, (unsigned char **)&p)
|
|
|
|
== Success && p) {
|
|
|
|
insert(p, (q = strchr(p, '\n')) ? q - p : (ssize_t)strlen(p)); // insert selection
|
|
|
|
XFree(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
// draw the menu
|
|
|
|
drawmenu();
|
|
|
|
}
|
2023-05-24 22:01:35 +02:00
|
|
|
|
|
|
|
int paste_x11(int sel) {
|
|
|
|
if (XConvertSelection(dpy, sel ? XA_PRIMARY : clip, utf8, utf8, win, CurrentTime)) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|