diff options
-rw-r--r-- | src/newt/classes/jogamp/newt/ScreenImpl.java | 41 | ||||
-rw-r--r-- | src/newt/native/X11Window.c | 5 |
2 files changed, 31 insertions, 15 deletions
diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java index 61764196f..9c51fe973 100644 --- a/src/newt/classes/jogamp/newt/ScreenImpl.java +++ b/src/newt/classes/jogamp/newt/ScreenImpl.java @@ -311,7 +311,7 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener { if(null == sms) { throw new InternalError("ScreenModeStatus.getScreenModeStatus("+this.getFQName()+") == null"); } - ScreenMode sm0 = getCurrentScreenModeImpl(); + ScreenMode sm0 = getCurrentScreenModeIntern(); if(null == sm0) { throw new InternalError("getCurrentScreenModeImpl() == null"); } @@ -453,21 +453,32 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener { /** * To be implemented by the native specification.<br> * Is called within a thread safe environment.<br> - * Default dummy implementation only set the current screen size, other values are dummy defaults.<br> */ protected ScreenMode getCurrentScreenModeImpl() { - int[] props = new int[ScreenModeUtil.NUM_SCREEN_MODE_PROPERTIES_ALL]; - int i = 0; - props[i++] = 0; // set later for verification of iterator - props[i++] = getWidth(); // width - props[i++] = getHeight(); // height - props[i++] = 32; // bpp - props[i++] = 519; // widthmm - props[i++] = 324; // heightmm - props[i++] = 60; // rate - props[i++] = 0; // rot - props[i - ScreenModeUtil.NUM_SCREEN_MODE_PROPERTIES_ALL] = i; // count - return ScreenModeUtil.streamIn(props, 0); + return null; + } + + /** + * Utilizes {@link #getCurrentScreenModeImpl()}, if the latter returns null it uses + * the current screen size and dummy values. + */ + protected ScreenMode getCurrentScreenModeIntern() { + ScreenMode res = getCurrentScreenModeImpl(); + if(null == res) { + int[] props = new int[ScreenModeUtil.NUM_SCREEN_MODE_PROPERTIES_ALL]; + int i = 0; + props[i++] = 0; // set later for verification of iterator + props[i++] = getWidth(); // width + props[i++] = getHeight(); // height + props[i++] = 32; // bpp + props[i++] = 519; // widthmm + props[i++] = 324; // heightmm + props[i++] = 60; // rate + props[i++] = 0; // rot + props[i - ScreenModeUtil.NUM_SCREEN_MODE_PROPERTIES_ALL] = i; // count + res = ScreenModeUtil.streamIn(props, 0); + } + return res; } /** @@ -485,7 +496,7 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener { sms = ScreenModeStatus.getScreenModeStatus(this.getFQName()); if(null==sms) { IntIntHashMap screenModesIdx2NativeIdx = new IntIntHashMap(); - final ScreenMode currentSM = getCurrentScreenModeImpl(); + final ScreenMode currentSM = getCurrentScreenModeIntern(); if(null == currentSM) { throw new InternalError("getCurrentScreenModeImpl() == null"); } diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c index fcdd28305..28806b652 100644 --- a/src/newt/native/X11Window.c +++ b/src/newt/native/X11Window.c @@ -1159,6 +1159,8 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_X11Screen_getNumScreenModeRes int num_sizes; XRRScreenSize *xrrs = XRRSizes(dpy, (int)scrn_idx, &num_sizes); //get possible screen resolutions + DBG_PRINT("getNumScreenModeResolutions0: %d\n", num_sizes); + return num_sizes; } @@ -1272,6 +1274,8 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_X11Screen_getCurrentScreenRat //free XRRFreeScreenConfigInfo(conf); + DBG_PRINT("getCurrentScreenRate0: %d\n", (int)original_rate); + return (jint) original_rate; } @@ -1330,6 +1334,7 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_X11Screen_getCurrentScreenRes //free XRRFreeScreenConfigInfo(conf); + DBG_PRINT("getCurrentScreenResolutionIndex0: %d\n", (int)original_size_id); return (jint)original_size_id; } |