comparison src/video/cybergfx/SDL_cgxmodes.c @ 255:dcb5e869f8b5

Updated Amiga port by Gabriele Greco
author Sam Lantinga <slouken@libsdl.org>
date Sun, 16 Dec 2001 20:00:27 +0000
parents e8157fcb3114
children c9b51268668f
comparison
equal deleted inserted replaced
254:4fc12b8edf74 255:dcb5e869f8b5
1 /* 1 /*
2 SDL - Simple DirectMedia Layer 2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga 3 Copyright (C) 1997, 1998, 1999, 2000 Sam Lantinga
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
64 else 64 else
65 UnlockPubScreen(NULL,SDL_Display); 65 UnlockPubScreen(NULL,SDL_Display);
66 } 66 }
67 SDL_Display=GFX_Display=OpenScreenTags(NULL,SA_Width,width,SA_Height,height, 67 SDL_Display=GFX_Display=OpenScreenTags(NULL,SA_Width,width,SA_Height,height,
68 SA_Depth,depth,SA_DisplayID,idok, 68 SA_Depth,depth,SA_DisplayID,idok,
69 SA_ShowTitle,FALSE,
69 TAG_DONE); 70 TAG_DONE);
70 } 71 }
71 } 72 }
72 73
73 static void get_real_resolution(_THIS, int* w, int* h) 74 static void get_real_resolution(_THIS, int* w, int* h)
74 { 75 {
75 *w = SDL_Display->Width; 76 *w = /*SDL_Display->Width*/ SDL_Window->Width-SDL_Window->BorderLeft-SDL_Window->BorderRight;
76 *h = SDL_Display->Height; 77 *h = /*SDL_Display->Height*/ SDL_Window->Height-SDL_Window->BorderBottom-SDL_Window->BorderTop;
77 } 78 }
78 79
79 static void move_cursor_to(_THIS, int x, int y) 80 static void move_cursor_to(_THIS, int x, int y)
80 { 81 {
81 /* XWarpPointer(SDL_Display, None, SDL_Root, 0, 0, 0, 0, x, y); */ 82 /* XWarpPointer(SDL_Display, None, SDL_Root, 0, 0, 0, 0, x, y); */
142 nmodes++; 143 nmodes++;
143 144
144 SDL_modelist = (SDL_Rect **)realloc(SDL_modelist,(nmodes+1)*sizeof(SDL_Rect *)); 145 SDL_modelist = (SDL_Rect **)realloc(SDL_modelist,(nmodes+1)*sizeof(SDL_Rect *));
145 SDL_modelist[nmodes]=NULL; 146 SDL_modelist[nmodes]=NULL;
146 147
147 if ( SDL_modelist ) 148 if ( SDL_modelist )
148 { 149 {
149 SDL_modelist[nmodes-1] = (SDL_Rect *)malloc(sizeof(SDL_Rect)); 150 SDL_modelist[nmodes-1] = (SDL_Rect *)malloc(sizeof(SDL_Rect));
150 151
151 if ( SDL_modelist[nmodes-1] == NULL ) 152 if ( SDL_modelist[nmodes-1] == NULL )
152 break; 153 break;
153 154
154 SDL_modelist[nmodes-1]->x = 0; 155 SDL_modelist[nmodes-1]->x = 0;
155 SDL_modelist[nmodes-1]->y = 0; 156 SDL_modelist[nmodes-1]->y = 0;
156 SDL_modelist[nmodes-1]->w = info.Nominal.MaxX+1; 157 SDL_modelist[nmodes-1]->w = info.Nominal.MaxX+1;
157 SDL_modelist[nmodes-1]->h = info.Nominal.MaxY+1; 158 SDL_modelist[nmodes-1]->h = info.Nominal.MaxY+1;
158 } 159 }
159 } 160 }
160 } 161 }
161 } 162 }
162 } 163 }
163 nextid=NextDisplayInfo(nextid); 164 nextid=NextDisplayInfo(nextid);
164 } 165 }
265 } 266 }
266 267
267 int CGX_EnterFullScreen(_THIS) 268 int CGX_EnterFullScreen(_THIS)
268 { 269 {
269 int okay; 270 int okay;
271 Uint32 saved_flags;
270 272
271 okay = 1; 273 okay = 1;
272 if ( ! currently_fullscreen ) 274 saved_flags = this->screen->flags;
275
276 if ( ! currently_fullscreen )
273 { 277 {
274 int real_w, real_h; 278 int real_w, real_h;
275 279
276 /* Map the fullscreen window to blank the screen */ 280 /* Map the fullscreen window to blank the screen */
277 get_real_resolution(this, &real_w, &real_h); 281 get_real_resolution(this, &real_w, &real_h);
278 282
279 CGX_DestroyWindow(this,this->screen); 283 CGX_DestroyWindow(this,this->screen);
280 set_best_resolution(this, real_w,real_h); 284 set_best_resolution(this, real_w,real_h);
281 285
282 /* Grab the mouse on the fullscreen window 286 /* Grab the mouse on the fullscreen window
283 The event handling will know when we become active, and then 287 The event handling will know when we become active, and then
295 return(0); 299 return(0);
296 } 300 }
297 #endif 301 #endif
298 302
299 currently_fullscreen = 1; 303 currently_fullscreen = 1;
300 304 this->screen->flags = saved_flags;
301 CGX_CreateWindow(this,this->screen,real_w,real_h,GetCyberMapAttr(SDL_Display->RastPort.BitMap,CYBRMATTR_DEPTH),this->screen->flags); 305
306 CGX_CreateWindow(this,this->screen,real_w,real_h,GetCyberMapAttr(SDL_Display->RastPort.BitMap,CYBRMATTR_DEPTH),this->screen->flags);
302 307
303 /* Set the new resolution */ 308 /* Set the new resolution */
304 okay = CGX_ResizeFullScreen(this); 309 okay = CGX_ResizeFullScreen(this);
305 if ( ! okay ) { 310 if ( ! okay ) {
306 CGX_LeaveFullScreen(this); 311 CGX_LeaveFullScreen(this);
309 /* 314 /*
310 if ( SDL_XColorMap ) { 315 if ( SDL_XColorMap ) {
311 XInstallColormap(SDL_Display, SDL_XColorMap); 316 XInstallColormap(SDL_Display, SDL_XColorMap);
312 } 317 }
313 */ 318 */
314 } 319 }
315 // CGX_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN); 320 // CGX_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN);
316 return(okay); 321 return(okay);
317 } 322 }
318 323
319 int CGX_LeaveFullScreen(_THIS) 324 int CGX_LeaveFullScreen(_THIS)