aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java42
-rw-r--r--src/newt/native/bcm_vc_iv.c2
2 files changed, 29 insertions, 15 deletions
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 9423949e4..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
@@ -69,46 +69,57 @@ public class WindowDriver extends WindowImpl {
*
* @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) {
+ 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 mod = false;
+ boolean modPos = false;
+ boolean modSize = false;
if( 0 > x ) {
x = 0;
- mod = true;
+ modPos = true;
}
if( 0 > y ) {
y = 0;
- mod = true;
+ modPos = true;
}
if( s_w < x + w ) {
if( 0 < x ) {
x = 0;
- mod = true;
+ modPos = true;
}
if( s_w < w ) {
w = s_w;
- mod = true;
+ modSize = true;
}
}
if( s_h < y + h ) {
if( 0 < y ) {
y = 0;
- mod = true;
+ modPos = true;
}
if( s_h < h ) {
h = s_h;
- mod = true;
+ modSize = true;
}
}
- if( mod ) {
+ 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;
@@ -116,6 +127,13 @@ public class WindowDriver extends WindowImpl {
}
@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()) {
throw new RuntimeException("Window parenting not supported (yet)");
@@ -162,10 +180,8 @@ public class WindowDriver extends WindowImpl {
chosenCaps.setBackgroundOpaque(capsRequested.isBackgroundOpaque());
}
setGraphicsConfiguration(cfg);
- // CreateWindow0 will issue position/size changed event if clamped and required
- final RectangleImmutable rect = clampRect(screen, new Rectangle(getX(), getY(), getWidth(), getHeight()));
nativeWindowHandle = CreateWindow0(display.getBCMHandle(), layer,
- rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight(),
+ getX(), getY(), getWidth(), getHeight(),
chosenCaps.isBackgroundOpaque(), chosenCaps.getAlphaBits());
if (nativeWindowHandle == 0) {
throw new NativeWindowException("Error creating egl window: "+cfg);
@@ -210,7 +226,7 @@ public class WindowDriver extends WindowImpl {
@Override
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) {
- final RectangleImmutable rect = clampRect((ScreenDriver) getScreen(), new Rectangle(x, y, width, height));
+ 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;
diff --git a/src/newt/native/bcm_vc_iv.c b/src/newt/native/bcm_vc_iv.c
index 487941e38..611dd5a4a 100644
--- a/src/newt/native/bcm_vc_iv.c
+++ b/src/newt/native/bcm_vc_iv.c
@@ -402,8 +402,6 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_bcm_vc_iv_WindowDriver_CreateWin
vc_dispmanx_update_submit_sync( dispman_update );
(*env)->CallVoidMethod(env, obj, visibleChangedID, JNI_FALSE, JNI_TRUE); // FIXME: or defer=true ?
- (*env)->CallVoidMethod(env, obj, positionChangedID, JNI_FALSE, x, y); // always report pos-change (clamping)
- (*env)->CallVoidMethod(env, obj, sizeChangedID, JNI_FALSE, width, height, JNI_FALSE); // always report size-change (clamping)
DBG_PRINT( "BCM.Display Window.Create.X %p, element %p\n",
(void*)(intptr_t)dispman_display, (void*)(intptr_t)p->handle);