Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <X11/Xlib.h>
- #include <X11/cursorfont.h>
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- Display *display;
- Window window;
- int screen;
- Cursor cursor;
- display = XOpenDisplay(NULL);
- if (display == NULL) {
- fprintf(stderr, "Cannot open display\n");
- exit(1);
- }
- screen = DefaultScreen(display);
- window = XCreateSimpleWindow(
- display,
- RootWindow(display, screen),
- 100, 100, 400, 300, 1,
- BlackPixel(display, screen),
- WhitePixel(display, screen)
- );
- XSelectInput(display, window, ExposureMask | KeyPressMask);
- printf("mytrace: start\n");
- cursor = XCreateFontCursor(display, XC_hand2);
- printf("mytrace: end\n");
- XDefineCursor(display, window, cursor);
- XMapWindow(display, window);
- while (1) {
- XEvent event;
- XNextEvent(display, &event);
- if (event.type == Expose) {
- } else if (event.type == KeyPress) {
- break; // Exit on key press
- }
- }
- XFreeCursor(display, cursor);
- XDestroyWindow(display, window);
- XCloseDisplay(display);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment