diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-01-07 16:32:51 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-01-07 16:32:51 +0100 |
commit | 2a60a176e629b416102583549aebad14dde6afbe (patch) | |
tree | e105c1ea31527d29e8de0454dffc107333a30799 | |
parent | e81cd63b6f518638f6847e3da58870b8311618a1 (diff) |
Check event window
-rw-r--r-- | src/main.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index f0f8fcb..b8e8375 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -277,7 +277,7 @@ static bool create_window_get_center_position_kde(Display *display, mgl::vec2i & } XNextEvent(display, &xev); - if(xev.type == ConfigureNotify) { + if(xev.type == ConfigureNotify && xev.xconfigure.window == window) { got_data = xev.xconfigure.x > 0 && xev.xconfigure.y > 0; position.x = xev.xconfigure.x + xev.xconfigure.width / 2; position.y = xev.xconfigure.y + xev.xconfigure.height / 2; @@ -338,7 +338,7 @@ static bool create_window_get_center_position_gnome(Display *display, mgl::vec2i } XNextEvent(display, &xev); - if(xev.type == MapNotify) { + if(xev.type == MapNotify && xev.xmap.window == window) { int x = 0; int y = 0; Window w = None; @@ -349,7 +349,7 @@ static bool create_window_get_center_position_gnome(Display *display, mgl::vec2i position.y = y + size / 2; if(got_data) break; - } else if(xev.type == ConfigureNotify) { + } else if(xev.type == ConfigureNotify && xev.xconfigure.window == window) { got_data = xev.xconfigure.x > 0 && xev.xconfigure.y > 0; position.x = xev.xconfigure.x + xev.xconfigure.width / 2; position.y = xev.xconfigure.y + xev.xconfigure.height / 2; |