summaryrefslogtreecommitdiffstats
path: root/src/newt/native
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/native')
-rw-r--r--src/newt/native/MacWindow.m6
-rw-r--r--src/newt/native/NewtMacWindow.m22
2 files changed, 19 insertions, 9 deletions
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index 2bd11da3c..e0f8be856 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -48,7 +48,7 @@
#include "timespec.h"
#endif
-static const char * const ClazzNamePoint = "javax/media/nativewindow/util/Point";
+static const char * const ClazzNamePoint = "com/jogamp/nativewindow/util/Point";
static const char * const ClazzAnyCstrName = "<init>";
static const char * const ClazzNamePointCstrSignature = "(II)V";
static jclass pointClz = NULL;
@@ -420,7 +420,7 @@ NS_ENDHANDLER
CGDirectDisplayID NewtScreen_getCGDirectDisplayIDByNSScreen(NSScreen *screen) {
- // Mind: typedef uint32_t CGDirectDisplayID; - however, we assume it's 64bit on 64bit ?!
+ // Mind: typedef uint32_t CGDirectDisplayID;
NSDictionary * dict = [screen deviceDescription];
NSNumber * val = (NSNumber *) [dict objectForKey: @"NSScreenNumber"];
// [NSNumber integerValue] returns NSInteger which is 32 or 64 bit native size
@@ -1401,7 +1401,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_setAlwaysOnTo
/*
* Class: jogamp_newt_driver_macosx_WindowDriver
* Method: getLocationOnScreen0
- * Signature: (JII)Ljavax/media/nativewindow/util/Point;
+ * Signature: (JII)Lcom/jogamp/nativewindow/util/Point;
*/
JNIEXPORT jobject JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_getLocationOnScreen0
(JNIEnv *env, jclass unused, jlong win, jint src_x, jint src_y)
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m
index caf9e54e0..7b3df391d 100644
--- a/src/newt/native/NewtMacWindow.m
+++ b/src/newt/native/NewtMacWindow.m
@@ -784,11 +784,21 @@ static jmethodID windowRepaintID = NULL;
[super viewDidChangeBackingProperties];
// HiDPI scaling
- BOOL useHiDPI = [self wantsBestResolutionOpenGLSurface];
- CGFloat pixelScaleNative = [[self window] backingScaleFactor];
- CGFloat pixelScaleUse = useHiDPI ? pixelScaleNative : 1.0;
- DBG_PRINT("viewDidChangeBackingProperties: PixelScale: HiDPI %d, native %f -> use %f\n", useHiDPI, (float)pixelScaleNative, (float)pixelScaleUse);
- [[self layer] setContentsScale: pixelScaleUse];
+ BOOL useHiDPI = false;
+ CGFloat maxPixelScale = 1.0;
+ CGFloat winPixelScale = 1.0;
+ NSWindow* window = [self window];
+ NSScreen* screen = [window screen];
+NS_DURING
+ maxPixelScale = [screen backingScaleFactor];
+ useHiDPI = [self wantsBestResolutionOpenGLSurface];
+ if( useHiDPI ) {
+ winPixelScale = [window backingScaleFactor];
+ }
+NS_HANDLER
+NS_ENDHANDLER
+ DBG_PRINT("viewDidChangeBackingProperties: PixelScale: HiDPI %d, max %f, window %f\n", useHiDPI, (float)maxPixelScale, (float)winPixelScale);
+ [[self layer] setContentsScale: winPixelScale];
if (javaWindowObject == NULL) {
DBG_PRINT("viewDidChangeBackingProperties: null javaWindowObject\n");
@@ -801,7 +811,7 @@ static jmethodID windowRepaintID = NULL;
return;
}
- (*env)->CallVoidMethod(env, javaWindowObject, updatePixelScaleID, JNI_TRUE, (jfloat)pixelScaleUse, (jfloat)pixelScaleNative); // defer
+ (*env)->CallVoidMethod(env, javaWindowObject, updatePixelScaleID, JNI_TRUE, (jfloat)winPixelScale, (jfloat)maxPixelScale); // defer
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);