diff src/video/gem/SDL_gemvideo.c @ 923:2748679027ff

Correctly center window on creation
author Patrice Mandin <patmandin@gmail.com>
date Thu, 05 Aug 2004 19:43:07 +0000
parents 6126849e59a6
children 6e81ce1372d1
line wrap: on
line diff
--- a/src/video/gem/SDL_gemvideo.c	Thu Aug 05 19:40:23 2004 +0000
+++ b/src/video/gem/SDL_gemvideo.c	Thu Aug 05 19:43:07 2004 +0000
@@ -644,20 +644,11 @@
 			modeflags |= SDL_SWSURFACE;
 		}
 	} else {
-		int posx,posy;
 		short x2,y2,w2,h2;
 
 		GEM_UnlockScreen(this);
 
-		/* Center our window */
-		posx = GEM_desk_x;
-		posy = GEM_desk_y;
-		if (width<GEM_desk_w)
-			posx += (GEM_desk_w - width) >> 1;
-		if (height<GEM_desk_h)
-			posy += (GEM_desk_h - height) >> 1;
-
-		/* Calculate our window size and position */
+		/* Set window gadgets */
 		if (!(flags & SDL_NOFRAME)) {
 			GEM_win_type=NAME|MOVER|CLOSER|SMALLER;
 			if (flags & SDL_RESIZABLE) {
@@ -669,14 +660,19 @@
 			modeflags |= SDL_NOFRAME;
 		}
 
-		if (!wind_calc(WC_BORDER, GEM_win_type, posx, posy, width, height, &x2, &y2, &w2, &h2)) {
+		/* Calculate window size */
+		if (!wind_calc(WC_BORDER, GEM_win_type, 0,0,width,height, &x2,&y2,&w2,&h2)) {
 			GEM_FreeBuffers(this);
 			SDL_SetError("Can not calculate window attributes\n");
 			return NULL;
 		}
 
+		/* Center window */
+		x2 = GEM_desk_x+((GEM_desk_w-w2)>>1);
+		y2 = GEM_desk_y+((GEM_desk_h-h2)>>1);
+
 		/* Create window */
-		GEM_handle=wind_create(GEM_win_type, x2, y2, w2, h2);
+		GEM_handle=wind_create(GEM_win_type, x2,y2,w2,h2);
 		if (GEM_handle<0) {
 			GEM_FreeBuffers(this);
 			SDL_SetError("Can not create window\n");