mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-01 12:45:56 +00:00
feat(libSceVideoOut): keep key presses from the title's keyboard while a dialog is shown
KeyboardInput no longer publishes a key press to libSceKeyboard while a modal dialog captures input, so the keys that answer the dialog are not also typed into the title. Key releases still reach it. keyboard_tests links libSceIme because it builds KeyboardInput.cpp itself.
This commit is contained in:
1 parent
3ba1c9510f
commit
35599e971d
2 files changed
+4
-2
No files matched your search
@@ -12,11 +12,11 @@ if(BUILD_TESTING)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../libSceVideoOut/src/KeyboardInput.cpp
|
||||
)
|
||||
target_include_directories(keyboard_tests PRIVATE ${LIBS_INCLUDE_DIR} ${ANYPS5_SDL2_INCLUDE_DIR})
|
||||
target_link_libraries(keyboard_tests PRIVATE libSceKeyboard libkernel libc)
|
||||
target_link_libraries(keyboard_tests PRIVATE libSceKeyboard libSceIme libkernel libc)
|
||||
configure_windows_unwind(keyboard_tests)
|
||||
add_test(NAME keyboard_input COMMAND keyboard_tests)
|
||||
if(WIN32)
|
||||
set_tests_properties(keyboard_input PROPERTIES ENVIRONMENT_MODIFICATION
|
||||
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceKeyboard>")
|
||||
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceKeyboard>;PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceIme>")
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "prx/libSceVideoOut/include/KeyboardInput.hpp"
|
||||
#include "prx/libSceKeyboard/include/KeyboardState.hpp"
|
||||
#include "prx/libSceIme/include/ModalDialog.hpp"
|
||||
|
||||
#include "SDL_keyboard.h"
|
||||
|
||||
@@ -9,6 +10,7 @@ void KeyboardInput::HandleEvent(const SDL_Event& event, unsigned windowId) {
|
||||
case SDL_KEYDOWN:
|
||||
case SDL_KEYUP:
|
||||
if (event.key.windowID != windowId || !focused || event.key.repeat != 0) return;
|
||||
if (event.type == SDL_KEYDOWN && ModalDialogCapturesInput_nid_postfix()) return;
|
||||
if (event.key.keysym.scancode <= SDL_SCANCODE_UNKNOWN || event.key.keysym.scancode > SDL_SCANCODE_RGUI) return;
|
||||
input.keyCode = static_cast<std::uint16_t>(event.key.keysym.scancode);
|
||||
input.pressed = event.type == SDL_KEYDOWN;
|
||||
|
||||
Reference in new issue
Block a user