diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-11-28 15:30:58 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-11-28 15:30:58 +0800 |
| commit | 268b396afe2f09abfa8813c5f1edc1641a7c0a9f (patch) | |
| tree | cc1b1887c68287c74df7239b94c24335ad3ca9e1 /include/cru/platform/gui/sdl/Window.h | |
| parent | b7c4620007274844669337df703aba206ea6c4d3 (diff) | |
| download | cru-268b396afe2f09abfa8813c5f1edc1641a7c0a9f.tar.gz cru-268b396afe2f09abfa8813c5f1edc1641a7c0a9f.tar.bz2 cru-268b396afe2f09abfa8813c5f1edc1641a7c0a9f.zip | |
Add event handling of sdl native window.
Diffstat (limited to 'include/cru/platform/gui/sdl/Window.h')
| -rw-r--r-- | include/cru/platform/gui/sdl/Window.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/cru/platform/gui/sdl/Window.h b/include/cru/platform/gui/sdl/Window.h index c9d6505b..9947a1b9 100644 --- a/include/cru/platform/gui/sdl/Window.h +++ b/include/cru/platform/gui/sdl/Window.h @@ -4,6 +4,7 @@ #include <cru/platform/GraphicsBase.h> #include <cru/platform/gui/Window.h> +#include <SDL3/SDL_events.h> #include <SDL3/SDL_video.h> #include <optional> @@ -53,6 +54,11 @@ class SdlWindow : public SdlResource, public virtual INativeWindow { */ void SetWindowRect(const Rect& rect) override; + /** + * Note: SDL3 doesn't have an API to solely set focus without raising the + * window. So this method actually calls SDL_RaiseWindow to raise and set + * focus to the window. + */ bool RequestFocus() override; Point GetMousePosition() override; @@ -85,6 +91,8 @@ class SdlWindow : public SdlResource, public virtual INativeWindow { void DoUpdateStyleFlag(); void DoUpdateTitle(); + bool HandleEvent(const SDL_Event* event); + private: SdlUiApplication* application_; SDL_Window* sdl_window_; |
