Skip to content

[GTK4] Fix GtkWidget warning when updating shell bounds #2422

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

Merged
merged 1 commit into from
Aug 16, 2025
Merged
Changes from all commits
Commits
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 @@ -1856,9 +1856,11 @@ long gtk_size_allocate (long widget, long allocation) {
long display = GDK.gdk_display_get_default();
long monitor = GDK.gdk_display_get_monitor_at_surface(display, paintSurface());
GDK.gdk_monitor_get_geometry(monitor, monitorSize);
long header = GTK4.gtk_widget_get_next_sibling(GTK4.gtk_widget_get_first_child(shellHandle));
long header = GTK4.gtk_window_get_titlebar(shellHandle);
int[] headerNaturalHeight = new int[1];
GTK4.gtk_widget_measure(header, GTK.GTK_ORIENTATION_VERTICAL, -1, null, headerNaturalHeight, null, null);
if (header != 0) {
GTK4.gtk_widget_measure(header, GTK.GTK_ORIENTATION_VERTICAL, 0, null, headerNaturalHeight, null, null);
}
widthA[0] = monitorSize.width;
heightA[0] = monitorSize.height - headerNaturalHeight[0];
}
Expand Down Expand Up @@ -2371,9 +2373,11 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
* On GTK4, GtkWindow size includes the header bar. In order to keep window size allocation of the client area
* consistent with previous versions of SWT, we need to include the header bar height in addition to the given height value.
*/
long header = GTK4.gtk_widget_get_next_sibling(GTK4.gtk_widget_get_first_child(shellHandle));
long header = GTK4.gtk_window_get_titlebar(shellHandle);
int[] headerNaturalHeight = new int[1];
GTK4.gtk_widget_measure(header, GTK.GTK_ORIENTATION_VERTICAL, -1, null, headerNaturalHeight, null, null);
if (header != 0) {
GTK4.gtk_widget_measure(header, GTK.GTK_ORIENTATION_VERTICAL, 0, null, headerNaturalHeight, null, null);
}
GTK.gtk_window_set_default_size(shellHandle, width, height + headerNaturalHeight[0]);
} else {
GTK3.gtk_window_resize (shellHandle, width, height);
Expand Down
Loading