src/video/windx5/SDL_dx5video.c
changeset 1480 0a2bd6507477
parent 1472 4aac8563c296
child 1523 21b1fbb53f4a
equal deleted inserted replaced
1479:993ef9ff4688 1480:0a2bd6507477
  1121 				SDL_fullscreen_mode = settings;
  1121 				SDL_fullscreen_mode = settings;
  1122 			}
  1122 			}
  1123 		}
  1123 		}
  1124 #endif /* !NO_CHANGEDISPLAYSETTINGS */
  1124 #endif /* !NO_CHANGEDISPLAYSETTINGS */
  1125 
  1125 
  1126 		style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
  1126 		style = GetWindowLong(SDL_Window, GWL_STYLE);
  1127 		style &= ~(resizestyle|WS_MAXIMIZE);
  1127 		style &= ~(resizestyle|WS_MAXIMIZE);
  1128 		if ( video->flags & SDL_FULLSCREEN ) {
  1128 		if ( video->flags & SDL_FULLSCREEN ) {
  1129 			style &= ~windowstyle;
  1129 			style &= ~windowstyle;
  1130 			style |= directstyle;
  1130 			style |= directstyle;
  1131 		} else {
  1131 		} else {
  1146 #endif
  1146 #endif
  1147 		}
  1147 		}
  1148 
  1148 
  1149 		/* DJM: Don't piss of anyone who has setup his own window */
  1149 		/* DJM: Don't piss of anyone who has setup his own window */
  1150 		if ( !SDL_windowid )
  1150 		if ( !SDL_windowid )
  1151 			SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
  1151 			SetWindowLong(SDL_Window, GWL_STYLE, style);
  1152 
  1152 
  1153 		/* Resize the window (copied from SDL WinDIB driver) */
  1153 		/* Resize the window (copied from SDL WinDIB driver) */
  1154 		if ( !SDL_windowid && !IsZoomed(SDL_Window) ) {
  1154 		if ( !SDL_windowid && !IsZoomed(SDL_Window) ) {
  1155 			RECT bounds;
  1155 			RECT bounds;
  1156 			int x, y;
  1156 			int x, y;
  1176 
  1176 
  1177 			bounds.left = SDL_windowX;
  1177 			bounds.left = SDL_windowX;
  1178 			bounds.top = SDL_windowY;
  1178 			bounds.top = SDL_windowY;
  1179 			bounds.right = SDL_windowX+video->w;
  1179 			bounds.right = SDL_windowX+video->w;
  1180 			bounds.bottom = SDL_windowY+video->h;
  1180 			bounds.bottom = SDL_windowY+video->h;
  1181 			AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
  1181 			AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
  1182 			width = bounds.right-bounds.left;
  1182 			width = bounds.right-bounds.left;
  1183 			height = bounds.bottom-bounds.top;
  1183 			height = bounds.bottom-bounds.top;
  1184 			if ( (flags & SDL_FULLSCREEN) ) {
  1184 			if ( (flags & SDL_FULLSCREEN) ) {
  1185 				x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
  1185 				x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
  1186 				y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
  1186 				y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
  1215 		video->flags |= SDL_OPENGL;
  1215 		video->flags |= SDL_OPENGL;
  1216 		return(video);
  1216 		return(video);
  1217 	}
  1217 	}
  1218 
  1218 
  1219 	/* Set the appropriate window style */
  1219 	/* Set the appropriate window style */
  1220 	style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
  1220 	style = GetWindowLong(SDL_Window, GWL_STYLE);
  1221 	style &= ~(resizestyle|WS_MAXIMIZE);
  1221 	style &= ~(resizestyle|WS_MAXIMIZE);
  1222 	if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
  1222 	if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
  1223 		style &= ~windowstyle;
  1223 		style &= ~windowstyle;
  1224 		style |= directstyle;
  1224 		style |= directstyle;
  1225 	} else {
  1225 	} else {
  1237 		if (IsZoomed(SDL_Window)) style |= WS_MAXIMIZE;
  1237 		if (IsZoomed(SDL_Window)) style |= WS_MAXIMIZE;
  1238 #endif
  1238 #endif
  1239 	}
  1239 	}
  1240 	/* DJM: Don't piss of anyone who has setup his own window */
  1240 	/* DJM: Don't piss of anyone who has setup his own window */
  1241 	if ( !SDL_windowid )
  1241 	if ( !SDL_windowid )
  1242 		SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
  1242 		SetWindowLong(SDL_Window, GWL_STYLE, style);
  1243 
  1243 
  1244 	/* Set DirectDraw sharing mode.. exclusive when fullscreen */
  1244 	/* Set DirectDraw sharing mode.. exclusive when fullscreen */
  1245 	if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
  1245 	if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
  1246 		sharemode = DDSCL_FULLSCREEN|DDSCL_EXCLUSIVE|DDSCL_ALLOWREBOOT;
  1246 		sharemode = DDSCL_FULLSCREEN|DDSCL_EXCLUSIVE|DDSCL_ALLOWREBOOT;
  1247 	} else {
  1247 	} else {
  1262 		/* Cover up desktop during mode change */
  1262 		/* Cover up desktop during mode change */
  1263 		bounds.left = 0;
  1263 		bounds.left = 0;
  1264 		bounds.top = 0;
  1264 		bounds.top = 0;
  1265 		bounds.right = GetSystemMetrics(SM_CXSCREEN);
  1265 		bounds.right = GetSystemMetrics(SM_CXSCREEN);
  1266 		bounds.bottom = GetSystemMetrics(SM_CYSCREEN);
  1266 		bounds.bottom = GetSystemMetrics(SM_CYSCREEN);
  1267 		AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
  1267 		AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
  1268 		SetWindowPos(SDL_Window, HWND_TOPMOST,
  1268 		SetWindowPos(SDL_Window, HWND_TOPMOST,
  1269 			bounds.left, bounds.top, 
  1269 			bounds.left, bounds.top, 
  1270 			bounds.right - bounds.left,
  1270 			bounds.right - bounds.left,
  1271 			bounds.bottom - bounds.top, SWP_NOCOPYBITS);
  1271 			bounds.bottom - bounds.top, SWP_NOCOPYBITS);
  1272 		ShowWindow(SDL_Window, SW_SHOW);
  1272 		ShowWindow(SDL_Window, SW_SHOW);
  1579 
  1579 
  1580 			bounds.left = SDL_windowX;
  1580 			bounds.left = SDL_windowX;
  1581 			bounds.top = SDL_windowY;
  1581 			bounds.top = SDL_windowY;
  1582 			bounds.right = SDL_windowX+video->w;
  1582 			bounds.right = SDL_windowX+video->w;
  1583 			bounds.bottom = SDL_windowY+video->h;
  1583 			bounds.bottom = SDL_windowY+video->h;
  1584 			AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
  1584 			AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
  1585 			width = bounds.right-bounds.left;
  1585 			width = bounds.right-bounds.left;
  1586 			height = bounds.bottom-bounds.top;
  1586 			height = bounds.bottom-bounds.top;
  1587 			if ( center ) {
  1587 			if ( center ) {
  1588 				x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
  1588 				x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
  1589 				y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
  1589 				y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;