Commit Graph

25 Commits

Author SHA1 Message Date
Brendan Shanks 7aa2601f94 winemac.drv: Fix warnings for constants deprecated by macOS 10.12.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-27 23:28:16 +02:00
Chip Davis e589516432 winemac.drv: Build with GL_SILENCE_DEPRECATION.
Signed-off-by: Chip Davis <cdavis@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-08 14:58:46 +02:00
Ken Thomases 3deae92a6f winemac: Only call -[NSOpenGLContext update] from the main thread.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-11 22:58:45 +01:00
Ken Thomases 1261589c2c winemac: Only manipulate an NSOpenGLContext's view on the main thread.
I was seeing a crash due to an assert about manipulating it on a
background thread. I can't recall where I was seeing that. I think it's
new in Catalina.

Signed-off-by: Chip Davis <cdavis@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-11 21:51:28 +01:00
Ken Thomases 2128125cbf winemac: Reattach OpenGL contexts to a view after it has been hidden and unhidden.
Hiding a view seems to semi-detach any attached OpenGL contexts such that
rendering no longer works.  There's no GL surface for the view.  Calling
-[NSOpenGLContext update] is not sufficient to reattach the context.  So,
fully detach the contexts and reattach them.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-03 09:35:23 +01:00
Ken Thomases 1c94bf396f winemac: Add support for a high-resolution ("Retina") rendering mode.
When this Retina mode is enabled and the primary display is in the user's
default configuration, Wine gets told that screen and window sizes and mouse
coordinates are twice what Cocoa reports them as in its virtual coordinate
system ("points").  The Windows apps then renders at that high resolution and
the Mac driver blits it to screen.  If the screen is actually a Retina display
in a high-DPI mode, then this extra detail will be preserved.  Otherwise, the
rendering will be downsampled and blurry.

This is intended to be combined with increasing the Windows DPI, as via winecfg.
If that is doubled to 192, then, in theory, graphical elements will remain the
same visual size on screen but be rendered with finer detail.  Unfortunately,
many Windows programs don't correctly handle non-standard DPI so the results
are not always perfect.

The registry setting to enable Retina mode is:

[HKEY_CURRENT_USER\Software\Wine\Mac Driver]
"RetinaMode"="y"

Note that this setting is not looked for in the AppDefaults\<exe name> key
because it doesn't make sense for only some processes in a Wine session to see
the high-resolution sizes and coordinates.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-06 11:45:24 +09:00
Charles Davis 1eeec9513c Revert "winemac.drv: Actually make the GL context current even if no drawables were given.".
This reverts commits 38f579f9ba and
02416314ab.

No extant application uses this, nor are the wined3d maintainers
interested in using it.

Signed-off-by: Charles Davis <cdavis5x@gmail.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-03-01 01:50:06 +09:00
Ken Thomases 38f579f9ba winemac: Simplify and optimize making a GL context current with no view.
If the context is already current, don't do +clearCurrentContext followed by
-makeCurrentContext.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-02-23 20:22:21 +09:00
Charles Davis 02416314ab winemac.drv: Actually make the GL context current even if no drawables were given.
The spec for GL_ARB_framebuffer_object (and thus, OpenGL 3.x and up) is
quite clear on what happens when a context is made current with no
drawable(s). In fact, the WGL_ARB_create_context extension amends
WGL_ARB_make_current_read (as well as the base spec for wglMakeCurrent)
specifically to allow this.

Signed-off-by: Charles Davis <cdavis5x@gmail.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-02-19 11:19:00 +09:00
Ken Thomases 47708c2635 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.
2015-09-15 16:59:03 +09:00
Matteo Bruni e23f70b266 winemac: Make the implementation of clearToBlackIfNeeded compatible with core contexts. 2015-01-08 17:29:04 +01:00
Ken Thomases e21192469d winemac: Make WineOpenGLContext hold a strong reference to its view.
Its superclass, NSOpenGLContext, only holds a weak reference.  The view was
sometimes being deallocated before the context was disposed of, resulting in
crashes.
2014-01-14 11:17:40 +01:00
Ken Thomases 2963a2d4ab winemac: Don't remove an OpenGL context from its view if we're only going to re-add it.
If the context is being made current with its existing view, just update it
before making it current.
2014-01-14 11:17:38 +01:00
Ken Thomases 2cc5337940 winemac: Consolidate code paths for clearing the OpenGL context.
We clear it if the context or the view is NULL.  If the context is non-NULL,
we want to disassociate the views of both the current and passed-in contexts,
if they differ.
2014-01-14 11:17:35 +01:00
Ken Thomases d57a99b482 winemac: When setting a view for an OpenGL context and it is latent, clear any existing view. 2014-01-14 11:17:31 +01:00
Ken Thomases 1896396330 winemac: When clearing the OpenGL context, disassociate it from its view. 2014-01-14 11:17:28 +01:00
Ken Thomases f0c4354a6b winemac: Include the OpenGL headers to fix building on OS X 10.9. 2013-12-03 12:33:44 +01:00
Ken Thomases 4124478b85 winemac: Clear OpenGL views to black the first time a context is attached.
This prevents VRAM garbage from being displayed before the program draws.
2013-11-28 11:16:17 +01:00
Ken Thomases fd04552fe3 winemac: Move test for valid GL drawable into -[WineContentView addGLContext:].
Improves encapsulation.  Avoids a round trip to the main thread.
2013-11-28 11:16:12 +01:00
Ken Thomases 682ed91017 winemac: Defer attaching OpenGL context to a view which is zero-sized or outside its window's bounds.
That fails with the dread "invalid drawable" message.
2013-11-21 13:31:33 +01:00
Ken Thomases 4fba2995b6 winemac: Don't override -[NSOpenGLContext clearDrawable], just use our own method. 2013-03-28 12:19:01 +01:00
Ken Thomases 69e631e04e winemac: Add support for "query" events which wait for synchronous responses. 2013-03-11 10:53:32 +01:00
Ken Thomases 4d51a688e3 winemac: Override -[NSOpenGLContext clearDrawable] to not hide the GL surface.
This fixes a problem with flickering when repeatedly attaching and detaching
a GL context from a window, such as for each WM_PAINT.
2013-03-11 10:44:26 +01:00
Ken Thomases 89a4e5a6d1 winemac: Don't defer attaching OpenGL context to view if it is backed by a window device.
This fixes a problem with certain OpenGL programs which create a context very
briefly before destroying it, like while handling WM_PAINT.
2013-03-11 10:44:13 +01:00
Ken Thomases 3f3ee6393d winemac: Implement OpenGL support. 2013-03-06 12:56:12 +01:00