Fix tab key-press not changing widget when a not main modifier is being used (for example enabling the numeric keyboard).

This commit is contained in:
Martín Lucas Golini
2025-07-01 19:20:48 -03:00
parent a79c16ec0a
commit aa7ee8093a
4 changed files with 8 additions and 5 deletions

View File

@@ -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

View File

@@ -19,6 +19,8 @@ class EE_API Input {
virtual ~Input();
static Uint32 sanitizeMod( const Uint32& mod );
/** Update the Input */
virtual void update() = 0;

View File

@@ -1,6 +1,7 @@
#include <eepp/ui/uieventdispatcher.hpp>
#include <eepp/ui/uiscenenode.hpp>
#include <eepp/ui/uiwidget.hpp>
#include <eepp/window/input.hpp>
#include <eepp/window/inputevent.hpp>
#include <eepp/window/window.hpp>
@@ -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 ) {

View File

@@ -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;