aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/terminal/terminalwidget.cpp
diff options
context:
space:
mode:
authorMarcus Tillmanns <[email protected]>2025-01-07 09:39:06 +0100
committerMarcus Tillmanns <[email protected]>2025-01-07 12:05:19 +0000
commit4a6fc56556b1b6708ec0eb0d7b7536bbb2578777 (patch)
tree74e6a081437c8d6780e7dac8a92b452879332c4d /src/plugins/terminal/terminalwidget.cpp
parentf28fe261f421516681ad540f5b9df5b42f0f6305 (diff)
Terminal: Fix resize logic
When a terminal window is resized (e.g. on first show) it needs to communicate its size to the PTY process. If the process is not yet running we need to make sure that the size is set again once it is running. Adding a bool return value to "resizePty" allows us to detect if the size change was applied, which allows us to update the surface size only if the pty was also changed. With this we can use the "liveSize" of the surface to check if a resizeEvent needs to be passed on to the PTY, which will be triggered by the Process::started signal once the process is started. Fixes: QTCREATORBUG-32290 Change-Id: I613275e75d343ccb357c2a797d096f0e1f96fed7 Reviewed-by: Cristian Adam <[email protected]>
Diffstat (limited to 'src/plugins/terminal/terminalwidget.cpp')
-rw-r--r--src/plugins/terminal/terminalwidget.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/terminal/terminalwidget.cpp b/src/plugins/terminal/terminalwidget.cpp
index 3ca0cfd8d25..05ba69457b8 100644
--- a/src/plugins/terminal/terminalwidget.cpp
+++ b/src/plugins/terminal/terminalwidget.cpp
@@ -336,10 +336,13 @@ qint64 TerminalWidget::writeToPty(const QByteArray &data)
return data.size();
}
-void TerminalWidget::resizePty(QSize newSize)
+bool TerminalWidget::resizePty(QSize newSize)
{
- if (m_process && m_process->ptyData() && m_process->isRunning())
- m_process->ptyData()->resize(newSize);
+ if (!m_process || !m_process->ptyData() || !m_process->isRunning())
+ return false;
+
+ m_process->ptyData()->resize(newSize);
+ return true;
}
void TerminalWidget::surfaceChanged()