winemac: Add a new registry setting, OpenGLSurfaceMode, to control how GL surfaces...
commit47708c2635dee471a591a3077178b2ec775fcc62
authorKen Thomases <ken@codeweavers.com>
Tue, 15 Sep 2015 01:35:25 +0000 (14 20:35 -0500)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 15 Sep 2015 07:59:03 +0000 (15 16:59 +0900)
treedc95e8ee2b790b9fe9568b74d81c42840b2735ac
parent7e7b4de4b2f5c4f0e23fa870999e0725e1d997b5
winemac: Add a new registry setting, OpenGLSurfaceMode, to control how GL surfaces relate to the window.

The default behavior is that GL surfaces are on top of all non-GL content in
the window.  This maximizes the performance for the common case of games, but
clipping by parents, siblings, and child windows isn't respected.

Setting OpenGLSurfaceMode to "behind" pushes the GL surface to be behind the
Mac window.  The window has transparent holes punched through it so that the GL
surface shows through.  USER32 and the wineserver take care of making sure the
holes are only where the GL windows would be unclipped and unoccluded.  Because
the OS X window server has to composite the GL surface with the window, this
limits the framerate.

Since the Mac driver has no server-side rendering path, GDI rendering to a
window which has a GL surface doesn't work.  As a partial workaround, mostly
for cases where a GL surface is created but never used, setting
OpenGLSurfaceMode to "transparent" allows the GDI rendering to show through the
transparent parts of the GL surface.  The GDI rendering is drawn to the
top-level window's surface as normal.  (The behavior of user32 to exclude the
portion covered by a GL window from GDI rendering is disabled.)  The GL surface
is in front of the window but potentially wholly or partially transparent.  It
is composited with the window behind it.

The GL surface is initially cleared to be completely transparent.  So, if
no GL rendering is done, the window will appear as though the GL surface didn't
exist.
dlls/winemac.drv/cocoa_opengl.m
dlls/winemac.drv/cocoa_window.m
dlls/winemac.drv/macdrv_cocoa.h
dlls/winemac.drv/macdrv_main.c
dlls/winemac.drv/opengl.c