Commit 7a27f407 authored by Matan Ziv-Av's avatar Matan Ziv-Av Committed by Tomaz Canabrava
Browse files

Use TIOCSWINSZ ioctl to set pty's pixel size, so it will be reported to apps using TIOCGWINSZE

parent f13ac9ca
......@@ -11,6 +11,9 @@
// System
#include <csignal>
#if !defined(Q_OS_WIN)
#include <sys/ioctl.h> //ioctl() and TIOCSWINSZ
#endif
#include <termios.h>
// Qt
......@@ -85,9 +88,23 @@ void Pty::setWindowSize(int columns, int lines)
if (pty()->masterFd() >= 0) {
pty()->setWinSize(lines, columns);
#if !defined(Q_OS_WIN)
struct winsize w;
w.ws_xpixel = _windowWidth;
w.ws_ypixel = _windowHeight;
w.ws_col = _windowColumns;
w.ws_row = _windowLines;
ioctl(pty()->masterFd(), TIOCSWINSZ, &w);
#endif
}
}
void Pty::setPixelSize(int width, int height)
{
_windowWidth = width;
_windowHeight = height;
}
QSize Pty::windowSize() const
{
return {_windowColumns, _windowLines};
......
......@@ -90,6 +90,7 @@ public:
* used by this teletype.
*/
void setWindowSize(int columns, int lines);
void setPixelSize(int width, int height);
/** Returns the size of the window used by this teletype. See setWindowSize() */
QSize windowSize() const;
......@@ -163,6 +164,8 @@ private:
int _windowColumns;
int _windowLines;
int _windowWidth;
int _windowHeight;
char _eraseChar;
bool _xonXoff;
bool _utf8;
......
......@@ -724,8 +724,9 @@ void Session::sessionAttributeRequest(int id, uint terminator)
}
}
void Session::onViewSizeChange(int /*height*/, int /*width*/)
void Session::onViewSizeChange(int height, int width)
{
_shellProcess->setPixelSize(width, height);
updateTerminalSize();
}
......
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