mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:15:08 +00:00
Support resizing the Terminal app.
I set it up so that TIOCSWINSZ on a master PTY gets forwarded to the slave. This feels intuitively right. Terminal can then use that to inform the shell or whoever is inside the slave that the window size has changed. TIOCSWINSZ also triggers the generation of a SIGWINCH signal. :^)
This commit is contained in:
parent
0ca3112301
commit
0aaec6b19a
6 changed files with 74 additions and 19 deletions
|
@ -112,8 +112,13 @@ int TTY::ioctl(Process& process, unsigned request, unsigned arg)
|
|||
termios* tp;
|
||||
winsize* ws;
|
||||
|
||||
if (process.tty() && process.tty() != this)
|
||||
#if 0
|
||||
// FIXME: When should we block things?
|
||||
// How do we make this work together with MasterPTY forwarding to us?
|
||||
if (process.tty() && process.tty() != this) {
|
||||
return -ENOTTY;
|
||||
}
|
||||
#endif
|
||||
switch (request) {
|
||||
case TIOCGPGRP:
|
||||
return m_pgid;
|
||||
|
@ -145,6 +150,16 @@ int TTY::ioctl(Process& process, unsigned request, unsigned arg)
|
|||
ws->ws_row = m_rows;
|
||||
ws->ws_col = m_columns;
|
||||
return 0;
|
||||
case TIOCSWINSZ:
|
||||
ws = reinterpret_cast<winsize*>(arg);
|
||||
if (!process.validate_read(ws, sizeof(winsize)))
|
||||
return -EFAULT;
|
||||
if (ws->ws_col == m_columns && ws->ws_row == m_rows)
|
||||
return 0;
|
||||
m_rows = ws->ws_row;
|
||||
m_columns = ws->ws_col;
|
||||
generate_signal(SIGWINCH);
|
||||
return 0;
|
||||
case TIOCSCTTY:
|
||||
process.set_tty(this);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue