summaryrefslogtreecommitdiff
path: root/src/Core.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Core.zig')
-rw-r--r--src/Core.zig28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/Core.zig b/src/Core.zig
index c5665cb5..0efe447b 100644
--- a/src/Core.zig
+++ b/src/Core.zig
@@ -23,6 +23,7 @@ const Handover = pardes.Handover;
const Host = pardes.Host;
const ImagePlace = pardes.ImagePlace;
const Jump = pardes.Jump;
+const Frontend = @import("Event.zig").Frontend;
const Ask = pardes.lsp.Ask;
const Key = pardes.Key;
const Loc = Jump.Loc;
@@ -193,11 +194,10 @@ theme_file_pane: u8 = 0,
chrome: colors.ChromeTheme = colors.initial_chrome,
/// Every drawn frame's timings (FrameStats: the Debug box, PARDES_FRAMES).
frames: FrameStats = .{},
-native_images: bool = false,
-/// The shell can take a changed image a few rows at a time (a texture row
-/// upload, a shared-memory hand-off), so a PDF selection is repainted as
-/// it is dragged instead of once on release.
-native_image_patches: bool = false,
+/// The live view's frontend (Event.frontend): a window, what it draws and
+/// the words it takes (builtins.zig `here`); it starts as
+/// `Options.windowed` says.
+frontend: Frontend = .{ .windowed = false },
quit: bool = false,
/// A detached session with no frontend attached: nothing renders, so
/// no input ever dismisses a message (Messages.expireUnattended).
@@ -218,14 +218,10 @@ pointer_raw_row: u16 = 0,
pointer_body_hit: ?Mouse.BodyHit = null,
pointer_tag_hit: ?TagHit = null,
raw_hover_intent: bool = false,
-pointer_inside: bool = false,
/// A pixel shell's window, which hears the pointer leave it: only then
/// does /status say whether the pointer is over it (a terminal's mouse
/// reports never say it left, so a tty would claim it for ever).
-/// The live view's frontend is a window (Event.frontend): what it draws,
-/// and the words it takes (builtins.zig `here`). It starts as
-/// `Options.windowed` says.
-windowed: bool = false,
+pointer_inside: bool = false,
/// The last plain B1 click, for acme's double-click (text.c:881,
/// textselect: a second click at the same point within 500 ms).
last_click: ?struct { id: usize, on_tag: bool, row: i32, col: i32, ms: i64 } = null,
@@ -396,7 +392,7 @@ pub const replica = .{
// A frame, and the timings that make it.
"surface", "frames", "chrome",
"frame_arena", "scratch",
- "needs_frame", "present_skipped", "native_image_patches",
+ "needs_frame", "present_skipped",
"echo",
// Drained by every pump before its digest; a replica's queues
// are its own.
@@ -471,7 +467,7 @@ pub fn create(gpa: std.mem.Allocator, opts: Options) !*Pardes {
.pdf_gpa = opts.pdf_allocator orelse gpa,
.tree_sitter_gpa = opts.tree_sitter_allocator orelse gpa,
.opts = opts,
- .windowed = opts.windowed,
+ .frontend = .{ .windowed = opts.windowed },
.tty_toggle = opts.tty_toggle,
.col_tags = @splat(.{ .what = .column, .gpa = gpa }),
.global_tag = .{ .what = .workspace, .gpa = gpa },
@@ -1614,7 +1610,7 @@ pub fn update(p: *Pardes, ev: Event) void {
if (comptime pdf_enabled) {
if (scroll.pane < MAX_PANES) {
if (p.panes[scroll.pane]) |pane| {
- if (pane.hasPdf() and p.native_images)
+ if (pane.hasPdf() and p.frontend.native_images)
_ = pardes.panes.Pdf.scrollPane(p, pane, @floatCast(scroll.delta_pixels), scroll.glide);
}
}
@@ -1631,9 +1627,7 @@ pub fn update(p: *Pardes, ev: Event) void {
},
.handed => |h| p.handover.finish(p, h.seq, h.to, h.failure),
.frontend => |f| {
- p.windowed = f.windowed;
- p.native_images = f.native_images;
- p.native_image_patches = f.native_image_patches;
+ p.frontend = f;
},
.pointer_leave => {
p.pointer_inside = false;
@@ -2126,7 +2120,7 @@ pub const Boot = enum {
pub const Options = struct {
tty_only: bool = false,
- /// The first view's frontend is a window (`Pardes.windowed`), as a
+ /// The first view's frontend is a window (`Pardes.frontend`), as a
/// window's build says: an option, taped with the rest, so that a
/// window's build replaying a terminal's session starts as it did.
windowed: bool = platform == .gui,