Mouse position fixes when in fullscreen mode.

This commit is contained in:
nigel 2003-03-11 11:44:14 +00:00
parent 029178546f
commit bd29aa7a27

View File

@ -268,7 +268,7 @@ static bool add_CGDirectDisplay_modes()
#ifdef MAC_OS_X_VERSION_10_2 #ifdef MAC_OS_X_VERSION_10_2
int32 bytes = getCFint32(modeSpec, kCGDisplayBytesPerRow); int32 bytes = getCFint32(modeSpec, kCGDisplayBytesPerRow);
#else #else
int32 bytes = 0; int32 bytes = 0;
#endif #endif
video_depth depth = DepthModeForPixelDepth(bpp); video_depth depth = DepthModeForPixelDepth(bpp);
@ -649,9 +649,6 @@ OSX_monitor::init_screen(video_mode &mode)
return false; return false;
} }
// For mouse event processing: update screen height
[output startedFullScreen: theDisplay];
the_buffer = CGDisplayBaseAddress(theDisplay); the_buffer = CGDisplayBaseAddress(theDisplay);
if ( ! the_buffer ) if ( ! the_buffer )
{ {
@ -662,11 +659,6 @@ OSX_monitor::init_screen(video_mode &mode)
return false; return false;
} }
D(NSLog(@"Starting full screen mode, height = %d",
CGDisplayPixelsHigh(theDisplay)));
[output startedFullScreen: theDisplay]; // For mouse event processing
if ( mode.bytes_per_row != CGDisplayBytesPerRow(theDisplay) ) if ( mode.bytes_per_row != CGDisplayBytesPerRow(theDisplay) )
{ {
D(bug("Bytes per row (%d) doesn't match current (%ld)\n", D(bug("Bytes per row (%d) doesn't match current (%ld)\n",
@ -680,24 +672,10 @@ OSX_monitor::init_screen(video_mode &mode)
{ {
CGDisplayHideCursor(theDisplay); CGDisplayHideCursor(theDisplay);
// Send real mouse to emulated location [output startedFullScreen: theDisplay];
if ( CGDisplayMoveCursorToPoint(theDisplay, CGPointMake(15,15))
!= CGDisplayNoErr )
{
video_close();
ErrorSheet(@"Could move (jump) cursor on screen", the_win);
return false;
}
// Send emulated mouse to current location // Send emulated mouse to current location
// [output performSelector: @selector(processMouseMove:) [output fullscreenMouseMove];
// withObject: nil
// afterDelay: 7.0];
// NNTimer *moveMouse = [[NNTimer new] retain];
// [moveMouse perform: @selector(processMouseMove:)
// of: output
// after: 3
// units: NNseconds];
} }
else else
{ {
@ -771,9 +749,11 @@ bool VideoInit(bool classic)
case DISPLAY_OPENGL: case DISPLAY_OPENGL:
// Same as window depths and sizes? // Same as window depths and sizes?
case DISPLAY_WINDOW: case DISPLAY_WINDOW:
//add_standard_modes(VDEPTH_1BIT); #ifdef MAC_OS_X_VERSION_SUPPORTS_LOWER_DEPTHS
//add_standard_modes(VDEPTH_8BIT); add_standard_modes(VDEPTH_1BIT);
//add_standard_modes(VDEPTH_16BIT); add_standard_modes(VDEPTH_8BIT);
add_standard_modes(VDEPTH_16BIT);
#endif
add_standard_modes(VDEPTH_32BIT); add_standard_modes(VDEPTH_32BIT);
break; break;
} }
@ -955,13 +935,25 @@ OSX_monitor::switch_to_current_mode(void)
if ( ! failure && if ( ! failure &&
! ( the_buffer = CGDisplayBaseAddress(theDisplay) ) ) ! ( the_buffer = CGDisplayBaseAddress(theDisplay) ) )
failure = "Could not get base address of screen"; failure = "Could not get base address of screen";
else
// Send emulated mouse to current location
[output processMouseMove: nil];
} }
else if ( ! video_open(mode) ) else if ( ! video_open(mode) )
failure = "Could not video_open() requested mode"; failure = "Could not video_open() requested mode";
if ( ! failure && display_type == DISPLAY_SCREEN )
{
// Whenever we change screen resolution, the MacOS mouse starts
// up in the top left corner. Send real mouse to that location
// if ( CGDisplayMoveCursorToPoint(theDisplay, CGPointMake(15,15))
// == CGDisplayNoErr )
// {
//
[output fullscreenMouseMove];
// }
// else
// failure = "Could move (jump) cursor on screen";
}
if ( failure ) if ( failure )
{ {
NSLog(@"In switch_to_current_mode():"); NSLog(@"In switch_to_current_mode():");