From de43f7da928a5e0010aebe8df1779a5186af75ca Mon Sep 17 00:00:00 2001 From: Amaryllis Kulla Date: Mon, 27 Oct 2025 12:12:55 +0100 Subject: [PATCH 1/2] EventThread: Fix compilation with newer OpenAL headers Should remove the local typedefs eventually. --- src/eventthread.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/eventthread.cpp b/src/eventthread.cpp index 12d7406..9bb59b2 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -40,12 +40,12 @@ #include -typedef void (ALC_APIENTRY *LPALCDEVICEPAUSESOFT) (ALCdevice *device); -typedef void (ALC_APIENTRY *LPALCDEVICERESUMESOFT) (ALCdevice *device); +typedef void (ALC_APIENTRY *_LPALCDEVICEPAUSESOFT) (ALCdevice *device); +typedef void (ALC_APIENTRY *_LPALCDEVICERESUMESOFT) (ALCdevice *device); #define AL_DEVICE_PAUSE_FUN \ - AL_FUN(DevicePause, LPALCDEVICEPAUSESOFT) \ - AL_FUN(DeviceResume, LPALCDEVICERESUMESOFT) + AL_FUN(DevicePause, _LPALCDEVICEPAUSESOFT) \ + AL_FUN(DeviceResume, _LPALCDEVICERESUMESOFT) struct ALCFunctions { From 2f86d9e3d06fbfc77223785f4ab4cc704c360a3b Mon Sep 17 00:00:00 2001 From: Amaryllis Kulla Date: Mon, 27 Oct 2025 12:17:20 +0100 Subject: [PATCH 2/2] Add Graphics#maximize_window Works even if the window is not resizable by user. Requested by matias1lol. --- binding-mri/graphics-binding.cpp | 10 ++++++++++ src/eventthread.cpp | 12 ++++++++++++ src/eventthread.h | 1 + 3 files changed, 23 insertions(+) diff --git a/binding-mri/graphics-binding.cpp b/binding-mri/graphics-binding.cpp index 87cb89c..bcb44b6 100644 --- a/binding-mri/graphics-binding.cpp +++ b/binding-mri/graphics-binding.cpp @@ -209,6 +209,15 @@ RB_METHOD(graphicsResizeWindow) return Qnil; } +RB_METHOD(graphicsMaximizeWindow) +{ + RB_UNUSED_PARAM; + + shState->eThread().requestWindowMaximize(); + + return Qnil; +} + DEF_GRA_PROP_I(FrameRate) DEF_GRA_PROP_I(FrameCount) DEF_GRA_PROP_I(Brightness) @@ -268,4 +277,5 @@ void graphicsBindingInit() INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" ); _rb_define_module_function(module, "resize_window", graphicsResizeWindow); + _rb_define_module_function(module, "maximize_window", graphicsMaximizeWindow); } diff --git a/src/eventthread.cpp b/src/eventthread.cpp index 9bb59b2..8be64df 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -80,6 +80,7 @@ enum { REQUEST_SETFULLSCREEN = 0, REQUEST_WINRESIZE, + REQUEST_WINMAXIMIZE, REQUEST_MESSAGEBOX, REQUEST_SETCURSORVISIBLE, @@ -459,6 +460,10 @@ void EventThread::process(RGSSThreadData &rtData) updateCursorState(cursorInWindow, gameScreen); break; + case REQUEST_WINMAXIMIZE : + SDL_MaximizeWindow(win); + break; + case UPDATE_FPS : if (rtData.config.printFPS) Debug() << "FPS:" << event.user.code; @@ -622,6 +627,13 @@ void EventThread::requestWindowResize(int width, int height, bool recenter) SDL_PushEvent(&event); } +void EventThread::requestWindowMaximize() +{ + SDL_Event event; + event.type = usrIdStart + REQUEST_WINMAXIMIZE; + SDL_PushEvent(&event); +} + void EventThread::requestShowCursor(bool mode) { SDL_Event event; diff --git a/src/eventthread.h b/src/eventthread.h index 2ad7ec6..2352f79 100644 --- a/src/eventthread.h +++ b/src/eventthread.h @@ -89,6 +89,7 @@ public: /* Called from RGSS thread */ void requestFullscreenMode(bool mode); void requestWindowResize(int width, int height, bool recenter = false); + void requestWindowMaximize(); void requestShowCursor(bool mode); void requestTerminate();