Commit 1a7fbfcd authored by Felix Paul Kühne's avatar Felix Paul Kühne

vout_macosx: added HiDPI support

(cherry picked from commit af3a690427169763749987475727b0e37a6b6211)

(cherry picked from commit 405a83cda0fc0f45cd4851bed7cc1d525f6d8fa4)

(cherry picked from commit 4b2e143fa82231ecf563a8cb133edcc0839b4e1f)

(cherry picked from commit de9a7b4f9a61257dff5880b6543f79c13c502aad)

(cherry picked from commit f23389df0f358ec05ed0483a91cd4cfc56f867a5)
parent c6706186
...@@ -12,6 +12,8 @@ Video Output: ...@@ -12,6 +12,8 @@ Video Output:
an ATI Radeon 9200 or a NVIDIA GeForceFX 5200 Ultra. an ATI Radeon 9200 or a NVIDIA GeForceFX 5200 Ultra.
* Fix video output of 10bit encoded contents on Intel-based Macs equipped * Fix video output of 10bit encoded contents on Intel-based Macs equipped
with an Intel GMA 950 chipset running OS X 10.6 or later. with an Intel GMA 950 chipset running OS X 10.6 or later.
* Add support for the HiDPI mode used on recent Apple products with so-called
Retina Displays.
Access: Access:
* Rework Digital TV module for Windows. DVB-T and DVB-C should work again * Rework Digital TV module for Windows. DVB-T and DVB-C should work again
......
...@@ -1375,5 +1375,7 @@ ...@@ -1375,5 +1375,7 @@
<string>VLCApplication</string> <string>VLCApplication</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>10.5.0</string> <string>10.5.0</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict> </dict>
</plist> </plist>
...@@ -52,6 +52,17 @@ ...@@ -52,6 +52,17 @@
- (BOOL)isFullscreen; - (BOOL)isFullscreen;
@end @end
/* compilation support for 10.5 and 10.6 */
#define OSX_LION NSAppKitVersionNumber >= 1115.2
#ifndef MAC_OS_X_VERSION_10_7
@interface NSView (IntroducedInLion)
- (NSRect)convertRectToBacking:(NSRect)aRect;
- (void)setWantsBestResolutionOpenGLSurface:(BOOL)aBool;
@end
#endif
/** /**
* Forward declarations * Forward declarations
*/ */
...@@ -378,7 +389,12 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -378,7 +389,12 @@ static int Control (vout_display_t *vd, int query, va_list ap)
if (!config_GetInt(vd, "macosx-video-autoresize")) if (!config_GetInt(vd, "macosx-video-autoresize"))
{ {
NSRect bounds = [sys->glView bounds]; NSRect bounds;
/* on HiDPI displays, the point bounds don't equal the actual pixel based bounds */
if (OSX_LION)
bounds = [sys->glView convertRectToBacking:[sys->glView bounds]];
else
bounds = [sys->glView bounds];
cfg_tmp.display.width = bounds.size.width; cfg_tmp.display.width = bounds.size.width;
cfg_tmp.display.height = bounds.size.height; cfg_tmp.display.height = bounds.size.height;
} }
...@@ -495,6 +511,10 @@ static void OpenglSwap (vlc_gl_t *gl) ...@@ -495,6 +511,10 @@ static void OpenglSwap (vlc_gl_t *gl)
if (!self) if (!self)
return nil; return nil;
/* enable HiDPI support on OS X 10.7 and later */
if (OSX_LION)
[self setWantsBestResolutionOpenGLSurface:YES];
/* Swap buffers only during the vertical retrace of the monitor. /* Swap buffers only during the vertical retrace of the monitor.
http://developer.apple.com/documentation/GraphicsImaging/ http://developer.apple.com/documentation/GraphicsImaging/
Conceptual/OpenGL/chap5/chapter_5_section_44.html */ Conceptual/OpenGL/chap5/chapter_5_section_44.html */
...@@ -607,7 +627,12 @@ static void OpenglSwap (vlc_gl_t *gl) ...@@ -607,7 +627,12 @@ static void OpenglSwap (vlc_gl_t *gl)
{ {
VLCAssertMainThread(); VLCAssertMainThread();
NSRect bounds = [self bounds]; NSRect bounds;
/* on HiDPI displays, the point bounds don't equal the actual pixel based bounds */
if (OSX_LION)
bounds = [self convertRectToBacking:[self bounds]];
else
bounds = [self bounds];
vout_display_place_t place; vout_display_place_t place;
@synchronized(self) { @synchronized(self) {
...@@ -741,7 +766,11 @@ static void OpenglSwap (vlc_gl_t *gl) ...@@ -741,7 +766,11 @@ static void OpenglSwap (vlc_gl_t *gl)
NSRect s_rect; NSRect s_rect;
BOOL b_inside; BOOL b_inside;
s_rect = [self bounds]; /* on HiDPI displays, the point bounds don't equal the actual pixel based bounds */
if (OSX_LION)
s_rect = [self convertRectToBacking:[self bounds]];
else
s_rect = [self bounds];
ml = [self convertPoint: [o_event locationInWindow] fromView: nil]; ml = [self convertPoint: [o_event locationInWindow] fromView: nil];
b_inside = [self mouse: ml inRect: s_rect]; b_inside = [self mouse: ml inRect: s_rect];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment