Track keyboard focus on Wayland.

This commit is contained in:
Bartosz Taudul 2024-03-29 21:38:20 +01:00
parent 2f8fe4180d
commit 767f7e4fd4
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -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 xkb_mod_index_t s_xkbCtrl, s_xkbAlt, s_xkbShift, s_xkbSuper;
static wp_cursor_shape_device_v1_shape s_mouseCursor; static wp_cursor_shape_device_v1_shape s_mouseCursor;
static uint32_t s_mouseCursorSerial; static uint32_t s_mouseCursorSerial;
static bool s_hasFocus = false;
struct Output 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 ) static void KeyboardEnter( void*, struct wl_keyboard* kbd, uint32_t serial, struct wl_surface* surf, struct wl_array* keys )
{ {
ImGui::GetIO().AddFocusEvent( true ); ImGui::GetIO().AddFocusEvent( true );
s_hasFocus = true;
} }
static void KeyboardLeave( void*, struct wl_keyboard* kbd, uint32_t serial, struct wl_surface* surf ) static void KeyboardLeave( void*, struct wl_keyboard* kbd, uint32_t serial, struct wl_surface* surf )
{ {
ImGui::GetIO().AddFocusEvent( false ); ImGui::GetIO().AddFocusEvent( false );
s_hasFocus = false;
} }
static xkb_keysym_t Compose( const xkb_keysym_t sym ) static xkb_keysym_t Compose( const xkb_keysym_t sym )