wayland: bad window position when unmaximized for the first time
Affected version
- Mutter version: 43.2 on Arch Linux and latest main branch version when I write this (3ce4d20f).
- OS: Arch Linux
- Only concerns Wayland
Bug summary
Some apps (eg: nautilus or firefox) start their main window directly in the maximized state especially when the user has closed the window in the maximized state last time. These windows get bad position when unmaximized for the first time by the user on Wayland. My tests are done with the GTK "Getting started" example:
#include <gtk/gtk.h>
static void
activate (GtkApplication* app,
gpointer user_data)
{
GtkWidget *window;
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
gtk_window_maximize(GTK_WINDOW(window));
gtk_widget_show (window);
}
int
main (int argc,
char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
Steps to reproduce
- Compile the GTK example with
gcc testgtk.c $(pkg-config --libs --cflags gtk4) -o testgtk
- Run
./testgtk
, the app directly starts in maximized state - Double-click on the titlebar to trigger the unmaximization
What happened
If org.gnome.mutter.center-new-windows
is set to false
, the window will go in position (0,0) so in the top left corner.
If org.gnome.mutter.center-new-windows
is set to true
, the top left corner of the window will go in the center of the screen.
What did you expect to happen
In the 2 cases, I expect the window go at the same position that the window would have taken if it had been launched in the unmaximized state (with the gtk_window_maximize
line commented).
Relevant logs, screenshots, screencasts etc.
Started unmaximized, with center-new-windows = false
.
Started maximized, then unmaximized, with center-new-windows = false
.
Started unmaximized, with center-new-windows = true
.
Started maximized, then unmaximized, with center-new-windows = true
.