Commit ff234003 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
(cherry picked from commit 68f1505d)
parent beb70f6d
......@@ -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"));
......@@ -947,23 +946,23 @@ 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
// (ViewManager, TabbedViewContainer, TerminalDisplay ... etc)
// have been created and TabbedViewContainer::sizeHint() returns
// a usuable size.
resize(sizeHint());
if (!_isSavedUiState || !KonsoleSettings::saveGeometryOnExit()) {
// Delay resizing to here, so that the other parts of the UI
// (ViewManager, TabbedViewContainer, TerminalDisplay ... etc)
// have been created and TabbedViewContainer::sizeHint() returns
// a usuable size.
resize(sizeHint());
}
}
// Call parent method
......
......@@ -198,7 +198,7 @@ private:
QPointer<SessionController> _pluggedController;
QList<IKonsolePlugin*> _plugins;
bool _menuBarInitialVisibility;
bool _menuBarInitialVisibilityApplied;
bool _firstShowEvent = true;
bool _blurEnabled = false;
bool _isSavedUiState = false;
};
......
Markdown is supported
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