0

I'm trying to intercept mouse buttons using xlib c (specificly 4 and 5). I want to this without blocking and prefrebly without external libraries except from xlib.

I've looked at this question's answer and it works but blocks input (I can't click on any other windows).

This is my attempt but it pauses at XNextEvent forever without giving any output

#include <stdio.h>
#include <X11/Xlib.h>

static Display *display;

int main(void) {

    display = XOpenDisplay(NULL);
    XSelectInput(display, DefaultRootWindow(display), ButtonReleaseMask);
    
    XEvent event;
    while (True) {
        XNextEvent(display, &event);
        printf("Something happened: %s\n", event.type);
    }

    return 0;
}
SollyBunny
  • 800
  • 1
  • 8
  • 15

0 Answers0