From aa7ee8093aff0f59ec5eb2a1c974e92f4534df9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Tue, 1 Jul 2025 19:20:48 -0300 Subject: [PATCH] Fix tab key-press not changing widget when a not main modifier is being used (for example enabling the numeric keyboard). --- include/eepp/ui/uieventdispatcher.hpp | 2 +- include/eepp/window/input.hpp | 2 ++ src/eepp/ui/uieventdispatcher.cpp | 7 ++++--- src/eepp/window/input.cpp | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/eepp/ui/uieventdispatcher.hpp b/include/eepp/ui/uieventdispatcher.hpp index 7bad79b6b..e727e5482 100644 --- a/include/eepp/ui/uieventdispatcher.hpp +++ b/include/eepp/ui/uieventdispatcher.hpp @@ -20,7 +20,7 @@ class EE_API UIEventDispatcher : public EventDispatcher { void inputCallback( InputEvent* Event ); - void checkTabPress( const Uint32& KeyCode, const Uint32& mod ); + void checkTabPress( Uint32 KeyCode, Uint32 mod ); }; }} // namespace EE::UI diff --git a/include/eepp/window/input.hpp b/include/eepp/window/input.hpp index 1825bc65e..fa39a6e5f 100644 --- a/include/eepp/window/input.hpp +++ b/include/eepp/window/input.hpp @@ -19,6 +19,8 @@ class EE_API Input { virtual ~Input(); + static Uint32 sanitizeMod( const Uint32& mod ); + /** Update the Input */ virtual void update() = 0; diff --git a/src/eepp/ui/uieventdispatcher.cpp b/src/eepp/ui/uieventdispatcher.cpp index efb769b2e..69968caf5 100644 --- a/src/eepp/ui/uieventdispatcher.cpp +++ b/src/eepp/ui/uieventdispatcher.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -10,8 +11,7 @@ UIEventDispatcher* UIEventDispatcher::New( SceneNode* sceneNode ) { return eeNew( UIEventDispatcher, ( sceneNode ) ); } -UIEventDispatcher::UIEventDispatcher( SceneNode* sceneNode ) : - EventDispatcher( sceneNode ) {} +UIEventDispatcher::UIEventDispatcher( SceneNode* sceneNode ) : EventDispatcher( sceneNode ) {} bool UIEventDispatcher::justGainedFocus() const { return mJustGainedFocus; @@ -45,9 +45,10 @@ void UIEventDispatcher::inputCallback( InputEvent* event ) { } } -void UIEventDispatcher::checkTabPress( const Uint32& KeyCode, const Uint32& mod ) { +void UIEventDispatcher::checkTabPress( Uint32 KeyCode, Uint32 mod ) { eeASSERT( NULL != mFocusNode ); if ( KeyCode == KEY_TAB ) { + mod = Input::sanitizeMod( mod ); Window::Window* win = mFocusNode->getSceneNode()->getWindow(); if ( mFocusNode->isWidget() && NULL != win && !mJustGainedFocus ) { if ( mod & KEYMOD_SHIFT ) { diff --git a/src/eepp/window/input.cpp b/src/eepp/window/input.cpp index 75cbb2746..57e5827e6 100644 --- a/src/eepp/window/input.cpp +++ b/src/eepp/window/input.cpp @@ -506,7 +506,7 @@ const Uint32& Input::getModState() const { return mInputMod; } -static Uint32 sanitizeMod( const Uint32& mod ) { +Uint32 Input::sanitizeMod( const Uint32& mod ) { Uint32 smod = 0; if ( mod & KEYMOD_CTRL ) smod |= KEYMOD_CTRL;