Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f0881e9
8354943: [Linux] Simplify and update glass gtk backend: window sizing…
tsayao Apr 6, 2026
6d384bf
Merge branch 'master' into 8354943_less_changes
tsayao Apr 6, 2026
511ba53
Use the default width/height if bounds not set
tsayao Apr 6, 2026
b016d8a
Window State is asynchronous
tsayao Apr 6, 2026
878a733
Simplify is_floating
tsayao Apr 6, 2026
1ac06e7
Fix intermittent failures in FullScreenTest
tsayao Apr 6, 2026
49239a6
Fix WrongStageFocusWithApplicationModalityTest
tsayao Apr 8, 2026
c0a8395
- Debug logs per category
tsayao Apr 6, 2026
72f8d38
- Fix missing import
tsayao Apr 9, 2026
d86bc1c
Merge branch '8354943_v2_test2' into 8354943_v2
tsayao Apr 9, 2026
2eef852
Improve log
tsayao Apr 9, 2026
f119a93
Remove idea file
tsayao Apr 9, 2026
c1f15d1
improve get_log_id
tsayao Apr 9, 2026
fa9cfa1
General cleanup
tsayao Apr 9, 2026
3f6af64
General cleanup
tsayao Apr 10, 2026
2bb9fd2
Fix build
tsayao Apr 10, 2026
4af458f
- Improve LOG
tsayao Apr 9, 2026
985bfb4
Minor adjustments
tsayao Apr 18, 2026
db4d084
Polishing
tsayao Apr 18, 2026
28f06be
Rollback some changes
tsayao Apr 20, 2026
c483aba
Fix edge cases
tsayao Apr 20, 2026
530e96a
Avoid nested calls
tsayao Apr 23, 2026
b9aa252
Use safer LOG when debugging is disabled
tsayao Apr 24, 2026
0dbfef2
waitForBoolean does not work for waiting window state as it's applied…
tsayao Apr 24, 2026
4a1a366
- Fix programatic resizing of unresizable stage
tsayao Apr 26, 2026
8b0a57b
Fixes for remaining failing tests
tsayao May 22, 2026
ec0f86a
Merge remote-tracking branch 'origin/8354943_v2' into 8354943_v2
tsayao May 22, 2026
d46f386
Remove file
tsayao May 22, 2026
76094bb
Remove file
tsayao May 22, 2026
9ba7473
Merge branch 'master' into 8354943_v2
tsayao May 22, 2026
ab26bf3
Copyright year
tsayao May 22, 2026
cfcdcb4
StageOwnershipTest: Update Y_DELTA
tsayao May 22, 2026
fece73f
Fix window size update
tsayao May 22, 2026
b9e684c
Use existing verbose flag for GTK
tsayao May 23, 2026
c6b9dd7
Rewrite WrongStageFocusWithApplicationModalityTest because it fails i…
tsayao May 30, 2026
85c0c78
Revert "Rewrite WrongStageFocusWithApplicationModalityTest because it…
tsayao May 30, 2026
9a0f072
Xorg fixes
tsayao May 31, 2026
2609be6
Fix test
tsayao May 31, 2026
68d684f
Remove configurable delays
tsayao May 31, 2026
1fa8185
- Restore gdk_event_request_motions (it's needed even without event c…
tsayao Jun 14, 2026
8fd5515
Do not block sent configure events, as doing so breaks screen-change …
tsayao Jun 14, 2026
91e0ba2
mapped = true for popups
tsayao Jun 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ private static float getFloat(String propname, float defval, String description)
throw new UnsupportedOperationException("Unable to load glass GTK library.");
}

_initGTK(gtkVersion, gtkVersionVerbose, overrideUIScale);
_initGTK(gtkVersion, gtkVersionVerbose, overrideUIScale,
System.getProperty("glass.gtk.logCategories", "all"));

// Embedded in SWT, with shared event thread
boolean isEventThread = Boolean.getBoolean("javafx.embed.isEventThread");
Expand All @@ -186,7 +187,7 @@ private static float getFloat(String propname, float defval, String description)
*/
private static native int _queryLibrary(int version, boolean verbose);

private static native void _initGTK(int version, boolean verbose, float overrideUIScale);
private static native void _initGTK(int version, boolean verbose, float overrideUIScale, String logCategories);

private void initDisplay() {
Map ds = getDeviceDetails();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,13 @@ protected boolean _setVisible(long ptr, boolean visible) {
@Override
protected boolean _minimize(long ptr, boolean minimize) {
minimizeImpl(ptr, minimize);
notifyStateChanged(WindowEvent.MINIMIZE);
return minimize;
}

@Override
protected boolean _maximize(long ptr, boolean maximize,
boolean wasMaximized) {
maximizeImpl(ptr, maximize, wasMaximized);
notifyStateChanged(WindowEvent.MAXIMIZE);
return maximize;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jboolean gtk_verbose = JNI_FALSE;
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkApplication__1initGTK
(JNIEnv *env, jclass clazz, jint version, jboolean verbose, jfloat uiScale)
(JNIEnv *env, jclass clazz, jint version, jboolean verbose, jfloat uiScale, jstring logCategories)
{
(void) clazz;
(void) version;
Expand All @@ -133,6 +133,10 @@ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkApplication__1initGTK
gdk_threads_enter();
gtk_init(NULL, NULL);

const char* categories = env->GetStringUTFChars(logCategories, nullptr);
glass_gtk_log_init(categories);
env->ReleaseStringUTFChars(logCategories, categories);

checkGtkVersion(env, version);
}

Expand Down Expand Up @@ -459,7 +463,7 @@ bool is_window_enabled_for_event(GdkWindow * window, WindowContext *ctx, gint ev
break;
}//switch

if (ctx != NULL ) {
if (ctx != NULL) {
return ctx->isEnabled();
}
return TRUE;
Expand All @@ -484,17 +488,16 @@ static void process_events(GdkEvent* event, gpointer data)

glass_evloop_call_hooks(event);

if (ctx != NULL) {
if (ctx != nullptr) {
try {
switch (event->type) {
case GDK_PROPERTY_NOTIFY:
// let gtk handle it first to prevent a glitch
gtk_main_do_event(event);
ctx->process_property_notify(&event->property);
gtk_main_do_event(event);
break;
case GDK_CONFIGURE:
ctx->process_configure(&event->configure);
gtk_main_do_event(event);
ctx->process_configure(&event->configure);
break;
case GDK_FOCUS_CHANGE:
ctx->process_focus(&event->focus_change);
Expand All @@ -512,8 +515,8 @@ static void process_events(GdkEvent* event, gpointer data)
ctx->process_expose(&event->expose);
break;
case GDK_WINDOW_STATE:
ctx->process_state(&event->window_state);
gtk_main_do_event(event);
ctx->process_state(&event->window_state);
break;
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
Expand Down Expand Up @@ -542,7 +545,8 @@ static void process_events(GdkEvent* event, gpointer data)
process_dnd_target(ctx, &event->dnd);
break;
case GDK_MAP:
// fall-through
ctx->process_map();
break;
case GDK_UNMAP:
case GDK_CLIENT_EVENT:
case GDK_VISIBILITY_NOTIFY:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkRobot__1getScreenCapture
GdkPixbuf *screenshot, *tmp;
GdkWindow *root_window = gdk_get_default_root_window();

tmp = glass_pixbuf_from_window(root_window, x, y, width, height);
tmp = gdk_pixbuf_get_from_window(root_window, x, y, width, height);
if (!tmp) {
return;
}
Expand Down
11 changes: 4 additions & 7 deletions modules/javafx.graphics/src/main/native-glass/gtk/GlassView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_geometry().view_x;
return view->current_window->get_view_position().x;
}
return 0;
}
Expand All @@ -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_geometry().view_y;
return view->current_window->get_view_position().y;
}
return 0;
}
Expand Down Expand Up @@ -269,6 +269,7 @@ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkView__1uploadPixelsByteArray
}
}


/*
* Class: com_sun_glass_ui_gtk_GtkView
* Method: _enterFullscreen
Expand All @@ -284,9 +285,8 @@ JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkView__1enterFullscreen
GlassView* view = JLONG_TO_GLASSVIEW(ptr);
if (view->current_window) {
view->current_window->enter_fullscreen();
env->CallVoidMethod(obj, jViewNotifyView, com_sun_glass_events_ViewEvent_FULLSCREEN_ENTER);
CHECK_JNI_EXCEPTION_RET(env, JNI_FALSE)
}

return JNI_TRUE;
}

Expand All @@ -307,10 +307,7 @@ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkView__1exitFullscreen
} else {
view->current_window->exit_fullscreen();
}
env->CallVoidMethod(obj, jViewNotifyView, com_sun_glass_events_ViewEvent_FULLSCREEN_EXIT);
CHECK_JNI_EXCEPTION(env)
}

}

} // extern "C"
24 changes: 8 additions & 16 deletions modules/javafx.graphics/src/main/native-glass/gtk/GlassWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1createWindow

WindowContext* parent = JLONG_TO_WINDOW_CTX(owner);

WindowContext* ctx = new WindowContextTop(obj,
parent,
screen,
glass_mask_to_window_frame_type(mask),
glass_mask_to_window_type(mask),
glass_mask_to_wm_function(mask)
);
WindowType type = glass_mask_to_window_type(mask);
WindowFrameType frameType = glass_mask_to_window_frame_type(mask);
GdkWMFunction wmFunctions = glass_mask_to_wm_function(mask);

WindowContext* ctx = (frameType == EXTENDED)
? new WindowContextExtended(obj, parent, screen, wmFunctions)
: new WindowContext(obj, parent, screen, frameType, type, wmFunctions);

return PTR_TO_JLONG(ctx);
}
Expand Down Expand Up @@ -409,8 +409,6 @@ JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1setMaximumSize

WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr);
if (w == 0 || h == 0) return JNI_FALSE;
if (w == -1) w = G_MAXSHORT;
if (h == -1) h = G_MAXSHORT;

ctx->set_maximum_size(w, h);
return JNI_TRUE;
Expand Down Expand Up @@ -536,13 +534,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_gtk_GtkWindow__1getNativeWindowImp
(void)obj;

WindowContext* ctx = JLONG_TO_WINDOW_CTX(ptr);
GdkWindow *win = ctx->get_gdk_window();

if (win == NULL) {
return 0;
}

return GDK_WINDOW_XID(win);
return ctx->get_native_window();
}

} // extern "C"
Loading