[vlc-commits] [Git][videolan/vlc][master] macosx: NSScreen+VLCAdditions: use proper public API

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sat Aug 26 18:11:24 UTC 2023



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
a486f648 by Marvin Scholz at 2023-08-26T17:48:58+00:00
macosx: NSScreen+VLCAdditions: use proper public API

Use the official screensHaveSeparateSpaces API instead of manually
reading User Defaults values, this is more reliable especially as
changing this setting is not immediately applied only after logging
out and back in, so previously we could get the wrong value as it would
immediately update in the User Defaults even when not in effect yet.

- - - - -


1 changed file:

- modules/gui/macosx/extensions/NSScreen+VLCAdditions.m


Changes:

=====================================
modules/gui/macosx/extensions/NSScreen+VLCAdditions.m
=====================================
@@ -29,19 +29,10 @@
 
 static NSMutableArray *blackoutWindows = NULL;
 
-static bool b_old_spaces_style = YES;
-
 + (void)load
 {
     /* init our fake object attribute */
     blackoutWindows = [[NSMutableArray alloc] initWithCapacity:1];
-
-    NSUserDefaults *userDefaults = [[NSUserDefaults alloc] init];
-    [userDefaults addSuiteNamed:@"com.apple.spaces"];
-    /* this is system settings -> mission control -> monitors using different spaces */
-    NSNumber *o_span_displays = [userDefaults objectForKey:@"spans-displays"];
-
-    b_old_spaces_style = [o_span_displays boolValue];
 }
 
 + (NSScreen *)screenWithDisplayID: (CGDirectDisplayID)displayID
@@ -55,7 +46,7 @@ static bool b_old_spaces_style = YES;
 
 - (BOOL)hasMenuBar
 {
-    if (b_old_spaces_style)
+    if ([NSScreen screensHaveSeparateSpaces])
         return ([self displayID] == [[[NSScreen screens] firstObject] displayID]);
     else
         return YES;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/a486f648d76ce0e992594a57edbdc21942e957d7

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/a486f648d76ce0e992594a57edbdc21942e957d7
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list