From bea46dec54e6d23fb72cfcea559649d79af7e5cc Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 6 Jan 2025 21:24:56 +0100 Subject: More dumb shit --- src/main.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index bfa0346..c47035e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -176,6 +176,26 @@ static mgl::vec2i get_cursor_position(Display *dpy, Window *window) { unsigned int dummy_u; mgl::vec2i root_pos; XQueryPointer(dpy, DefaultRootWindow(dpy), &root_window, window, &root_pos.x, &root_pos.y, &dummy_i, &dummy_i, &dummy_u); + + if(window) { + XWindowAttributes attr; + if(XGetWindowAttributes(dpy, *window, &attr) && attr.override_redirect) + *window = None; + + int revert_to = 0; + Window input_focus_window = None; + if(XGetInputFocus(dpy, &input_focus_window, &revert_to)) { + if(input_focus_window) { + if(XGetWindowAttributes(dpy, input_focus_window, &attr) && attr.override_redirect) + *window = None; + } else { + *window = None; + } + } else { + fprintf(stderr, "xgetinputfocus failed\n"); + } + } + return root_pos; } -- cgit v1.2.3