Commit 68f1505d authored by Ahmad Samir's avatar Ahmad Samir Committed by Kurt Hindenburg
Browse files

Don't resize window when switching virtual desktops in OpenBox

It looks like switching virtual desktops in OpenBox invokes a show event
(this doesn't happen while running Plasma).

The code in MainWindow::showEvent() should only be run once on first show,
so guard it with a bool member.

BUG: 441610
FIXED-IN: 21.08.1
parent afcffe4a
......@@ -67,8 +67,7 @@ MainWindow::MainWindow() :
_toggleMenuBarAction(nullptr),
_newTabMenuAction(nullptr),
_pluggedController(nullptr),
_menuBarInitialVisibility(true),
_menuBarInitialVisibilityApplied(false)
_menuBarInitialVisibility(true)
{
KSharedConfigPtr konsoleConfig = KSharedConfig::openConfig(QStringLiteral("konsolerc"));
KConfigGroup cg = konsoleConfig->group(QStringLiteral("MainWindow"));
......@@ -943,16 +942,15 @@ void MainWindow::setRemoveWindowTitleBarAndFrame(bool frameless)
void MainWindow::showEvent(QShowEvent *event)
{
// Make sure the 'initial' visibility is applied only once.
if (!_menuBarInitialVisibilityApplied) {
// Apply this code on first show only
if (_firstShowEvent) {
_firstShowEvent = false;
// the initial visibility of menubar should be applied at this last
// moment. Otherwise, the initial visibility will be determined by
// what KMainWindow has automatically stored in konsolerc, but not by
// what users has explicitly configured .
menuBar()->setVisible(_menuBarInitialVisibility);
_toggleMenuBarAction->setChecked(_menuBarInitialVisibility);
_menuBarInitialVisibilityApplied = true;
}
if (!_isSavedUiState || !KonsoleSettings::saveGeometryOnExit()) {
// Delay resizing to here, so that the other parts of the UI
......@@ -961,6 +959,7 @@ void MainWindow::showEvent(QShowEvent *event)
// a usuable size.
resize(sizeHint());
}
}
// Call parent method
KXmlGuiWindow::showEvent(event);
......
......@@ -198,7 +198,7 @@ private:
QPointer<SessionController> _pluggedController;
QList<IKonsolePlugin*> _plugins;
bool _menuBarInitialVisibility;
bool _menuBarInitialVisibilityApplied;
bool _firstShowEvent = true;
bool _blurEnabled = false;
bool _isSavedUiState = false;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment