Last active
December 11, 2015 20:19
-
-
Save yasar11732/4654758 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stddef.h> | |
#include <X11/Xlib.h> | |
#include <assert.h> | |
#include <unistd.h> | |
#include <signal.h> | |
int working = 1; | |
void signal_callback_handler(int signum) { | |
working = 0; | |
} | |
int main () { | |
signal(SIGINT, signal_callback_handler); | |
signal(SIGTSTP, signal_callback_handler); | |
signal(SIGTERM, signal_callback_handler); | |
Display *d = XOpenDisplay(NULL); | |
assert(d); | |
XSelectInput(d, DefaultRootWindow(d), ButtonPressMask); | |
while(working) { | |
XEvent e; | |
XNextEvent(d,&e); | |
if (e.type == ButtonPress) { | |
printf("%dx%d",e.xbutton.x,e.xbutton.y); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
X Error of failed request: BadAccess (attempt to access private resource denied)
Major opcode of failed request: 2 (X_ChangeWindowAttributes)
Serial number of failed request: 7
Current serial number in output stream: 7