mirror of
https://github.com/KDE/konsole.git
synced 2026-06-09 22:45:03 -04:00
Use TIOCSWINSZ ioctl to set pty's pixel size, so it will be reported to apps using TIOCGWINSZE
This commit is contained in:
committed by
Tomaz Canabrava
parent
f13ac9ca95
commit
7a27f40722
17
src/Pty.cpp
17
src/Pty.cpp
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user