From 49fb5c868871d246cb129b0dd179785a4d9a739f Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Mon, 2 Oct 2023 16:49:11 -0500 Subject: [PATCH] gtk(mouse): use "text" enum as default value Use the .text field of the enum as the default value of the mouse shape instead of renaming .default. Store the default value as the current value for use in subsequent commits --- src/apprt/gtk/Surface.zig | 2 +- src/terminal/Terminal.zig | 3 +++ src/termio/Exec.zig | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig index 99acf2f66..6fa58825c 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -424,7 +424,7 @@ pub fn setMouseShape( shape: terminal.MouseShape, ) !void { const name: [:0]const u8 = switch (shape) { - .default => "text", + .default => "default", .help => "help", .pointer => "pointer", .context_menu => "context-menu", diff --git a/src/terminal/Terminal.zig b/src/terminal/Terminal.zig index 1bd5f2cf3..256b4c9fe 100644 --- a/src/terminal/Terminal.zig +++ b/src/terminal/Terminal.zig @@ -21,6 +21,7 @@ const Tabstops = @import("Tabstops.zig"); const trace = @import("tracy").trace; const color = @import("color.zig"); const Screen = @import("Screen.zig"); +const mouse_shape = @import("mouse_shape.zig"); const log = std.log.scoped(.terminal); @@ -84,6 +85,8 @@ previous_char: ?u21 = null, /// The modes that this terminal currently has active. modes: modes.ModeState = .{}, +mouse_shape: mouse_shape.MouseShape = .text, + /// These are just a packed set of flags we may set on the terminal. flags: packed struct { // This isn't a mode, this is set by OSC 133 using the "A" event. diff --git a/src/termio/Exec.zig b/src/termio/Exec.zig index 5d3166853..bcd76ed41 100644 --- a/src/termio/Exec.zig +++ b/src/termio/Exec.zig @@ -1902,7 +1902,7 @@ const StreamHandler = struct { self: *StreamHandler, ) !void { self.terminal.fullReset(self.alloc); - try self.setMouseShape(.default); + try self.setMouseShape(.text); } pub fn queryKittyKeyboard(self: *StreamHandler) !void {