[vlc-commits] windowed mac plugin: merge NSScreen additions from the minimal macosx module
Felix Paul Kühne
git at videolan.org
Wed Jan 16 02:09:47 CET 2013
npapi-vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Jan 15 20:56:03 2013 +0100| [843cea2c82b7e198dd38758948735e851d75f026] | committer: Felix Paul Kühne
windowed mac plugin: merge NSScreen additions from the minimal macosx module
> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=843cea2c82b7e198dd38758948735e851d75f026
---
npapi/vlcplugin_mac.mm | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/npapi/vlcplugin_mac.mm b/npapi/vlcplugin_mac.mm
index 9745184..c4c600c 100644
--- a/npapi/vlcplugin_mac.mm
+++ b/npapi/vlcplugin_mac.mm
@@ -9,6 +9,7 @@
* Jean-Baptiste Kempf <jb at videolan.org>
* James Bates <james.h.bates at gmail.com>
* Pierre d'Herbemont <pdherbemont # videolan.org>
+ * David Fuhrmann <david dot fuhrmann at googlemail dot com>
*
*
* This program is free software; you can redistribute it and/or modify
@@ -99,6 +100,12 @@
@end
+ at interface NSScreen (VLCAdditions)
+- (BOOL)hasMenuBar;
+- (BOOL)hasDock;
+- (CGDirectDisplayID)displayID;
+ at end
+
static CALayer * rootLayer;
static VLCPlaybackLayer * playbackLayer;
static VLCNoMediaLayer * noMediaLayer;
@@ -736,6 +743,35 @@ static CGImageRef createImageNamed(NSString *name)
@end
+ at implementation NSScreen (VLCAdditions)
+
+- (BOOL)hasMenuBar
+{
+ return ([self displayID] == [[[NSScreen screens] objectAtIndex:0] displayID]);
+}
+
+- (BOOL)hasDock
+{
+ NSRect screen_frame = [self frame];
+ NSRect screen_visible_frame = [self visibleFrame];
+ CGFloat f_menu_bar_thickness = [self hasMenuBar] ? [[NSStatusBar systemStatusBar] thickness] : 0.0;
+
+ BOOL b_found_dock = NO;
+ if (screen_visible_frame.size.width < screen_frame.size.width)
+ b_found_dock = YES;
+ else if (screen_visible_frame.size.height + f_menu_bar_thickness < screen_frame.size.height)
+ b_found_dock = YES;
+
+ return b_found_dock;
+}
+
+- (CGDirectDisplayID)displayID
+{
+ return (CGDirectDisplayID)[[[self deviceDescription] objectForKey: @"NSScreenNumber"] intValue];
+}
+
+ at end
+
@implementation VLCFullscreenWindow
- (id)initWithContentRect:(NSRect)contentRect
More information about the vlc-commits
mailing list