atari:gem: Move common code for querying work area and resize of SDL surface at end of function SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Sat, 30 Sep 2017 20:59:18 +0200
branchSDL-1.2
changeset 115579f94ac59f51c
parent 11556 87e99e7708ce
child 11558 560392acace0
atari:gem: Move common code for querying work area and resize of SDL surface at end of function
src/video/gem/SDL_gemevents.c
     1.1 --- a/src/video/gem/SDL_gemevents.c	Sat Sep 30 18:12:41 2017 +0200
     1.2 +++ b/src/video/gem/SDL_gemevents.c	Sat Sep 30 20:59:18 2017 +0200
     1.3 @@ -187,9 +187,9 @@
     1.4  
     1.5  static int do_messages(_THIS, short *message, short latest_msg_id)
     1.6  {
     1.7 -	int quit;
     1.8 +	int quit, update_work_area, sdl_resize;
     1.9  
    1.10 -	quit = 0;
    1.11 +	quit = update_work_area = sdl_resize = 0;
    1.12  	switch (message[0]) {
    1.13  		case MSG_SDL_ID:
    1.14  			quit=(message[1] == latest_msg_id);
    1.15 @@ -201,7 +201,7 @@
    1.16  			break;
    1.17  		case WM_MOVED:
    1.18  			wind_set(message[3],WF_CURRXYWH,message[4],message[5],message[6],message[7]);
    1.19 -			wind_get (message[3], WF_WORKXYWH, &GEM_work_x, &GEM_work_y, &GEM_work_w, &GEM_work_h);
    1.20 +			update_work_area = 1;
    1.21  			break;
    1.22  		case WM_TOPPED:
    1.23  			wind_set(message[3],WF_TOP,message[4],0,0,0);
    1.24 @@ -233,7 +233,7 @@
    1.25  					0,0);
    1.26  				GEM_refresh_name = SDL_FALSE;
    1.27  			}
    1.28 -			wind_get (message[3], WF_WORKXYWH, &GEM_work_x, &GEM_work_y, &GEM_work_w, &GEM_work_h);
    1.29 +			update_work_area = 1;
    1.30  			break;
    1.31  		case WM_UNICONIFY:
    1.32  			wind_set (message[3],WF_UNICONIFY,message[4],message[5],message[6],message[7]);
    1.33 @@ -249,14 +249,13 @@
    1.34  					0,0);
    1.35  				GEM_refresh_name = SDL_FALSE;
    1.36  			}
    1.37 -			wind_get (message[3], WF_WORKXYWH, &GEM_work_x, &GEM_work_y, &GEM_work_w, &GEM_work_h);
    1.38 +			update_work_area = 1;
    1.39  			break;
    1.40  		case WM_SIZED:
    1.41  			wind_set (message[3], WF_CURRXYWH, message[4], message[5], message[6], message[7]);
    1.42 -			wind_get (message[3], WF_WORKXYWH, &GEM_work_x, &GEM_work_y, &GEM_work_w, &GEM_work_h);
    1.43 +			update_work_area = sdl_resize = 1;
    1.44  			GEM_win_fulled = SDL_FALSE;		/* Cancel maximized flag */
    1.45  			GEM_lock_redraw = SDL_TRUE;		/* Prevent redraw till buffers resized */
    1.46 -			SDL_PrivateResize(GEM_work_w, GEM_work_h);
    1.47  			break;
    1.48  		case WM_FULLED:
    1.49  			{
    1.50 @@ -273,9 +272,8 @@
    1.51  					GEM_win_fulled = SDL_TRUE;
    1.52  				}
    1.53  				wind_set (message[3], WF_CURRXYWH, x, y, w, h);
    1.54 -				wind_get (message[3], WF_WORKXYWH, &GEM_work_x, &GEM_work_y, &GEM_work_w, &GEM_work_h);
    1.55 +				update_work_area = sdl_resize = 1;
    1.56  				GEM_lock_redraw = SDL_TRUE;		/* Prevent redraw till buffers resized */
    1.57 -				SDL_PrivateResize(GEM_work_w, GEM_work_h);
    1.58  			}
    1.59  			break;
    1.60  		case WM_BOTTOMED:
    1.61 @@ -289,6 +287,13 @@
    1.62  			break;
    1.63  	}
    1.64  
    1.65 +	if (update_work_area) {
    1.66 +		wind_get (message[3], WF_WORKXYWH, &GEM_work_x, &GEM_work_y, &GEM_work_w, &GEM_work_h);
    1.67 +		if (sdl_resize) {
    1.68 +			SDL_PrivateResize(GEM_work_w, GEM_work_h);
    1.69 +		}
    1.70 +	}
    1.71 +
    1.72  	return quit;
    1.73  }
    1.74