summaryrefslogtreecommitdiff
path: root/src/detached
diff options
context:
space:
mode:
Diffstat (limited to 'src/detached')
-rw-r--r--src/detached/wire.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/detached/wire.zig b/src/detached/wire.zig
index 9890dc1a..0e141686 100644
--- a/src/detached/wire.zig
+++ b/src/detached/wire.zig
@@ -12,7 +12,7 @@ const ShaderAnimation = pardes.config.Runtime.ShaderAnimation;
/// to be refused, which is what this number is for.
/// 8: one layer type: a tag band carries all its rows (not a layer per
/// line), and a frame carries the core's placed regions after its layers.
-pub const version: u16 = 11;
+pub const version: u16 = 12;
/// The Chrome palette is carried field by field as its declaration lists
/// them, so any change to it changes the wire: bump `version`, then this.
@@ -980,6 +980,7 @@ pub fn encodeClient(out: []u8, msg: ClientMsg) Error![]const u8 {
.pdf_scroll => |s| {
try w.writeByte(s.pane);
try w.writeInt(u32, @bitCast(s.delta_pixels), .little);
+ try w.writeByte(@intFromBool(s.glide));
},
.pinch => |v| try w.writeInt(u32, @bitCast(v), .little),
.touch_scroll => |v| try w.writeInt(u32, @bitCast(v), .little),
@@ -1043,7 +1044,7 @@ pub fn decodeClient(tag: u8, payload: []const u8) Error!ClientMsg {
},
.paste => .{ .event = .{ .paste = try getSlice32(&r) } },
.command => .{ .event = .{ .command = try r.take(try r.takeInt(u16, .little)) } },
- .pdf_scroll => .{ .event = .{ .pdf_scroll = .{ .pane = try getPane(&r), .delta_pixels = try getF32(&r) } } },
+ .pdf_scroll => .{ .event = .{ .pdf_scroll = .{ .pane = try getPane(&r), .delta_pixels = try getF32(&r), .glide = try getBool(&r) } } },
.pinch => .{ .event = .{ .pinch = try getF32(&r) } },
.touch_scroll => .{ .event = .{ .touch_scroll = try getF32(&r) } },
.pointer_leave => .{ .event = .pointer_leave },
@@ -1297,9 +1298,10 @@ test "detached wire: every Event variant round-trips" {
try testing.expectEqualStrings("clip", (try roundClient(&buf, .{ .event = .{ .paste = "clip" } })).event.paste);
try testing.expectEqualStrings("Look /x", (try roundClient(&buf, .{ .event = .{ .command = "Look /x" } })).event.command);
{
- const got = (try roundClient(&buf, .{ .event = .{ .pdf_scroll = .{ .pane = 2, .delta_pixels = -12.5 } } })).event.pdf_scroll;
+ const got = (try roundClient(&buf, .{ .event = .{ .pdf_scroll = .{ .pane = 2, .delta_pixels = -12.5, .glide = false } } })).event.pdf_scroll;
try testing.expectEqual(@as(u8, 2), got.pane);
try testing.expectEqual(@as(f32, -12.5), got.delta_pixels);
+ try testing.expect(!got.glide);
}
try testing.expectEqual(@as(f32, 1.25), (try roundClient(&buf, .{ .event = .{ .pinch = 1.25 } })).event.pinch);
try testing.expectEqual(@as(f32, -0.75), (try roundClient(&buf, .{ .event = .{ .touch_scroll = -0.75 } })).event.touch_scroll);