From bc75635a655bd68ebc755b3151aee581e964d371 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Mon, 12 May 2025 21:22:03 -0700 Subject: [PATCH] os/gfx/linux: window focus querying --- src/os/gfx/linux/os_gfx_linux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/os/gfx/linux/os_gfx_linux.c b/src/os/gfx/linux/os_gfx_linux.c index 9a473ea9..7a142531 100644 --- a/src/os/gfx/linux/os_gfx_linux.c +++ b/src/os/gfx/linux/os_gfx_linux.c @@ -204,8 +204,12 @@ internal B32 os_window_is_focused(OS_Handle handle) { if(os_handle_match(handle, os_handle_zero())) {return 0;} - // TODO(rjf) - return 0; + OS_LNX_Window *w = (OS_LNX_Window *)handle.u64[0]; + Window focused_window = 0; + int revert_to = 0; + XGetInputFocus(os_lnx_gfx_state->display, &focused_window, &revert_to); + B32 result = (w->window == focused_window); + return result; } internal B32