mpflanzer/splitshow

Display detection seems broken in version 0.9.8(4) on MacOS 10.11.6

domhardt opened this issue · 3 comments

I had a version 0.9.5(15) compiled in Dec. 2015 that is working fine MacOS 10.11.6 except of the white flash at the begin of every new slide. Today I compiled version 0.9.8(4) and now in the display selection drop down menu the expected entries are missing. Please see attached screenshots!

bildschirmfoto 2017-02-15 um 10 09 32
bildschirmfoto 2017-02-15 um 10 10 21

[UPDATE]
When setting a breakpoint in line 41 of NSScreen+Name.m i could print the description of "displayNames" variable to the console. The output seems correct but the UI won't show it.

bildschirmfoto 2017-02-15 um 10 25 57

I try to fix it. The problem seems to be the local language code. The if-statement contains "en_US" but my local language code is "de_DE"). I separated the or-combined if-statement and my assumption seems right.
bildschirmfoto 2017-02-15 um 10 50 48

[UPDATE]
My actual [NSLocale currentLocale] is "de_AT" BUT displayNames contains the key "de_DE". The use of the local language code is the wrong approach. I will try to use the key from the CFDictionary now.

bildschirmfoto 2017-02-15 um 11 06 31

It seems that I found a solution. This code is a replacement for the lines 40-57 of the file NSScreen+Name.h:

`

if (!displayNames)
{
    CFRelease(displayInfo);
    return NSLocalizedString(@"Unknown", nil);
}
else
{
    //TODO: 'en_US' ISN'T always available!
    NSString *localKey = [[(__bridge NSDictionary*)displayNames allKeys] firstObject];

   if (!CFDictionaryGetValueIfPresent(displayNames, (__bridge const void *)(localKey), (const void**)&displayName))
   {
       CFRelease(displayInfo);
       return NSLocalizedString(@"Unknown", nil);
   }


    if(displayName == NULL)
    {
        CFRelease(displayInfo);
        return NSLocalizedString(@"Unknown", nil);
    }
    else
    {
        NSString *_displayName = [NSString stringWithString:(__bridge NSString*)displayName];
        CFRelease(displayInfo);
        return _displayName;
    }
}

`

Here is the result:
bildschirmfoto 2017-02-15 um 12 19 05

bildschirmfoto 2017-02-15 um 12 20 11

Can someone test it please?

Thanks! I added a fix based on your suggestions. Could you please test if it is fixed for you in the latest version? https://github.com/mpflanzer/splitshow/releases/tag/v0.9.9-alpha

Please reopen if the issue still exists.