feat(pty): enable resize and resizev

This commit is contained in:
Leroy Hopson 2024-02-25 23:17:45 +13:00
parent 1da42501af
commit 84e1126824
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
3 changed files with 12 additions and 1 deletions

View file

@ -55,6 +55,8 @@ void PTY::_bind_methods() {
ClassDB::bind_method(D_METHOD("fork", "file", "args", "cwd", "cols", "rows"), &PTY::fork, DEFVAL(""), DEFVAL(PackedStringArray()), DEFVAL("."), DEFVAL(80), DEFVAL(24)); ClassDB::bind_method(D_METHOD("fork", "file", "args", "cwd", "cols", "rows"), &PTY::fork, DEFVAL(""), DEFVAL(PackedStringArray()), DEFVAL("."), DEFVAL(80), DEFVAL(24));
ClassDB::bind_method(D_METHOD("open", "cols", "rows"), &PTY::open, DEFVAL(80), DEFVAL(24)); ClassDB::bind_method(D_METHOD("open", "cols", "rows"), &PTY::open, DEFVAL(80), DEFVAL(24));
ClassDB::bind_method(D_METHOD("write", "data"), &PTY::write); ClassDB::bind_method(D_METHOD("write", "data"), &PTY::write);
ClassDB::bind_method(D_METHOD("resize", "cols", "rows"), &PTY::resize);
ClassDB::bind_method(D_METHOD("resizev", "size"), &PTY::resizev);
ClassDB::bind_method(D_METHOD("kill", "signal"), &PTY::kill); ClassDB::bind_method(D_METHOD("kill", "signal"), &PTY::kill);
ClassDB::bind_method(D_METHOD("_on_exit", "exit_code", "signal_code"), &PTY::_on_exit); ClassDB::bind_method(D_METHOD("_on_exit", "exit_code", "signal_code"), &PTY::_on_exit);
@ -156,6 +158,9 @@ Error PTY::open(const int cols, const int rows) {
} }
void PTY::resize(const int cols, const int rows) const { void PTY::resize(const int cols, const int rows) const {
#if defined(__linux__) || defined(__APPLE__)
PTYUnix::resize(fd, cols, rows);
#endif
} }
void PTY::write(const Variant &data) const { void PTY::write(const Variant &data) const {

View file

@ -467,7 +467,7 @@ Dictionary PTYUnix::open(
return result; return result;
} }
void resize( void PTYUnix::resize(
const int &p_fd, const int &p_fd,
const int &p_cols, const int &p_cols,
const int &p_rows const int &p_rows

View file

@ -29,5 +29,11 @@ namespace godot
const int &p_cols, const int &p_cols,
const int &p_rows const int &p_rows
); );
static void resize(
const int &p_fd,
const int &p_cols,
const int &p_rows
);
}; };
} // namespace godot } // namespace godot