-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
10 changed files
with
99 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.github.humbleui.jwm.examples; | ||
|
||
import io.github.humbleui.jwm.*; | ||
import org.jetbrains.skija.*; | ||
|
||
public class PanelTheme extends Panel { | ||
|
||
public PanelTheme(Window window) { | ||
super(window); | ||
} | ||
|
||
@Override | ||
public void paintImpl(Canvas canvas, int width, int height, float scale) { | ||
try (var paint = new Paint()) { | ||
paint.setColor(0xFFFFFFFF); | ||
canvas.drawString("isHighContrast", Example.PADDING, Example.PADDING * 2, Example.FONT12, paint); | ||
canvas.drawString("" + Theme.isHighContrast(), width / 2 + Example.PADDING / 2, Example.PADDING * 2, Example.FONT12, paint); | ||
|
||
canvas.drawString("isDark", Example.PADDING, Example.PADDING * 4, Example.FONT12, paint); | ||
canvas.drawString("" + Theme.isDark(), width / 2 + Example.PADDING / 2, Example.PADDING * 4, Example.FONT12, paint); | ||
|
||
canvas.drawString("isInverted", Example.PADDING, Example.PADDING * 6, Example.FONT12, paint); | ||
canvas.drawString("" + Theme.isInverted(), width / 2 + Example.PADDING / 2, Example.PADDING * 6, Example.FONT12, paint); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#import <Cocoa/Cocoa.h> | ||
#include <jni.h> | ||
|
||
const CFStringRef WhiteOnBlack = CFSTR("whiteOnBlack"); | ||
const CFStringRef UniversalAccessDomain = CFSTR("com.apple.universalaccess"); | ||
|
||
extern "C" JNIEXPORT bool JNICALL Java_io_github_humbleui_jwm_Theme__1nIsHighContrast | ||
(JNIEnv* env, jclass jclass) { | ||
NSWorkspace* workspace = [NSWorkspace sharedWorkspace]; | ||
if ([workspace respondsToSelector:@selector (accessibilityDisplayShouldIncreaseContrast)]) { | ||
return workspace.accessibilityDisplayShouldIncreaseContrast; | ||
} | ||
return false; | ||
} | ||
|
||
extern "C" JNIEXPORT bool JNICALL Java_io_github_humbleui_jwm_Theme__1nIsDark | ||
(JNIEnv* env, jclass jclass) { | ||
if (@available(macOS 10.14, *)) { | ||
NSAppearanceName appearance = [[NSApp effectiveAppearance] bestMatchFromAppearancesWithNames:@[ | ||
NSAppearanceNameAqua, NSAppearanceNameDarkAqua | ||
]]; | ||
return [appearance isEqual:NSAppearanceNameDarkAqua]; | ||
} | ||
return false; | ||
} | ||
|
||
extern "C" JNIEXPORT bool JNICALL Java_io_github_humbleui_jwm_Theme__1nIsInverted | ||
(JNIEnv* env, jclass jclass) { | ||
CFPreferencesAppSynchronize(UniversalAccessDomain); | ||
Boolean keyExistsAndHasValidFormat = false; | ||
Boolean is_inverted = CFPreferencesGetAppBooleanValue(WhiteOnBlack, UniversalAccessDomain, &keyExistsAndHasValidFormat); | ||
if (!keyExistsAndHasValidFormat) | ||
return false; | ||
return is_inverted; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.