mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 07:46:12 +03:00
termio: hook up dcs callbacks
This commit is contained in:
@ -67,8 +67,12 @@ pub fn Stream(comptime Handler: type) type {
|
||||
.dcs_hook => |dcs| if (@hasDecl(T, "dcsHook")) {
|
||||
try self.handler.dcsHook(dcs);
|
||||
} else log.warn("unimplemented DCS hook", .{}),
|
||||
.dcs_put => |code| log.warn("unhandled DCS put: {x}", .{code}),
|
||||
.dcs_unhook => log.warn("unhandled DCS unhook", .{}),
|
||||
.dcs_put => |code| if (@hasDecl(T, "dcsPut")) {
|
||||
try self.handler.dcsPut(code);
|
||||
} else log.warn("unimplemented DCS put: {x}", .{code}),
|
||||
.dcs_unhook => if (@hasDecl(T, "dcsUnhook")) {
|
||||
try self.handler.dcsUnhook();
|
||||
} else log.warn("unimplemented DCS unhook", .{}),
|
||||
.apc_start => if (@hasDecl(T, "apcStart")) {
|
||||
try self.handler.apcStart();
|
||||
} else log.warn("unimplemented APC start", .{}),
|
||||
|
@ -1157,6 +1157,11 @@ const StreamHandler = struct {
|
||||
/// the kitty graphics protocol.
|
||||
apc: terminal.apc.Handler = .{},
|
||||
|
||||
/// The DCS handler maintains DCS state. DCS is like CSI or OSC,
|
||||
/// but requires more stateful parsing. This is used by functionality
|
||||
/// such as XTGETTCAP.
|
||||
dcs: terminal.dcs.Handler = .{},
|
||||
|
||||
/// This is set to true when a message was written to the writer
|
||||
/// mailbox. This can be used by callers to determine if they need
|
||||
/// to wake up the writer.
|
||||
@ -1173,6 +1178,7 @@ const StreamHandler = struct {
|
||||
|
||||
pub fn deinit(self: *StreamHandler) void {
|
||||
self.apc.deinit();
|
||||
self.dcs.deinit();
|
||||
}
|
||||
|
||||
inline fn queueRender(self: *StreamHandler) !void {
|
||||
@ -1200,8 +1206,23 @@ const StreamHandler = struct {
|
||||
}
|
||||
|
||||
pub fn dcsHook(self: *StreamHandler, dcs: terminal.DCS) !void {
|
||||
_ = self;
|
||||
log.warn("DCS HOOK: {}", .{dcs});
|
||||
self.dcs.hook(self.alloc, dcs);
|
||||
}
|
||||
|
||||
pub fn dcsPut(self: *StreamHandler, byte: u8) !void {
|
||||
self.dcs.put(byte);
|
||||
}
|
||||
|
||||
pub fn dcsUnhook(self: *StreamHandler) !void {
|
||||
var cmd = self.dcs.unhook() orelse return;
|
||||
cmd.deinit();
|
||||
|
||||
// log.warn("DCS command: {}", .{cmd});
|
||||
switch (cmd) {
|
||||
.xtgettcap => |gettcap| {
|
||||
_ = gettcap;
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn apcStart(self: *StreamHandler) !void {
|
||||
|
Reference in New Issue
Block a user