Skip to content

Commit

Permalink
MorphOS: Enhanced window iconification
Browse files Browse the repository at this point in the history
no kill window... just put opacity to 0.0
  • Loading branch information
BeWorld2018 committed Nov 10, 2024
1 parent 695f5dd commit 729fee6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
33 changes: 17 additions & 16 deletions src/video/morphos/SDL_mosvideo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/video/morphos/SDL_moswindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/video/morphos/SDL_moswindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 729fee6

Please sign in to comment.