forked from processing/processing4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdifferent.m
More file actions
42 lines (37 loc) · 1.32 KB
/
different.m
File metadata and controls
42 lines (37 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#import <AppKit/AppKit.h>
#import <Cocoa/Cocoa.h>
// #import <JavaNativeFoundation/JavaNativeFoundation.h>
#include <jni.h>
JNIEXPORT void JNICALL Java_processing_core_ThinkDifferent_hideMenuBar
(JNIEnv *env, jclass clazz, jboolean visible, jboolean kioskMode)
{
NSApplicationPresentationOptions options =
NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar;
[NSApp setPresentationOptions:options];
}
JNIEXPORT void JNICALL Java_processing_core_ThinkDifferent_showMenuBar
(JNIEnv *env, jclass clazz, jboolean visible, jboolean kioskMode)
{
[NSApp setPresentationOptions:0];
}
JNIEXPORT void JNICALL Java_processing_core_ThinkDifferent_activateIgnoringOtherApps
(JNIEnv *env, jclass klass)
{
[NSApp activateIgnoringOtherApps:true];
}
JNIEXPORT void JNICALL Java_processing_core_ThinkDifferent_activate
(JNIEnv *env, jclass klass)
{
[NSApp activate];
}
JNIEXPORT jfloat JNICALL Java_processing_core_ThinkDifferent_getScaleFactor
(JNIEnv *env, jclass cls) {
NSArray *screens = [NSScreen screens];
if ([screens count] > 0) {
NSScreen *mainScreen = [screens objectAtIndex:0];
NSDictionary *description = [mainScreen deviceDescription];
NSNumber *scaleFactor = [description objectForKey:NSDeviceResolution];
return [scaleFactor floatValue];
}
return 1.0;
}