summaryrefslogtreecommitdiffstats
path: root/src/newt/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes')
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java81
3 files changed, 81 insertions, 4 deletions
diff --git a/src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java b/src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java
index 24eba6ec1..3586aaa4b 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java
@@ -90,6 +90,8 @@ public class StereoDeviceUtil {
System.err.println("StereoDevice Set Mode: "+newMode);
monitor.setCurrentMode(newMode);
}
+ final MonitorMode queriedMode = monitor.queryCurrentMode();
+ System.err.println("StereoDevice Post-Set Mode: "+queriedMode);
} else {
System.err.println("StereoDevice Keeps Mode: "+currentMode);
}
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
index 3d3fde4d7..d111e850e 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
@@ -40,6 +40,7 @@ import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IOUtil;
import com.jogamp.opengl.egl.EGL;
import com.jogamp.opengl.util.PNGPixelRect;
+import com.jogamp.opengl.GLProfile;
import jogamp.newt.DisplayImpl;
import jogamp.newt.NEWTJNILibLoader;
@@ -52,6 +53,7 @@ public class DisplayDriver extends DisplayImpl {
static {
NEWTJNILibLoader.loadNEWT();
+ GLProfile.initSingleton();
if (!DisplayDriver.initIDs()) {
throw new NativeWindowException("Failed to initialize bcm.vc.iv Display jmethodIDs");
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
index 29c7f9898..93c28d370 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
@@ -37,7 +37,8 @@ import com.jogamp.nativewindow.NativeWindowException;
import com.jogamp.nativewindow.VisualIDHolder;
import com.jogamp.nativewindow.util.Insets;
import com.jogamp.nativewindow.util.Point;
-
+import com.jogamp.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.util.RectangleImmutable;
import com.jogamp.common.util.IntBitfield;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
import com.jogamp.newt.event.MouseEvent;
@@ -63,6 +64,75 @@ public class WindowDriver extends WindowImpl {
windowHandleClose = 0;
}
+ /**
+ * Clamp given rectangle to given screen bounds.
+ *
+ * @param screen
+ * @param rect the {@link RectangleImmutable} in pixel units
+ * @param definePosSize if {@code true} issue {@link #definePosition(int, int)} and {@link #defineSize(int, int)}
+ * if either has changed.
+ * @return If position or size has been clamped a new {@link RectangleImmutable} instance w/ clamped values
+ * will be returned, otherwise the given {@code rect} is returned.
+ */
+ private RectangleImmutable clampRect(final ScreenDriver screen, final RectangleImmutable rect, final boolean definePosSize) {
+ int x = rect.getX();
+ int y = rect.getY();
+ int w = rect.getWidth();
+ int h = rect.getHeight();
+ final int s_w = screen.getWidth();
+ final int s_h = screen.getHeight();
+ boolean modPos = false;
+ boolean modSize = false;
+ if( 0 > x ) {
+ x = 0;
+ modPos = true;
+ }
+ if( 0 > y ) {
+ y = 0;
+ modPos = true;
+ }
+ if( s_w < x + w ) {
+ if( 0 < x ) {
+ x = 0;
+ modPos = true;
+ }
+ if( s_w < w ) {
+ w = s_w;
+ modSize = true;
+ }
+ }
+ if( s_h < y + h ) {
+ if( 0 < y ) {
+ y = 0;
+ modPos = true;
+ }
+ if( s_h < h ) {
+ h = s_h;
+ modSize = true;
+ }
+ }
+ if( modPos || modSize ) {
+ if( definePosSize ) {
+ if( modPos ) {
+ definePosition(x, y);
+ }
+ if( modSize ) {
+ defineSize(w, h);
+ }
+ }
+ return new Rectangle(x, y, w, h);
+ } else {
+ return rect;
+ }
+ }
+
+ @Override
+ protected boolean canCreateNativeImpl() {
+ // clamp if required incl. redefinition of position and size
+ clampRect((ScreenDriver) getScreen(), new Rectangle(getX(), getY(), getWidth(), getHeight()), true);
+ return true; // default: always able to be created
+ }
+
@Override
protected void createNativeImpl() {
if(0!=getParentWindowHandle()) {
@@ -110,7 +180,8 @@ public class WindowDriver extends WindowImpl {
chosenCaps.setBackgroundOpaque(capsRequested.isBackgroundOpaque());
}
setGraphicsConfiguration(cfg);
- nativeWindowHandle = CreateWindow0(display.getBCMHandle(), layer, getX(), getY(), getWidth(), getHeight(),
+ nativeWindowHandle = CreateWindow0(display.getBCMHandle(), layer,
+ getX(), getY(), getWidth(), getHeight(),
chosenCaps.isBackgroundOpaque(), chosenCaps.getAlphaBits());
if (nativeWindowHandle == 0) {
throw new NativeWindowException("Error creating egl window: "+cfg);
@@ -155,7 +226,9 @@ public class WindowDriver extends WindowImpl {
@Override
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) {
- reconfigure0(nativeWindowHandle, x, y, width, height, flags);
+ final RectangleImmutable rect = clampRect((ScreenDriver) getScreen(), new Rectangle(x, y, width, height), false);
+ // reconfigure0 will issue position/size changed events if required
+ reconfigure0(nativeWindowHandle, rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight(), flags);
return true;
}
@@ -174,7 +247,7 @@ public class WindowDriver extends WindowImpl {
final int x, final int y, final short button, final float[] rotationXYZ, final float rotationScale) {
if( MouseEvent.EVENT_MOUSE_MOVED == eventType ) {
final DisplayDriver display = (DisplayDriver) getScreen().getDisplay();
- display.moveActivePointerIcon(x, y);
+ display.moveActivePointerIcon(getX() + x, getY() + y);
}
super.doMouseEvent(enqueue, wait, eventType, modifiers, x, y, button, rotationXYZ, rotationScale);
}