From 5a2838513b9205b10dd1fdf192ee519e2f7e6163 Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Tue, 3 Sep 2019 23:11:10 +0300 Subject: [PATCH] riscos: implement SDL_WM_IconifyWindow() --- README.RISCOS | 2 +- WhatsNew | 1 + docs.html | 3 +++ src/video/riscos/SDL_wimpvideo.c | 26 +++++++++++++++++++++++++- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.RISCOS b/README.RISCOS index 1ab85984a..28dc301ab 100644 --- a/README.RISCOS +++ b/README.RISCOS @@ -81,7 +81,7 @@ Current level of implementation The following list is an overview of how much of the SDL is implemented. The areas match the main areas of the SDL. video - Mostly done. Doesn't cover gamma, YUV-overlay or OpenGL. -Window Manager - Mostly done. SetIcon/IconifyWindow not implemented. +Window Manager - Mostly done. SetIcon not implemented. Events - Mostly done. Resize and some joystick events missing. Joystick - Currently assumes a single joystick with 4 buttons. Audio - Done diff --git a/WhatsNew b/WhatsNew index 2305808d6..7d0f83d07 100644 --- a/WhatsNew +++ b/WhatsNew @@ -80,6 +80,7 @@ Changes include: - RISC OS: mouse fixes. restore mouse palette when exiting while mouse is in focus. don't reset mouse focus when recreating the window. - RISC OS: support Windows and Menu key input. +- RISC OS: implement SDL_WM_IconifyWindow() - Configuration: fix library detection selecting wrong lib (bug 2795.) - Configuration: fix detecting dynamic library support on powerpc64le (bug 3481.) diff --git a/docs.html b/docs.html index f0a0f08ce..2a6e4dfc3 100644 --- a/docs.html +++ b/docs.html @@ -196,6 +196,9 @@

SDL 1.2.16 Release Notes

RISC OS: support Windows and Menu key input.

+

+ RISC OS: implement SDL_WM_IconifyWindow() +

Configuration: fix library detection selecting wrong lib (bug 2795.)

diff --git a/src/video/riscos/SDL_wimpvideo.c b/src/video/riscos/SDL_wimpvideo.c index 246d736b4..809307889 100644 --- a/src/video/riscos/SDL_wimpvideo.c +++ b/src/video/riscos/SDL_wimpvideo.c @@ -45,6 +45,7 @@ static int WIMP_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors); static void WIMP_SetWMCaption(_THIS, const char *title, const char *icon); +static int WIMP_IconifyWindow(_THIS); static void WIMP_UpdateRects(_THIS, int numrects, SDL_Rect *rects); /* RISC OS Wimp handling helpers */ @@ -194,7 +195,7 @@ void WIMP_SetDeviceMode(_THIS) this->SetCaption = WIMP_SetWMCaption; this->SetIcon = NULL; - this->IconifyWindow = NULL; + this->IconifyWindow = WIMP_IconifyWindow; this->ShowWMCursor = WIMP_ShowWMCursor; this->WarpWMCursor = WIMP_WarpWMCursor; @@ -382,6 +383,29 @@ void WIMP_SetWMCaption(_THIS, const char *title, const char *icon) } } +int WIMP_IconifyWindow(_THIS) +{ + _kernel_swi_regs regs; + + int block[12]; + block[0] = 48; + block[1] = RISCOS_GetTaskHandle(); + block[2] = 0; + block[3] = 0; + block[4] = 0x400ca; /* Message_Iconize */ + block[5] = this->hidden->window_handle; + block[6] = RISCOS_GetTaskHandle(); + + SDL_strlcpy((char *)&block[7], this->hidden->title, 20); + + regs.r[0] = 17; /* User_Message */ + regs.r[1] = (int)block; + regs.r[2] = 0; + _kernel_swi(Wimp_SendMessage, ®s, ®s); + + return 1; +} + /* Toggle to window from full screen */ int WIMP_ToggleFromFullScreen(_THIS) {