From 729fee69ed9ff2d89fb549b4d7e9492f534d40e4 Mon Sep 17 00:00:00 2001 From: BeWorld <36823759+BeWorld2018@users.noreply.github.com> Date: Sun, 10 Nov 2024 21:30:19 +0100 Subject: [PATCH] MorphOS: Enhanced window iconification no kill window... just put opacity to 0.0 --- src/video/morphos/SDL_mosvideo.c | 33 ++++++++++++++++--------------- src/video/morphos/SDL_moswindow.c | 4 ++-- src/video/morphos/SDL_moswindow.h | 1 + 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/video/morphos/SDL_mosvideo.c b/src/video/morphos/SDL_mosvideo.c index 3ed76b31fb8ec..b70a4308ed438 100644 --- a/src/video/morphos/SDL_mosvideo.c +++ b/src/video/morphos/SDL_mosvideo.c @@ -94,8 +94,13 @@ MOS_HideApp(_THIS, size_t with_app_icon) SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; D("[%s] %siconify\n", __FUNCTION__, with_app_icon ? "" : "no "); - MOS_CloseWindows(_this); - MOS_CloseDisplay(_this); + SDL_WindowData *wd; + ForeachNode(&data->windowlist, wd) + { + struct Window *win = wd->win; + if (win) + MOS_SetWindowOpacity(_this, wd->window, 0.0); + } if (with_app_icon && data->AppIcon) data->AppIconRef = AddAppIconA(0, 0, FilePart(data->FullAppName), &data->WBPort, 0, data->AppIcon, NULL); @@ -118,20 +123,16 @@ MOS_ShowApp(_THIS) ReplyMsg(msg); } - MOS_OpenWindows(_this); - - // force to redraw all window's surface - if (__tglContext) - MOS_GL_ResizeContext(_this, _this->current_glwin); - else { - SDL_WindowData *wd; - ForeachNode(&data->windowlist, wd) { - struct Window *win = wd->win; - if (win) - SDL_UpdateWindowSurface(wd->window); - } - } - + SDL_WindowData *wd; + ForeachNode(&data->windowlist, wd) + { + struct Window *win = wd->win; + if (win) { + MOS_SetWindowOpacity(_this, wd->window, 1.0); + MOS_WindowToFront(win); + } + } + } static int diff --git a/src/video/morphos/SDL_moswindow.c b/src/video/morphos/SDL_moswindow.c index 55baffb2276b5..7e0083013bf15 100644 --- a/src/video/morphos/SDL_moswindow.c +++ b/src/video/morphos/SDL_moswindow.c @@ -185,7 +185,7 @@ MOS_SetupWindowData(_THIS, SDL_Window *window, struct Window *win) D("[%s]\n", __FUNCTION__); SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - SDL_WindowData *wd = SDL_malloc(sizeof(*wd)); + SDL_WindowData *wd = SDL_calloc(1, sizeof(*wd)); if (wd) { window->driverdata = wd; @@ -358,7 +358,7 @@ MOS_SetWindowSize(_THIS, SDL_Window * window) } } -static void +void MOS_WindowToFront(struct Window *win) { D("[%s] wnd 0x%08lx\n", __FUNCTION__, win); diff --git a/src/video/morphos/SDL_moswindow.h b/src/video/morphos/SDL_moswindow.h index 2ed3d46b8ed04..53dbc498e0968 100644 --- a/src/video/morphos/SDL_moswindow.h +++ b/src/video/morphos/SDL_moswindow.h @@ -130,5 +130,6 @@ extern int MOS_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); extern void MOS_CloseWindows(_THIS); extern void MOS_OpenWindows(_THIS); extern void MOS_RecreateWindow(_THIS, SDL_Window * window); +extern void MOS_WindowToFront(struct Window *win); #endif /* _SDL_moswindow_h */