aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-01-06 21:24:56 +0100
committerdec05eba <dec05eba@protonmail.com>2025-01-06 21:24:56 +0100
commitbea46dec54e6d23fb72cfcea559649d79af7e5cc (patch)
tree9ce1c239ad8140ebc36075c180d9f3652ba0cdf4 /src/main.cpp
parentaf1198eb97c3e6d918fdce4813f8f071c5b487ce (diff)
More dumb shit
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp20
1 files changed, 20 insertions, 0 deletions
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;
}