From 767f7e4fd448033e052e071f96a0fa7fc27f1e02 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 29 Mar 2024 21:38:20 +0100 Subject: [PATCH] Track keyboard focus on Wayland. --- profiler/src/BackendWayland.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/profiler/src/BackendWayland.cpp b/profiler/src/BackendWayland.cpp index 319d2fd8..65e91729 100644 --- a/profiler/src/BackendWayland.cpp +++ b/profiler/src/BackendWayland.cpp @@ -203,6 +203,7 @@ static struct xkb_compose_state* s_xkbComposeState; static xkb_mod_index_t s_xkbCtrl, s_xkbAlt, s_xkbShift, s_xkbSuper; static wp_cursor_shape_device_v1_shape s_mouseCursor; static uint32_t s_mouseCursorSerial; +static bool s_hasFocus = false; struct Output { @@ -381,11 +382,13 @@ static void KeyboardKeymap( void*, struct wl_keyboard* kbd, uint32_t format, int static void KeyboardEnter( void*, struct wl_keyboard* kbd, uint32_t serial, struct wl_surface* surf, struct wl_array* keys ) { ImGui::GetIO().AddFocusEvent( true ); + s_hasFocus = true; } static void KeyboardLeave( void*, struct wl_keyboard* kbd, uint32_t serial, struct wl_surface* surf ) { ImGui::GetIO().AddFocusEvent( false ); + s_hasFocus = false; } static xkb_keysym_t Compose( const xkb_keysym_t sym )