npapi-vlc | branch: master | Felix Paul Kühne <[email protected]> | 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 <[email protected]> * James Bates <[email protected]> * 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 +@interface NSScreen (VLCAdditions) +- (BOOL)hasMenuBar; +- (BOOL)hasDock; +- (CGDirectDisplayID)displayID; +@end + static CALayer * rootLayer; static VLCPlaybackLayer * playbackLayer; static VLCNoMediaLayer * noMediaLayer; @@ -736,6 +743,35 @@ static CGImageRef createImageNamed(NSString *name) @end +@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]; +} + +@end + @implementation VLCFullscreenWindow - (id)initWithContentRect:(NSRect)contentRect _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
