# HG changeset patch # User Torsten Lilge # Date 1659902370 -7200 # Node ID a44009224387862e77acce7434db67cb81f916ef # Parent 7f4ad92265d2c67e00a0d6eb3af73cfe434a4cbd ensure window decorations when restoring maximized main window (bug #61172) * main-window.cc (set_window_layout): always set geometry to screen geometry when window is maximized at startup and ensure title bar by setting the appropriate window flag diff -r 7f4ad92265d2 -r a44009224387 libgui/src/main-window.cc --- a/libgui/src/main-window.cc Sun Aug 07 10:55:16 2022 +0200 +++ b/libgui/src/main-window.cc Sun Aug 07 21:59:30 2022 +0200 @@ -1592,24 +1592,20 @@ // setting the geometry to the max. available geometry. However, on // X11, the available geometry (excluding task bar etc.) is equal to // the total geometry leading to a full screen mode without window - // decorations. This in turn can be avoided by reducing the max. - // size by a few pixels. - - // Get available geometry for current screen. + // decorations. This in turn can be avoided by explicitly adding + // a title bar in the window flags. + + // Get available geometry for current screen and set this + // window's geometry to it. QScreen *s = windowHandle ()->screen (); QRect av_geom = s->availableGeometry (); - - QList screen_list = QGuiApplication::screens (); - if (screen_list.length () > 1) - { - // If we have more than one monitor and available and total - // geometry are the same, reduce this too large geometry - QRect new_geom (av_geom.x () + 1, av_geom.y () + 1, - av_geom.width ()-2, av_geom.height ()-2); - setGeometry (new_geom); - } - else - setGeometry (av_geom); // Set (correct) available geometry + setGeometry (av_geom); // Set (correct) available geometry + + // Force full title bar + setWindowFlags(Qt::WindowTitleHint + | Qt::WindowMinMaxButtonsHint + | Qt::WindowSystemMenuHint + | Qt::WindowCloseButtonHint); } if (! restoreState (settings->value (mw_state).toByteArray ()))