Full screen mode on Mac OS X

Hi.
Is the fullscreen mode on Mac OS X tested?

I found that mouse move events are not translated properly (they give
wrong coordinates) + mouse click events are not generated.

I use SVN version and Intel iMac with Leopard. It is built as private
framework.

The code that enables fullscreen is the next:

uint32 flags = (this->fullscreen ? SDL_WINDOW_FULLSCREEN : 0) |
SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;

//set fullscreen mode
SDL_DisplayMode mode;
mode.w = this->windowwidth;
mode.h = this->windowheight;
mode.refresh_rate = 0;
mode.driverdata = NULL;
mode.format = 0;
if (SDL_SetFullscreenDisplayMode(&mode))
throw std::logic_error(“Cannot set fullscreen mode.”);

//create fullscreen window
this->windowid = SDL_CreateWindow(this->windowtitle.c_str(), 0, 0,
this->windowwidth, this->windowheight, flags);

The window and screen dimensions is 800x600.
The selected renderer is OpenGL.

Maybe somebody sees what is wrong in this code?
I need just a tip about possible cause of errors .

Thank you!

I made an tiny example of this bug.
The project file is XCode 3.1.
http://satorilight.com/SDL_test.zip
It must be linked with latest SDL (compiled as framework).
It switches to 800x600 resolution and logs the mouse move & click events
to standard output.
Please examine Console window after it finished - you will see only
mouse move events but not clicks.
The application is finished with ESC key.

Thank you :slight_smile:

Dmytro Bogovych wrote:> Hi.

Is the fullscreen mode on Mac OS X tested?

I found that mouse move events are not translated properly (they give
wrong coordinates) + mouse click events are not generated.

I use SVN version and Intel iMac with Leopard. It is built as private
framework.

The code that enables fullscreen is the next:

uint32 flags = (this->fullscreen ? SDL_WINDOW_FULLSCREEN : 0) |
SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;

//set fullscreen mode
SDL_DisplayMode mode;
mode.w = this->windowwidth;
mode.h = this->windowheight;
mode.refresh_rate = 0;
mode.driverdata = NULL;
mode.format = 0;
if (SDL_SetFullscreenDisplayMode(&mode))
throw std::logic_error(“Cannot set fullscreen mode.”);

//create fullscreen window
this->windowid = SDL_CreateWindow(this->windowtitle.c_str(), 0, 0,
this->windowwidth, this->windowheight, flags);

The window and screen dimensions is 800x600.
The selected renderer is OpenGL.

Maybe somebody sees what is wrong in this code?
I need just a tip about possible cause of errors .

Thank you!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Found!
Cocoa_PumpEvents :slight_smile:
This function does not handle mouse events - so clicks are not
translated to SDL events…

Plus Cocoa_CreateWindow has a bug.
If SDL_SetFullscreenDisplayMode is called before SDL_CreateWindow and
the new screen resolution is different - the window coordinates will be
calculated in wrong way.
I’m not sure why it happens - looks
CGDisplayPixelsWide(kCGDirectMainDisplay) returns wrong result.

Dmytro Bogovych wrote:

I made an tiny example of this bug.
The project file is XCode 3.1.
http://satorilight.com/SDL_test.zip
It must be linked with latest SDL (compiled as framework).
It switches to 800x600 resolution and logs the mouse move & click events
to standard output.
Please examine Console window after it finished - you will see only
mouse move events but not clicks.
The application is finished with ESC key.

Thank you :slight_smile:

Dmytro Bogovych wrote:

Hi.
Is the fullscreen mode on Mac OS X tested?

[skipped]