Mercurial > sdl-ios-xcode
comparison src/video/bwindow/SDL_sysvideo.cc @ 3878:678576473849 SDL-1.2
Fixed bug #286
Date: Thu, 9 Feb 2006 17:06:51 +0300
From: "Oleg K [BeSman]"
Subject: BeOS SDL patches
Hello all. My name is Oleg K. [BeSman], Im a BeOS user from Russia.This mail
contain a BeOs-specific patches to SDL (implementation of InputGrabbing and
mouse_relative mode). See the source in attached file for details.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 24 Sep 2006 15:31:42 +0000 |
parents | 3a8920cc822b |
children | 4e29535b821b |
comparison
equal
deleted
inserted
replaced
3877:81f66f258d77 | 3878:678576473849 |
---|---|
133 #endif | 133 #endif |
134 /* Window manager functions */ | 134 /* Window manager functions */ |
135 device->SetCaption = BE_SetWMCaption; | 135 device->SetCaption = BE_SetWMCaption; |
136 device->SetIcon = NULL; | 136 device->SetIcon = NULL; |
137 device->IconifyWindow = BE_IconifyWindow; | 137 device->IconifyWindow = BE_IconifyWindow; |
138 device->GrabInput = NULL; | 138 device->GrabInput = BE_GrabInput; |
139 device->GetWMInfo = BE_GetWMInfo; | 139 device->GetWMInfo = BE_GetWMInfo; |
140 /* Cursor manager functions */ | 140 /* Cursor manager functions */ |
141 device->FreeWMCursor = BE_FreeWMCursor; | 141 device->FreeWMCursor = BE_FreeWMCursor; |
142 device->CreateWMCursor = BE_CreateWMCursor; | 142 device->CreateWMCursor = BE_CreateWMCursor; |
143 device->ShowWMCursor = BE_ShowWMCursor; | 143 device->ShowWMCursor = BE_ShowWMCursor; |
144 device->WarpWMCursor = BE_WarpWMCursor; | 144 device->WarpWMCursor = BE_WarpWMCursor; |
145 device->MoveWMCursor = NULL; | 145 device->MoveWMCursor = NULL; |
146 device->CheckMouseMode = NULL; | 146 device->CheckMouseMode = BE_CheckMouseMode; |
147 /* Event manager functions */ | 147 /* Event manager functions */ |
148 device->InitOSKeymap = BE_InitOSKeymap; | 148 device->InitOSKeymap = BE_InitOSKeymap; |
149 device->PumpEvents = BE_PumpEvents; | 149 device->PumpEvents = BE_PumpEvents; |
150 | 150 |
151 device->free = BE_DeleteDevice; | 151 device->free = BE_DeleteDevice; |
363 /* still looking */ | 363 /* still looking */ |
364 } | 364 } |
365 if ( ! modes[i] || (modes[i]->w < width) || (modes[i]->h < width) ) { | 365 if ( ! modes[i] || (modes[i]->w < width) || (modes[i]->h < width) ) { |
366 --i; /* We went too far */ | 366 --i; /* We went too far */ |
367 } | 367 } |
368 width = modes[i]->w; | 368 |
369 height = modes[i]->h; | 369 /* BeSman::We dont want to use a Desktop resolution */ |
370 // width = modes[i]->w; | |
371 // height = modes[i]->h; | |
372 | |
370 bscreen.GetModeList(&dmodes, &nmodes); | 373 bscreen.GetModeList(&dmodes, &nmodes); |
371 for ( i = 0; i < nmodes; ++i ) { | 374 for ( i = 0; i < nmodes; ++i ) { |
372 if ( (bpp == ColorSpaceToBitsPerPixel(dmodes[i].space)) && | 375 if ( (bpp == ColorSpaceToBitsPerPixel(dmodes[i].space)) && |
373 (width == dmodes[i].virtual_width) && | 376 (width == dmodes[i].virtual_width) && |
374 (height == dmodes[i].virtual_height) ) { | 377 (height == dmodes[i].virtual_height) ) { |
431 if ( was_fullscreen && ! fullscreen ) { | 434 if ( was_fullscreen && ! fullscreen ) { |
432 bscreen.SetMode(&saved_mode); | 435 bscreen.SetMode(&saved_mode); |
433 } | 436 } |
434 | 437 |
435 if ( SDL_Win->Lock() ) { | 438 if ( SDL_Win->Lock() ) { |
436 int xoff, yoff; | 439 int cx, cy; |
437 if ( SDL_Win->Shown() ) { | 440 if ( SDL_Win->Shown() ) { |
438 needs_unlock = 1; | 441 needs_unlock = 1; |
439 SDL_Win->Hide(); | 442 SDL_Win->Hide(); |
440 } else { | 443 } else { |
441 needs_unlock = 0; | 444 needs_unlock = 0; |
447 SDL_Win->ResizeTo(width, height); | 450 SDL_Win->ResizeTo(width, height); |
448 bounds = bscreen.Frame(); | 451 bounds = bscreen.Frame(); |
449 /* Calculate offsets - used either to center window | 452 /* Calculate offsets - used either to center window |
450 * (windowed mode) or to set drawing offsets (fullscreen mode) | 453 * (windowed mode) or to set drawing offsets (fullscreen mode) |
451 */ | 454 */ |
452 xoff = (bounds.IntegerWidth() - width)/2; | 455 cx = (bounds.IntegerWidth() - width)/2; |
453 yoff = (bounds.IntegerHeight() - height)/2; | 456 cy = (bounds.IntegerHeight() - height)/2; |
454 if ( fullscreen ) { | 457 |
455 /* Set offset for drawing */ | |
456 SDL_Win->SetXYOffset(xoff, yoff); | |
457 } else { | |
458 /* Center window and reset the drawing offset */ | |
459 SDL_Win->SetXYOffset(0, 0); | |
460 } | |
461 if ( ! needs_unlock || was_fullscreen ) { | 458 if ( ! needs_unlock || was_fullscreen ) { |
462 /* Center the window the first time */ | 459 /* Center the window the first time */ |
463 SDL_Win->MoveTo(xoff > 0 ? (float)xoff : 0.0f, | 460 SDL_Win->MoveTo(cx, cy); |
464 yoff > 0 ? (float)yoff : 0.0f); | |
465 } | 461 } |
466 SDL_Win->Show(); | 462 SDL_Win->Show(); |
467 | 463 |
468 /* Unlock the window manually after the first Show() */ | 464 /* Unlock the window manually after the first Show() */ |
469 if ( needs_unlock ) { | 465 if ( needs_unlock ) { |