Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8260528: Clean glass-gtk sizing and positioning code #367

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -200,22 +200,8 @@ public long getNativeWindow() {
protected void _setBounds(long ptr, int x, int y, boolean xSet, boolean ySet, int w, int h, int cw, int ch, float xGravity, float yGravity) {
_setGravity(ptr, xGravity, yGravity);
setBoundsImpl(ptr, x, y, xSet, ySet, w, h, cw, ch);

if ((w <= 0) && (cw > 0) || (h <= 0) && (ch > 0)) {
final int[] extarr = new int[4];
getFrameExtents(ptr, extarr);

// TODO: ((w <= 0) && (cw <= 0)) || ((h <= 0) && (ch <= 0))
notifyResize(WindowEvent.RESIZE,
((w <= 0) && (cw > 0)) ? cw + extarr[0] + extarr[1]
: w,
((h <= 0) && (ch > 0)) ? ch + extarr[2] + extarr[3]
: h);
}
}

private native void getFrameExtents(long ptr, int[] extarr);

@Override
protected void _requestInput(long ptr, String text, int type, double width, double height,
double Mxx, double Mxy, double Mxz, double Mxt,
@@ -102,7 +102,7 @@ JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkView__1getX

GlassView* view = JLONG_TO_GLASSVIEW(ptr);
if (view && view->current_window) {
return view->current_window->get_frame_extents().left;
return view->current_window->get_geometry().extents.left;
}
return 0;
}
@@ -120,7 +120,7 @@ JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkView__1getY

GlassView* view = JLONG_TO_GLASSVIEW(ptr);
if (view && view->current_window) {
return view->current_window->get_frame_extents().top;
return view->current_window->get_geometry().extents.top;
}
return 0;
}
@@ -599,14 +599,6 @@ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkWindow_getFrameExtents
(JNIEnv * env, jobject obj, jlong ptr, jintArray extarr)
{
(void)obj;

WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr);
WindowFrameExtents extents = ctx->get_frame_extents();

env->SetIntArrayRegion(extarr, 0, 1, &extents.left);
env->SetIntArrayRegion(extarr, 1, 1, &extents.right);
env->SetIntArrayRegion(extarr, 2, 1, &extents.top);
env->SetIntArrayRegion(extarr, 3, 1, &extents.bottom);
}

/*
ProTip! Use n and p to navigate between commits in a pull request.