From 424b9fe843ce44f5f575ad8a94ab27e7afaeb3d3 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Sat, 7 Oct 2017 00:10:57 +0200 Subject: [PATCH] atari:gem: Store iconified state so we do not have to query system on each frame. --- src/video/gem/SDL_gemevents.c | 6 ++++-- src/video/gem/SDL_gemvideo.c | 20 +++++++------------- src/video/gem/SDL_gemvideo.h | 4 +++- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/video/gem/SDL_gemevents.c b/src/video/gem/SDL_gemevents.c index afde7b05f..dbcd40ab6 100644 --- a/src/video/gem/SDL_gemevents.c +++ b/src/video/gem/SDL_gemevents.c @@ -233,7 +233,8 @@ static int do_messages(_THIS, short *message, short latest_msg_id) 0,0); GEM_refresh_name = SDL_FALSE; } - update_work_area = iconified = 1; + GEM_iconified = SDL_TRUE; + update_work_area = 1; break; case WM_UNICONIFY: wind_set (message[3],WF_UNICONIFY,message[4],message[5],message[6],message[7]); @@ -249,6 +250,7 @@ static int do_messages(_THIS, short *message, short latest_msg_id) 0,0); GEM_refresh_name = SDL_FALSE; } + GEM_iconified = SDL_FALSE; update_work_area = 1; break; case WM_SIZED: @@ -288,7 +290,7 @@ static int do_messages(_THIS, short *message, short latest_msg_id) } if (update_work_area) { - GEM_align_work_area(this, message[3], 1, iconified); + GEM_align_work_area(this, message[3], 1); if (sdl_resize) { SDL_PrivateResize(GEM_work_w, GEM_work_h); diff --git a/src/video/gem/SDL_gemvideo.c b/src/video/gem/SDL_gemvideo.c index 5bc8d76c0..7510b4920 100644 --- a/src/video/gem/SDL_gemvideo.c +++ b/src/video/gem/SDL_gemvideo.c @@ -410,6 +410,7 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat) GEM_handle = -1; GEM_locked = SDL_FALSE; GEM_win_fulled = SDL_FALSE; + GEM_iconified = SDL_FALSE; GEM_fullscreen = SDL_FALSE; GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers are setup */ @@ -791,6 +792,8 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, /* Open the window */ wind_open(GEM_handle,x2,y2,w2,h2); + + GEM_iconified = SDL_FALSE; } else { /* Resize window to fit asked video mode */ wind_get (GEM_handle, WF_WORKXYWH, &x2,&y2,&w2,&h2); @@ -799,7 +802,7 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, } } - GEM_align_work_area(this, GEM_handle, 0, 0); + GEM_align_work_area(this, GEM_handle, 0); GEM_fullscreen = SDL_FALSE; } @@ -839,12 +842,12 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, return(current); } -void GEM_align_work_area(_THIS, short windowid, int clear_pads, int iconified) +void GEM_align_work_area(_THIS, short windowid, int clear_pads) { int new_x, new_w; wind_get(windowid, WF_WORKXYWH, &GEM_work_x,&GEM_work_y,&GEM_work_w,&GEM_work_h); - if (iconified) { + if (GEM_iconified) { return; } @@ -1229,17 +1232,8 @@ static void refresh_window(_THIS, int winhandle, short *rect) MFDB mfdb_src; short pxy[8]; SDL_Surface *surface; - int iconified; - - /* Is window iconified ? */ - iconified = 0; -/* if (GEM_wfeatures & (1<hidden->version) #define GEM_wfeatures (this->hidden->wfeatures) #define GEM_win_fulled (this->hidden->window_fulled) +#define GEM_iconified (this->hidden->iconified) #define GEM_mouse_relative (this->hidden->mouse_relative) #define GEM_locked (this->hidden->locked) #define GEM_lock_redraw (this->hidden->lock_redraw)