We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 628

Summary: SDL_VIDEO_WINDOW_POS, Mac OS X, OpenGL
Product: SDL Reporter: Ryan C. Gordon <icculus>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: renesd
Version: 1.2.13Keywords: target-1.2.14
Hardware: PowerPC   
OS: Mac OS X (All)   
Attachments: Reproduction case.

Description Ryan C. Gordon 2008-09-22 03:48:51 UTC
If you try to force the window position with the SDL_VIDEO_WINDOW_POS environment variable, the Quartz backend will incorrectly set the GL viewport and scissor inside a Cocoa call.

Running this under OpenGL Profiler and setting a breakpoint on glScissor shows us this is the culprit:

        [ gl_context setView: window_view ];

...in QZ_SetVideoWindowed().

--ryan.
Comment 1 Ryan C. Gordon 2008-09-22 03:51:16 UTC
Created attachment 280 [details]
Reproduction case.

Attached a test program that illustrates this. The whole window should be red, but just a corner is, due to the incorrect scissoring.

To compile:

  gcc -Wall -O0 -g -o test SDL-test-broken-window-position-opengl.c `sdl-config --cflags --libs` -framework OpenGL

--ryan.
Comment 2 Ryan C. Gordon 2008-09-22 05:59:44 UTC
(Actually, this isn't just the viewport and scissor, it also becomes the mouse area...you get SDL_APPMOUSEFOCUS events as you move in and out of that viewport.)

--ryan.


Comment 3 Rene Dudfield 2009-05-26 23:30:45 UTC
hi,

it seems that SDL_VIDEO_WINDOW_POS doesn't work on OSX.

If I move it off the x coordinate, then shows white screen on the left side of the window by the same amount.  This is with x=300, y=0 for example -- there is white on the window for 300 pixels across.

Moving it on the y axis I get a bus error.


with last stable... SDL 1.2.13,   OSX 10.5.7

Tested with pygame 1.9.0pre.
Comment 4 Rene Dudfield 2009-05-27 00:23:45 UTC
hi again,


It looks like the parent window isn't moved with the main SDL window.

The bus error crashes with SDL_FillRect if I change the y coordinate.

This is the file where SDL_VIDEO_WINDOW_POS is inspected...
src/video/quartz/SDL_QuartzVideo.m


It looks like the patch addresses it using some carbon calls:
   http://www.nabble.com/-patch--OS-X-carbon-SDL_WINDOWID-support-td6457591.html

Haven't tried the patch though.

export SDL_VIDEO_WINDOW_POS="0,0" works ok, since then the parent window doesn't need to be modified... as it starts off at 0,0 by default.

ps.  SDL_VIDEO_CENTERED=1 works fine.
Comment 5 Ryan C. Gordon 2009-09-13 16:33:11 UTC
Tagging this bug with "target-1.2.14" so we can try to resolve it for SDL 1.2.14.

Please note that we may choose to resolve it as WONTFIX. This tag is largely so we have a comprehensive wishlist of bugs to examine for 1.2.14 (and so we can close bugs that we'll never fix, rather than have them live forever in Bugzilla).

--ryan.
Comment 6 Ryan C. Gordon 2009-09-29 06:08:15 UTC
Fixed in svn revision #4890.

--ryan.