Search Results

Search found 1 results on 1 pages for 'trilly campanelino'.

Page 1/1 | 1 

  • Xlib mouse events and ButtonPressMask

    - by Trilly Campanelino
    I have written a simple program which will report key press and release events for a particular window. In my case, it is mostly the terminal since I invoke the program from the terminal. I am able to get the key press and release events taking place in the terminal window (I have used XSelectInput() with KeyPressMask and KeyReleaseMask on the terminal) but the same is not working with ButtonPress and ButtonRelease. Not just these, but any events related to the mouse are not being reported. Any idea why this is happening? #include #include #include #include #include #include int main() { Display *display = XOpenDisplay(NULL); KeySym k; int revert_to; Window window; XEvent event; XGetInputFocus(display, &window, &revert_to); XSelectInput(display, window, KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask); while(1) { XNextEvent(display,&event); switch (event.type) { case KeyPress : printf("Key Pressed\n"); break; case KeyRelease : printf("Key Released\n"); break; case ButtonPress : printf("Button Pressed\n"); break; case ButtonRelease : printf("Button Released\n"); break; case EnterNotify : printf("Enter\n"); break; } } XCloseDisplay(display); return 0; }

    Read the article

1