From d5a116f75f027e3fc05fcac6c519db88fd92b78b Mon Sep 17 00:00:00 2001 From: Manuel Wegmann <60551052+Edru2@users.noreply.github.com> Date: Sun, 27 Nov 2022 01:12:57 +0100 Subject: [PATCH] Fix: fix getMainWindowSize values if console tab is not in focus (hidden) (#6438) #### Brief overview of PR changes/additions Trying to fix wrong getMainWindowSize values if console is hidden, for example when another console tab is in focus #### Motivation for adding to Mudlet #### Other info (issues closed, discussion etc) should fix #5960 Co-authored-by: Vadim Peretokin --- src/TConsole.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/TConsole.cpp b/src/TConsole.cpp index ee8fc154e84..cb1c867c037 100644 --- a/src/TConsole.cpp +++ b/src/TConsole.cpp @@ -628,16 +628,15 @@ void TConsole::resizeEvent(QResizeEvent* event) layerCommandLine->move(0, mpBaseVFrame->height() - layerCommandLine->height()); } - // don't call event in lua if size didn't change - bool preventLuaEvent = (mpMainDisplay->size() == mOldSize); QWidget::resizeEvent(event); - mOldSize = mpMainDisplay->size(); - - if (preventLuaEvent) { - return; - } if (mType & MainConsole) { + // don't call event in lua if size didn't change + bool preventLuaEvent = (getMainWindowSize() == mOldSize); + mOldSize = getMainWindowSize(); + if (preventLuaEvent) { + return; + } TLuaInterpreter* pLua = mpHost->getLuaInterpreter(); QString func = "handleWindowResizeEvent"; QString n = "WindowResizeEvent"; @@ -1928,6 +1927,9 @@ void TConsole::slot_searchBufferDown() QSize TConsole::getMainWindowSize() const { + if (isHidden()) { + return mOldSize; + } QSize consoleSize = size(); int toolbarWidth = mpLeftToolBar->width() + mpRightToolBar->width(); int toolbarHeight = mpTopToolBar->height();