RFR: Draft: 8316423: [linux] Secondary Stage does not respect Scene's dimensions when shown [v7]
Thiago Milczarek Sayao
tsayao at openjdk.org
Tue Oct 24 22:45:38 UTC 2023
On Sun, 15 Oct 2023 13:25:15 GMT, Thiago Milczarek Sayao <tsayao at openjdk.org> wrote:
>> The bug on the title happens because `gtk_widget_realize()` was called on the constructor. It creates the internal underlying window `GdkWindow` and `XWindow` messing the Gtk expected order. It actually it's probably a Mutter change rather than Gtk. But makes sense to not realize it before expected on the gtk/mutter flow.
>>
>> I moved the code to get the `GdkWindow` to the realize event.
>>
>> Had to change the background function because it's called before realize.
>>
>> The initial **Maximized** and **FullScreen** situations are probably a bug on Mutter [filed here](https://gitlab.gnome.org/GNOME/mutter/-/issues/3092).
>>
>> I could work-around it on this situation, but it would still happen on later focus request.
>>
>>
>> This also fixes [JDK-8316425](https://bugs.openjdk.org/browse/JDK-8316425)
>
> Thiago Milczarek Sayao has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix background
This pure gtk program also reports:
Window is now iconified (minimized).
Window is now de-iconified (unminimized).
Window is now iconified (minimized).
#include <gtk/gtk.h>
// Callback function for handling window state changes
void on_window_state_event(GtkWidget *window, GdkEventWindowState *event, gpointer user_data) {
if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) {
if (event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) {
g_print("Window is now iconified (minimized).\n");
} else {
g_print("Window is now de-iconified (unminimized).\n");
}
}
}
int main(int argc, char *argv[]) {
GtkWidget *window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Iconified Window");
gtk_window_set_default_size(GTK_WINDOW(window), 400, 300);
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
// Connect the callback to the window state event
g_signal_connect(G_OBJECT(window), "window-state-event", G_CALLBACK(on_window_state_event), NULL);
// Start the window iconified (minimized)
gtk_window_iconify(GTK_WINDOW(window));
gtk_widget_show_all(window);
gtk_main();
return 0;
}
`gcc -o testiconified testiconified.c $(pkg-config --cflags --libs gtk+-3.0)`
I would guess it's some X11 requirement to get window properties or something like that.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1249#issuecomment-1778166223
More information about the openjfx-dev
mailing list