atari:gem: Do not change system palette if application does not have focus SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Mon, 09 Oct 2017 21:36:10 +0200
branchSDL-1.2
changeset 11580b28174b10269
parent 11576 b3255371e439
child 11608 850f1a16dc81
atari:gem: Do not change system palette if application does not have focus
src/video/gem/SDL_gemvideo.c
     1.1 --- a/src/video/gem/SDL_gemvideo.c	Sat Oct 07 12:00:04 2017 +0200
     1.2 +++ b/src/video/gem/SDL_gemvideo.c	Mon Oct 09 21:36:10 2017 +0200
     1.3 @@ -1116,7 +1116,7 @@
     1.4  
     1.5  static int GEM_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
     1.6  {
     1.7 -	int i;
     1.8 +	int i, has_input_focus;
     1.9  	SDL_Surface *surface;
    1.10  
    1.11  #ifdef DEBUG_VIDEO_GEM
    1.12 @@ -1129,6 +1129,8 @@
    1.13  		return 1;
    1.14  	}
    1.15  
    1.16 +	has_input_focus = ((SDL_GetAppState() & SDL_APPINPUTFOCUS) == SDL_APPINPUTFOCUS);
    1.17 +
    1.18  	for(i = 0; i < ncolors; i++)
    1.19  	{
    1.20  		int r, g, b;
    1.21 @@ -1142,7 +1144,9 @@
    1.22  		rgb[1] = VDI_curpalette[i][1] = (1000 * g) / 255;
    1.23  		rgb[2] = VDI_curpalette[i][2] = (1000 * b) / 255;
    1.24  
    1.25 -		vs_color(VDI_handle, vdi_index[firstcolor+i], rgb);
    1.26 +		if (has_input_focus) {
    1.27 +			vs_color(VDI_handle, vdi_index[firstcolor+i], rgb);
    1.28 +		}
    1.29  	}
    1.30  
    1.31  	return(1);