Skip to content

Commit

Permalink
atari:gem: Store iconified state so we do not have to query system on…
Browse files Browse the repository at this point in the history
… each frame.
  • Loading branch information
pmandin committed Oct 6, 2017
1 parent 4eac921 commit 424b9fe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
6 changes: 4 additions & 2 deletions src/video/gem/SDL_gemevents.c
Expand Up @@ -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]);
Expand All @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
20 changes: 7 additions & 13 deletions src/video/gem/SDL_gemvideo.c
Expand Up @@ -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 */

Expand Down Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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<<WF_ICONIFY))*/ {
if (wind_get(winhandle, WF_ICONIFY, &pxy[0], &pxy[1], &pxy[2], &pxy[3])!=0) {
iconified = pxy[0];
}
}

if (iconified && GEM_icon) {
if (GEM_iconified && GEM_icon) {
short icon_rect[4], dst_rect[4];
short iconx,icony;

Expand Down
4 changes: 3 additions & 1 deletion src/video/gem/SDL_gemvideo.h
Expand Up @@ -37,7 +37,7 @@ struct WMcursor {

/* Functions prototypes */
void GEM_wind_redraw(_THIS, int winhandle, short *inside);
void GEM_align_work_area(_THIS, short windowid, int clear_pads, int iconified);
void GEM_align_work_area(_THIS, short windowid, int clear_pads);

/* Private display data */

Expand Down Expand Up @@ -84,6 +84,7 @@ struct SDL_PrivateVideoData {
short wfeatures; /* AES window features */
SDL_bool refresh_name; /* Change window title ? */
SDL_bool window_fulled; /* Window maximized ? */
SDL_bool iconified; /* Window iconified ? */
SDL_bool mouse_relative; /* Report relative mouse movement */
SDL_bool locked; /* AES locked for fullscreen ? */
SDL_bool lock_redraw; /* Prevent redraw till buffers are setup */
Expand Down Expand Up @@ -136,6 +137,7 @@ struct SDL_PrivateVideoData {
#define GEM_version (this->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)
Expand Down

0 comments on commit 424b9fe

Please sign in to comment.