summaryrefslogtreecommitdiffstats
path: root/src/newt/native
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-05-26 18:54:27 +0200
committerSven Gothel <[email protected]>2014-05-26 18:54:27 +0200
commit56d60b36798fa8dae48bf2aa5e2de6f3178ab0d1 (patch)
tree4c86190128414205d0b768780e3272e32bd1e81a /src/newt/native
parent98ed02cdb7b325d8afde596a5ef04f97be2018d4 (diff)
Bug 741 HiDPI: Refine Monitor/Screen [virtual] Viewport Definition / Add NEWT Support / Fix JAWT getPixelScale deadlock
- NativeWindow/Surface/NEWT API DOC: Define Coordinate System of Window and Screen - OSXUtil: Add getPixelScale(..) via Screen index and 'windowOrView' - JAWTWindow/JAWTUtil.getPixelScale(..): Use pre-fetched AWT GraphicsConfiguration to solve AWT-TreeLock (deadlock) - [Virtual] Viewport of MonitorDevice and Screen: - Properly calculate and expose [virtual] viewport in window and pixel units - OSX Monitor viewports in pixel units are 'reconstructed' - Window/Viewport to Monitor selection shall be perfomed via window units (unique) - OSX NEWT Window create/init (native): Use given size and coordinates even in fullscreen mode Don't override by quering NSScreen coordinates, trust given values. - Fix test cases, i.e. usage of pixel- and window-units
Diffstat (limited to 'src/newt/native')
-rw-r--r--src/newt/native/MacWindow.m133
-rw-r--r--src/newt/native/NewtMacWindow.h5
-rw-r--r--src/newt/native/NewtMacWindow.m39
-rw-r--r--src/newt/native/ScreenMode.h3
-rw-r--r--src/newt/native/WindowsWindow.c12
-rw-r--r--src/newt/native/X11RandR13.c12
6 files changed, 141 insertions, 63 deletions
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index 25ea47c47..80e70216e 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -366,7 +366,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_DisplayDriver_destroyPoint
[pool release];
}
-static NSScreen * NewtScreen_getNSScreenByIndex(int screen_idx, BOOL cap) {
+NSScreen * NewtScreen_getNSScreenByIndex(int screen_idx, BOOL cap) {
NSArray *screens = [NSScreen screens];
if( screen_idx<0 || screen_idx>=[screens count] ) {
if( cap ) {
@@ -378,7 +378,7 @@ static NSScreen * NewtScreen_getNSScreenByIndex(int screen_idx, BOOL cap) {
return (NSScreen *) [screens objectAtIndex: screen_idx];
}
-static NSScreen * NewtScreen_getNSScreenByCoord(int x, int y) {
+NSScreen * NewtScreen_getNSScreenByCoord(int x, int y) {
NSArray *screens = [NSScreen screens];
int i;
for(i=[screens count]-1; i>=0; i--) {
@@ -394,7 +394,32 @@ static NSScreen * NewtScreen_getNSScreenByCoord(int x, int y) {
return (NSScreen *) [screens objectAtIndex: 0];
}
-static CGDirectDisplayID NewtScreen_getCGDirectDisplayIDByNSScreen(NSScreen *screen) {
+static void NewtScreen_dump() {
+#ifdef VERBOSE_ON
+ NSArray *screens = [NSScreen screens];
+ int i;
+ for(i=0; i<[screens count]; i++) {
+ NSScreen * screen = (NSScreen *) [screens objectAtIndex: i];
+ NSRect screenFrame = [screen frame];
+ NSRect screenVisibleFrame = [screen visibleFrame];
+ CGFloat pixelScale = 1.0; // default
+NS_DURING
+ // Available >= 10.7
+ pixelScale = [screen backingScaleFactor]; // HiDPI scaling
+NS_HANDLER
+NS_ENDHANDLER
+ NSWindowDepth depth = [screen depth]; // an (int) value!
+ DBG_PRINT( "NSScreen #%d (%p): Frame %lf/%lf %lfx%lf (vis %lf/%lf %lfx%lf), scale %lf, depth %d\n",
+ i, screen,
+ screenFrame.origin.x, screenFrame.origin.y, screenFrame.size.width, screenFrame.size.height,
+ screenVisibleFrame.origin.x, screenVisibleFrame.origin.y, screenVisibleFrame.size.width, screenVisibleFrame.size.height,
+ pixelScale, depth);
+ }
+#endif
+}
+
+
+CGDirectDisplayID NewtScreen_getCGDirectDisplayIDByNSScreen(NSScreen *screen) {
// Mind: typedef uint32_t CGDirectDisplayID; - however, we assume it's 64bit on 64bit ?!
NSDictionary * dict = [screen deviceDescription];
NSNumber * val = (NSNumber *) [dict objectForKey: @"NSScreenNumber"];
@@ -428,6 +453,20 @@ static long GetDictionaryLong(CFDictionaryRef theDict, const void* key)
/*
* Class: jogamp_newt_driver_macosx_ScreenDriver
+ * Method: getMonitorCount0
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_jogamp_newt_driver_macosx_ScreenDriver_getMonitorCount0
+ (JNIEnv *env, jobject obj)
+{
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ NSArray *screens = [NSScreen screens];
+ [pool release];
+ return (jint) [screens count];
+}
+
+/*
+ * Class: jogamp_newt_driver_macosx_ScreenDriver
* Method: getMonitorProps0
* Signature: (I)[I
*/
@@ -463,8 +502,16 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_macosx_ScreenDriver_getMonit
fprintf(stderr, "MacScreen_getMonitorProps0.3: %ld ms\n", td_ms); fflush(NULL);
#endif
- CGRect bounds = CGDisplayBounds (display);
-
+ CGRect dBounds = CGDisplayBounds (display); // origin top-left
+#ifdef VERBOSE_ON
+ BOOL usesGL = CGDisplayUsesOpenGLAcceleration(display);
+ NSRect sFrame = [screen frame]; // origin bottom-left
+ DBG_PRINT( "getMonitorProps0: scrn %d, top-left displayBounds[%d/%d %dx%d], bottom-left screenFrame[%d/%d %dx%d], usesGL %d\n", (int)crt_idx,
+ (int)dBounds.origin.x, (int)dBounds.origin.y, (int)dBounds.size.width, (int)dBounds.size.height,
+ (int)sFrame.origin.x, (int)sFrame.origin.y, (int)sFrame.size.width, (int)sFrame.size.height,
+ (int)usesGL);
+#endif
+
jsize propCount = MIN_MONITOR_DEVICE_PROPERTIES - 1 - NUM_MONITOR_MODE_PROPERTIES;
jint prop[ propCount ];
int offset = 0;
@@ -472,10 +519,14 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_macosx_ScreenDriver_getMonit
prop[offset++] = crt_idx;
prop[offset++] = (jint) sizeMM.width;
prop[offset++] = (jint) sizeMM.height;
- prop[offset++] = (jint) bounds.origin.x; // rotated viewport x
- prop[offset++] = (jint) bounds.origin.y; // rotated viewport y
- prop[offset++] = (jint) bounds.size.width; // rotated viewport width
- prop[offset++] = (jint) bounds.size.height; // rotated viewport height
+ prop[offset++] = (jint) dBounds.origin.x; // rotated viewport x (pixel units, will be fixed in java code)
+ prop[offset++] = (jint) dBounds.origin.y; // rotated viewport y (pixel units, will be fixed in java code)
+ prop[offset++] = (jint) dBounds.size.width; // rotated viewport width (pixel units, will be fixed in java code)
+ prop[offset++] = (jint) dBounds.size.height; // rotated viewport height (pixel units, will be fixed in java code)
+ prop[offset++] = (jint) dBounds.origin.x; // rotated viewport x (window units, will be fixed in java code)
+ prop[offset++] = (jint) dBounds.origin.y; // rotated viewport y (window units, will be fixed in java code)
+ prop[offset++] = (jint) dBounds.size.width; // rotated viewport width (window units, will be fixed in java code)
+ prop[offset++] = (jint) dBounds.size.height; // rotated viewport height (window units, will be fixed in java code)
jintArray properties = (*env)->NewIntArray(env, propCount);
if (properties == NULL) {
@@ -503,6 +554,13 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_macosx_ScreenDriver_getMonit
[pool release];
return NULL;
}
+ CGFloat pixelScale = 1.0; // default
+NS_DURING
+ // Available >= 10.7
+ pixelScale = [screen backingScaleFactor]; // HiDPI scaling
+NS_HANDLER
+NS_ENDHANDLER
+
CGDirectDisplayID display = NewtScreen_getCGDirectDisplayIDByNSScreen(screen);
CFArrayRef availableModes = CGDisplayAvailableModes(display);
@@ -516,8 +574,8 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_macosx_ScreenDriver_getMonit
#ifdef VERBOSE_ON
if(0 >= mode_idx) {
// only for current mode (-1) and first mode (scanning)
- DBG_PRINT( "getScreenMode0: scrn %d (%p, %p), mode %d, avail: %d/%d, current rot %d ccw\n",
- (int)crt_idx, screen, (void*)(intptr_t)display, (int)mode_idx, (int)numberOfAvailableModes, (int)numberOfAvailableModesRots, currentCCWRot);
+ DBG_PRINT( "getScreenMode0: scrn %d (s %p, d %p, pscale %lf), mode %d, avail: %d/%d, current rot %d ccw\n",
+ (int)crt_idx, screen, (void*)(intptr_t)display, pixelScale, (int)mode_idx, (int)numberOfAvailableModes, (int)numberOfAvailableModesRots, currentCCWRot);
}
#endif
@@ -543,6 +601,10 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_macosx_ScreenDriver_getMonit
int mWidth = CGDDGetModeWidth(mode);
int mHeight = CGDDGetModeHeight(mode);
+ if( -1 == mode_idx ) {
+ mWidth *= (int)pixelScale; // accomodate HiDPI
+ mHeight *= (int)pixelScale; // accomodate HiDPI
+ }
// swap width and height, since OSX reflects rotated dimension, we don't
if ( 90 == currentCCWRot || 270 == currentCCWRot ) {
@@ -564,7 +626,7 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_macosx_ScreenDriver_getMonit
prop[propIndex++] = 0; // flags
prop[propIndex++] = nativeId;
prop[propIndex++] = ccwRot;
-
+
DBG_PRINT( "getScreenMode0: Mode %d/%d (%d): %dx%d, %d bpp, %d / %d Hz, nativeId %d, rot %d ccw\n",
(int)mode_idx, (int)numberOfAvailableModesRots, (int)numberOfAvailableModes,
(int)prop[1], (int)prop[2], (int)prop[3],
@@ -653,6 +715,8 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_initIDs0
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ NewtScreen_dump();
+
jclass c;
c = (*env)->FindClass(env, ClazzNamePoint);
if(NULL==c) {
@@ -694,21 +758,13 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_createView0
DBG_PRINT( "createView0 - %p (this), %d/%d %dx%d, fs %d (START)\n",
(void*)(intptr_t)jthis, (int)x, (int)y, (int)w, (int)h, (int)fullscreen);
- NSScreen *myScreen = NewtScreen_getNSScreenByCoord(x, y);
- NSRect rectWin;
-
- if (fullscreen) {
- rectWin = [myScreen frame];
- x = 0;
- y = 0;
- w = (jint) (rectWin.size.width);
- h = (jint) (rectWin.size.height);
- } else {
- rectWin = NSMakeRect(x, y, w, h);
- }
-
NSRect rectView = NSMakeRect(0, 0, w, h);
NewtView *myView = [[NewtView alloc] initWithFrame: rectView] ;
+NS_DURING
+ // Available >= 10.7
+ [myView setWantsBestResolutionOpenGLSurface: YES]; // HiDPI scaling: Always desired
+NS_HANDLER
+NS_ENDHANDLER
DBG_PRINT( "createView0.X - new view: %p\n", myView);
[pool release];
@@ -735,19 +791,10 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_createWindow
(int)styleMask, (int)bufferingType, myView);
(void)myView;
- NSScreen *myScreen = NewtScreen_getNSScreenByCoord(x, y);
-
- NSRect rectWin;
if (fullscreen) {
styleMask = NSBorderlessWindowMask;
- rectWin = [myScreen frame];
- x = 0;
- y = 0;
- w = (jint) (rectWin.size.width);
- h = (jint) (rectWin.size.height);
- } else {
- rectWin = NSMakeRect(x, y, w, h);
}
+ NSRect rectWin = NSMakeRect(x, y, w, h);
// Allocate the window
NewtMacWindow* myWindow = [[NewtMacWindow alloc] initWithContentRect: rectWin
@@ -772,7 +819,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_createWindow
* Signature: (JJIIIIZZZJ)V
*/
JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_initWindow0
- (JNIEnv *env, jobject jthis, jlong parent, jlong window, jint x, jint y, jint w, jint h,
+ (JNIEnv *env, jobject jthis, jlong parent, jlong window, jint x, jint y, jint w, jint h,
jboolean opaque, jboolean visible, jlong jview)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -784,19 +831,6 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_initWindow0
(void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, (int)x, (int)y, (int)w, (int)h,
(int) opaque, (int)fullscreen, (int)visible, myView);
- NSScreen *myScreen = NewtScreen_getNSScreenByCoord(x, y);
-
- NSRect rectWin;
- if (fullscreen) {
- rectWin = [myScreen frame];
- x = 0;
- y = 0;
- w = (jint) (rectWin.size.width);
- h = (jint) (rectWin.size.height);
- } else {
- rectWin = NSMakeRect(x, y, w, h);
- }
-
[myWindow setReleasedWhenClosed: NO]; // We control NSWindow destruction!
[myWindow setPreservesContentDuringLiveResize: NO];
NS_DURING
@@ -927,6 +961,7 @@ NS_DURING
* Shall have no penalty on modern GPU and is also recommended, see bottom box @
* <https://developer.apple.com/library/mac/documentation/graphicsimaging/Conceptual/QuartzDisplayServicesConceptual/Articles/DisplayCapture.html>
*
+ NSScreen *myScreen = NewtScreen_getNSScreenByCoord(x, y);
if ( [myView respondsToSelector:@selector(enterFullScreenMode:withOptions:)] ) {
// Available >= 10.5 - Makes the menubar disapear
[myView enterFullScreenMode: myScreen withOptions:NULL];
diff --git a/src/newt/native/NewtMacWindow.h b/src/newt/native/NewtMacWindow.h
index 8f6362ac2..0f80df2d7 100644
--- a/src/newt/native/NewtMacWindow.h
+++ b/src/newt/native/NewtMacWindow.h
@@ -49,6 +49,10 @@
// #define DBG_LIFECYCLE 1
+NSScreen * NewtScreen_getNSScreenByIndex(int screen_idx, BOOL cap);
+NSScreen * NewtScreen_getNSScreenByCoord(int x, int y);
+CGDirectDisplayID NewtScreen_getCGDirectDisplayIDByNSScreen(NSScreen *screen);
+
@interface NewtView : NSView
{
jobject javaWindowObject;
@@ -129,6 +133,7 @@
- (void) handleFlagsChanged:(int) keyMask keyIndex: (int) keyIdx keyCode: (int) keyCode modifiers: (NSUInteger) mods;
- (void) sendKeyEvent: (NSEvent*) event eventType: (jshort) evType;
- (void) sendKeyEvent: (jshort) keyCode characters: (NSString*) chars modifiers: (NSUInteger)mods eventType: (jshort) evType;
+- (void) viewDidChangeBackingProperties;
@end
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m
index b4133ac7e..1a70de445 100644
--- a/src/newt/native/NewtMacWindow.m
+++ b/src/newt/native/NewtMacWindow.m
@@ -174,6 +174,7 @@ static jmethodID requestFocusID = NULL;
static jmethodID insetsChangedID = NULL;
static jmethodID sizeChangedID = NULL;
+static jmethodID updatePixelScaleID = NULL;
static jmethodID visibleChangedID = NULL;
static jmethodID positionChangedID = NULL;
static jmethodID focusChangedID = NULL;
@@ -330,8 +331,8 @@ static jmethodID windowRepaintID = NULL;
NSRect viewFrame = [self frame];
(*env)->CallVoidMethod(env, javaWindowObject, windowRepaintID, JNI_TRUE, // defer ..
- dirtyRect.origin.x, viewFrame.size.height - dirtyRect.origin.y,
- dirtyRect.size.width, dirtyRect.size.height);
+ (int)dirtyRect.origin.x, (int)viewFrame.size.height - (int)dirtyRect.origin.y,
+ (int)dirtyRect.size.width, (int)dirtyRect.size.height);
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
@@ -761,6 +762,31 @@ static jmethodID windowRepaintID = NULL;
// NewtCommon_ReleaseJNIEnv(shallBeDetached);
}
+- (void)viewDidChangeBackingProperties
+{
+ [super viewDidChangeBackingProperties];
+
+ CGFloat pixelScale = [[self window] backingScaleFactor];
+ [[self layer] setContentsScale: pixelScale];
+
+ if (javaWindowObject == NULL) {
+ DBG_PRINT("viewDidChangeBackingProperties: null javaWindowObject\n");
+ return;
+ }
+ int shallBeDetached = 0;
+ JNIEnv* env = NewtCommon_GetJNIEnv(1 /* asDaemon */, &shallBeDetached);
+ if(NULL==env) {
+ DBG_PRINT("viewDidChangeBackingProperties: null JNIEnv\n");
+ return;
+ }
+
+ (*env)->CallVoidMethod(env, javaWindowObject, updatePixelScaleID, JNI_TRUE, (jfloat)pixelScale); // defer
+
+ // detaching thread not required - daemon
+ // NewtCommon_ReleaseJNIEnv(shallBeDetached);
+}
+
+
@end
@implementation NewtMacWindow
@@ -769,7 +795,8 @@ static jmethodID windowRepaintID = NULL;
{
enqueueMouseEventID = (*env)->GetMethodID(env, clazz, "enqueueMouseEvent", "(ZSIIISF)V");
enqueueKeyEventID = (*env)->GetMethodID(env, clazz, "enqueueKeyEvent", "(ZSISCC)V");
- sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(ZIIZ)V");
+ sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(ZIIZ)V");
+ updatePixelScaleID = (*env)->GetMethodID(env, clazz, "updatePixelScale", "(ZF)V");
visibleChangedID = (*env)->GetMethodID(env, clazz, "visibleChanged", "(ZZ)V");
insetsChangedID = (*env)->GetMethodID(env, clazz, "insetsChanged", "(ZIIII)V");
positionChangedID = (*env)->GetMethodID(env, clazz, "screenPositionChanged", "(ZII)V");
@@ -777,7 +804,7 @@ static jmethodID windowRepaintID = NULL;
windowDestroyNotifyID = (*env)->GetMethodID(env, clazz, "windowDestroyNotify", "(Z)Z");
windowRepaintID = (*env)->GetMethodID(env, clazz, "windowRepaint", "(ZIIII)V");
requestFocusID = (*env)->GetMethodID(env, clazz, "requestFocus", "(Z)V");
- if (enqueueMouseEventID && enqueueKeyEventID && sizeChangedID && visibleChangedID && insetsChangedID &&
+ if (enqueueMouseEventID && enqueueKeyEventID && sizeChangedID && updatePixelScaleID && visibleChangedID && insetsChangedID &&
positionChangedID && focusChangedID && windowDestroyNotifyID && requestFocusID && windowRepaintID)
{
CKCH_CreateDictionaries();
@@ -824,10 +851,12 @@ static jmethodID windowRepaintID = NULL;
// Why is this necessary? Without it we don't get any of the
// delegate methods like resizing and window movement.
[self setDelegate: self];
+
cachedInsets[0] = 0; // l
cachedInsets[1] = 0; // r
cachedInsets[2] = 0; // t
cachedInsets[3] = 0; // b
+
realized = YES;
DBG_PRINT("NewtWindow::create: %p, realized %d, hasPresentationSwitch %d[defaultOptions 0x%X, fullscreenOptions 0x%X], (refcnt %d)\n",
res, realized, (int)hasPresentationSwitch, (int)defaultPresentationOptions, (int)fullscreenPresentationOptions, (int)[res retainCount]);
@@ -1123,7 +1152,7 @@ static jmethodID windowRepaintID = NULL;
NSRect frameRect = [self frame];
NSRect contentRect = [self contentRectForFrameRect: frameRect];
- (*env)->CallVoidMethod(env, javaWindowObject, sizeChangedID, JNI_FALSE,
+ (*env)->CallVoidMethod(env, javaWindowObject, sizeChangedID, JNI_TRUE, // defer
(jint) contentRect.size.width,
(jint) contentRect.size.height, JNI_FALSE);
}
diff --git a/src/newt/native/ScreenMode.h b/src/newt/native/ScreenMode.h
index 110f1c493..56c424b11 100644
--- a/src/newt/native/ScreenMode.h
+++ b/src/newt/native/ScreenMode.h
@@ -40,7 +40,8 @@
#define NUM_MONITOR_MODE_PROPERTIES_ALL 8 /* count + the above */
-#define MIN_MONITOR_DEVICE_PROPERTIES 11 /* count + id, ScreenSizeMM[width, height], rotated Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+ */
+#define MIN_MONITOR_DEVICE_PROPERTIES 15 /* count + id, ScreenSizeMM[width, height], rotated Viewport pixel-units, rotated Viewport pixel-units, currentMonitorModeId, rotation, supportedModeId+ */
+ /* Viewport := [x, y, width, height] (4 elements) */
#define FLAG_INTERLACE ( 1 << 0 )
#define FLAG_DOUBLESCAN ( 1 << 1 )
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index c20e156c1..70d0c6f83 100644
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -1859,10 +1859,14 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_windows_ScreenDriver_getMoni
prop[propIndex++] = monitor_idx;
prop[propIndex++] = widthmm;
prop[propIndex++] = heightmm;
- prop[propIndex++] = dm.dmPosition.x; // rotated viewport
- prop[propIndex++] = dm.dmPosition.y; // rotated viewport
- prop[propIndex++] = dm.dmPelsWidth; // rotated viewport
- prop[propIndex++] = dm.dmPelsHeight; // rotated viewport
+ prop[propIndex++] = dm.dmPosition.x; // rotated viewport pixel units
+ prop[propIndex++] = dm.dmPosition.y; // rotated viewport pixel units
+ prop[propIndex++] = dm.dmPelsWidth; // rotated viewport pixel units
+ prop[propIndex++] = dm.dmPelsHeight; // rotated viewport pixel units
+ prop[propIndex++] = dm.dmPosition.x; // rotated viewport window units (same)
+ prop[propIndex++] = dm.dmPosition.y; // rotated viewport window units (same)
+ prop[propIndex++] = dm.dmPelsWidth; // rotated viewport window units (same)
+ prop[propIndex++] = dm.dmPelsHeight; // rotated viewport window units (same)
jintArray properties = (*env)->NewIntArray(env, propCount);
if (properties == NULL) {
diff --git a/src/newt/native/X11RandR13.c b/src/newt/native/X11RandR13.c
index 92c20e893..4e92a32b4 100644
--- a/src/newt/native/X11RandR13.c
+++ b/src/newt/native/X11RandR13.c
@@ -426,10 +426,14 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_RandR13_getMonitorDevice
prop[propIndex++] = crt_idx;
prop[propIndex++] = xrrOutputInfo->mm_width;
prop[propIndex++] = xrrOutputInfo->mm_height;
- prop[propIndex++] = xrrCrtcInfo->x;
- prop[propIndex++] = xrrCrtcInfo->y;
- prop[propIndex++] = xrrCrtcInfo->width;
- prop[propIndex++] = xrrCrtcInfo->height;
+ prop[propIndex++] = xrrCrtcInfo->x; // rotated viewport pixel units
+ prop[propIndex++] = xrrCrtcInfo->y; // rotated viewport pixel units
+ prop[propIndex++] = xrrCrtcInfo->width; // rotated viewport pixel units
+ prop[propIndex++] = xrrCrtcInfo->height; // rotated viewport pixel units
+ prop[propIndex++] = xrrCrtcInfo->x; // rotated viewport window units (same)
+ prop[propIndex++] = xrrCrtcInfo->y; // rotated viewport window units (same)
+ prop[propIndex++] = xrrCrtcInfo->width; // rotated viewport window units (same)
+ prop[propIndex++] = xrrCrtcInfo->height; // rotated viewport window units (same)
prop[propIndex++] = xrrCrtcInfo->mode; // current mode id
prop[propIndex++] = NewtScreen_XRotation2Degree(env, xrrCrtcInfo->rotation);
int i;