From bcb38d1f284a113a75cef3ae87da79105e27c813 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 25 Jan 2022 09:11:05 -0500 Subject: [PATCH] rewriting to use a tiny Makefile and non-Carbon methods --- build/macos/jAppleMenuBar/Makefile | 7 ++++++ build/macos/jAppleMenuBar/jAppleMenuBar.m | 30 ++++++++++++++--------- 2 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 build/macos/jAppleMenuBar/Makefile diff --git a/build/macos/jAppleMenuBar/Makefile b/build/macos/jAppleMenuBar/Makefile new file mode 100644 index 000000000..0b7f76001 --- /dev/null +++ b/build/macos/jAppleMenuBar/Makefile @@ -0,0 +1,7 @@ +#!/usr/bin/make + + +default: + JAVA_HOME="`/usr/libexec/java_home -v 11`" + gcc -I${JAVA_HOME}/include -I${JAVA_HOME}/include/darwin/ \ + -o libjAppleMenuBar.jnilib -shared jAppleMenuBar.m diff --git a/build/macos/jAppleMenuBar/jAppleMenuBar.m b/build/macos/jAppleMenuBar/jAppleMenuBar.m index 98068d0c1..582e60430 100644 --- a/build/macos/jAppleMenuBar/jAppleMenuBar.m +++ b/build/macos/jAppleMenuBar/jAppleMenuBar.m @@ -1,20 +1,20 @@ /* Part of the jAppleMenuBar - + The MIT License - + Copyright (c) 2011, hansi raber. - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -24,22 +24,28 @@ THE SOFTWARE. */ -#import "jAppleMenuBar.h" +//#import "jAppleMenuBar.h" #import // helper framework for Cocoa and JNI development -#import // helper framework for Cocoa and JNI development +//#import // helper framework for Cocoa and JNI development JNIEXPORT void JNICALL Java_japplemenubar_JAppleMenuBar_setVisible (JNIEnv *env, jclass clazz, jboolean visible, jboolean kioskMode) { - if( visible == JNI_TRUE ){ - SetSystemUIMode(kUIModeNormal, 0); - } - else{ + if (visible == JNI_TRUE) { + //SetSystemUIMode(kUIModeNormal, 0); + NSApplicationPresentationOptions options = + NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar; + [NSApp setPresentationOptions:options]; + + } else { + /* SetSystemUIMode(kUIModeAllHidden, (kioskMode == JNI_TRUE) ? ( kUIOptionDisableAppleMenu | kUIOptionDisableProcessSwitch | kUIOptionDisableForceQuit - | kUIOptionDisableSessionTerminate) : 0); + | kUIOptionDisableSessionTerminate) : 0); + */ + [NSApp setPresentationOptions:0]; } }