Skip to content

Commit

Permalink
Fix: fix getMainWindowSize values if console tab is not in focus (hid…
Browse files Browse the repository at this point in the history
…den) (#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 <vperetokin@gmail.com>
  • Loading branch information
Edru2 and vadi2 committed Nov 27, 2022
1 parent 119056e commit d5a116f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/TConsole.cpp
Expand Up @@ -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";
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit d5a116f

Please sign in to comment.