1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:57:45 +00:00

Ports/SDL2: Implement a basic keyboard focus

Some SDL applications will not process inputs that they receive without
ensuring that they have the keyboard input focus.
This commit is contained in:
Tim Schumacher 2022-06-10 14:53:20 +02:00 committed by Linus Groh
parent f467ebc933
commit 333429fa47

View file

@ -34,9 +34,9 @@ Co-Authored-By: circl <circl.lastname@gmail.com>
src/video/serenity/SDL_serenitymessagebox.h | 38 + src/video/serenity/SDL_serenitymessagebox.h | 38 +
src/video/serenity/SDL_serenitymouse.cpp | 142 ++++ src/video/serenity/SDL_serenitymouse.cpp | 142 ++++
src/video/serenity/SDL_serenitymouse.h | 39 + src/video/serenity/SDL_serenitymouse.h | 39 +
src/video/serenity/SDL_serenityvideo.cpp | 717 ++++++++++++++++++ src/video/serenity/SDL_serenityvideo.cpp | 720 ++++++++++++++++++
src/video/serenity/SDL_serenityvideo.h | 98 +++ src/video/serenity/SDL_serenityvideo.h | 98 +++
20 files changed, 1411 insertions(+), 29 deletions(-) 20 files changed, 1414 insertions(+), 29 deletions(-)
create mode 100644 src/audio/serenity/SDL_serenityaudio.cpp create mode 100644 src/audio/serenity/SDL_serenityaudio.cpp
create mode 100644 src/audio/serenity/SDL_serenityaudio.h create mode 100644 src/audio/serenity/SDL_serenityaudio.h
create mode 100644 src/video/serenity/SDL_serenityevents.cpp create mode 100644 src/video/serenity/SDL_serenityevents.cpp
@ -879,10 +879,10 @@ index 0000000..039f036
+/* vi: set ts=4 sw=4 expandtab: */ +/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/serenity/SDL_serenityvideo.cpp b/src/video/serenity/SDL_serenityvideo.cpp diff --git a/src/video/serenity/SDL_serenityvideo.cpp b/src/video/serenity/SDL_serenityvideo.cpp
new file mode 100644 new file mode 100644
index 0000000..30fcadb index 0000000..494766f
--- /dev/null --- /dev/null
+++ b/src/video/serenity/SDL_serenityvideo.cpp +++ b/src/video/serenity/SDL_serenityvideo.cpp
@@ -0,0 +1,717 @@ @@ -0,0 +1,720 @@
+/* +/*
+ Simple DirectMedia Layer + Simple DirectMedia Layer
+ Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org> + Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
@ -1396,6 +1396,9 @@ index 0000000..30fcadb
+ return GUI::Window::CloseRequestDecision::Close; + return GUI::Window::CloseRequestDecision::Close;
+ return GUI::Window::CloseRequestDecision::StayOpen; + return GUI::Window::CloseRequestDecision::StayOpen;
+ }; + };
+ w->window()->on_active_input_change = [window](bool is_active_input) {
+ SDL_SetKeyboardFocus(is_active_input ? window : nullptr);
+ };
+ SERENITY_PumpEvents(_this); + SERENITY_PumpEvents(_this);
+ +
+ return 0; + return 0;