Mercurial > dwindows
comparison mac/dw.m @ 2460:5b401a5cfa90
Mac: Detect the current dark mode state and return DW_DARK_MODE_BASIC if in
automatic mode with light active. Return DW_DARK_MODE_FULL in automatic mode
with dark mode active. Previously it returned DW_FEATURE_ENABLED
(DW_DARK_MODE_BASIC) regardless of the active mode.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 14 Apr 2021 01:58:32 +0000 |
parents | 0315ae3a8820 |
children | 79732eb2deef |
comparison
equal
deleted
inserted
replaced
2459:ddc6d49d1110 | 2460:5b401a5cfa90 |
---|---|
12565 DWRunMutex = dw_mutex_new(); | 12565 DWRunMutex = dw_mutex_new(); |
12566 DWThreadMutex = dw_mutex_new(); | 12566 DWThreadMutex = dw_mutex_new(); |
12567 DWThreadMutex2 = dw_mutex_new(); | 12567 DWThreadMutex2 = dw_mutex_new(); |
12568 #endif | 12568 #endif |
12569 /* Use NSThread to start a dummy thread to initialize the threading subsystem */ | 12569 /* Use NSThread to start a dummy thread to initialize the threading subsystem */ |
12570 NSThread *thread = [[ NSThread alloc] initWithTarget:DWObj selector:@selector(uselessThread:) object:nil]; | 12570 NSThread *thread = [[NSThread alloc] initWithTarget:DWObj selector:@selector(uselessThread:) object:nil]; |
12571 [thread start]; | 12571 [thread start]; |
12572 [thread release]; | 12572 [thread release]; |
12573 [NSTextField setCellClass:[DWTextFieldCell class]]; | 12573 [NSTextField setCellClass:[DWTextFieldCell class]]; |
12574 if(!_dw_app_id[0]) | 12574 if(!_dw_app_id[0]) |
12575 { | 12575 { |
13166 { | 13166 { |
13167 /* Make sure DWApp is initialized */ | 13167 /* Make sure DWApp is initialized */ |
13168 _dw_app_init(); | 13168 _dw_app_init(); |
13169 /* Get the current appearance */ | 13169 /* Get the current appearance */ |
13170 NSAppearance *appearance = [DWApp appearance]; | 13170 NSAppearance *appearance = [DWApp appearance]; |
13171 | 13171 NSAppearanceName basicAppearance; |
13172 | |
13172 if(appearance) | 13173 if(appearance) |
13173 { | 13174 { |
13174 NSAppearanceName basicAppearance = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]]; | 13175 basicAppearance = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, |
13175 | 13176 NSAppearanceNameDarkAqua]]; |
13177 | |
13176 if([basicAppearance isEqualToString:NSAppearanceNameDarkAqua]) | 13178 if([basicAppearance isEqualToString:NSAppearanceNameDarkAqua]) |
13177 return DW_DARK_MODE_FORCED; | 13179 return DW_DARK_MODE_FORCED; |
13178 if([basicAppearance isEqualToString:NSAppearanceNameAqua]) | 13180 if([basicAppearance isEqualToString:NSAppearanceNameAqua]) |
13179 return DW_FEATURE_DISABLED; | 13181 return DW_FEATURE_DISABLED; |
13180 } | 13182 } |
13181 return DW_FEATURE_ENABLED; | 13183 appearance = [NSAppearance currentAppearance]; |
13184 basicAppearance = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, | |
13185 NSAppearanceNameDarkAqua]]; | |
13186 if([basicAppearance isEqualToString:NSAppearanceNameDarkAqua]) | |
13187 return DW_DARK_MODE_FULL; | |
13188 return DW_DARK_MODE_BASIC; | |
13182 } | 13189 } |
13183 return DW_FEATURE_UNSUPPORTED; | 13190 return DW_FEATURE_UNSUPPORTED; |
13184 } | 13191 } |
13185 #endif | 13192 #endif |
13186 default: | 13193 default: |