// gcc -o clipchange clipchange.c -lX11 -lXfixes -Wall
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/extensions/Xfixes.h>
int main(int argc, char* argv[]){
Display *display = XOpenDisplay(NULL);
Atom CLIPBOARD = XInternAtom(display, "CLIPBOARD", False);
// XFixesSelectSelectionInput(
// display, DefaultRootWindow(display),
// XA_PRIMARY, XFixesSetSelectionOwnerNotifyMask
// );
XFixesSelectSelectionInput(
display, DefaultRootWindow(display),
CLIPBOARD, XFixesSetSelectionOwnerNotifyMask
);
XEvent event;
for(;;){
XNextEvent(display, &event);
printf("event.type = %d\n", event.type);
}
XCloseDisplay(display);
return 0;
}
网友评论