Mercurial > octave
changeset 31179:a44009224387
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
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Sun, 07 Aug 2022 21:59:30 +0200 |
parents | 7f4ad92265d2 |
children | 6203e303c5ac |
files | libgui/src/main-window.cc |
diffstat | 1 files changed, 12 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- 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<QScreen *> 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 ()))