Work on mouse event parsing.
This commit is contained in:
parent
c3bdbe4911
commit
ae3afea63f
|
@ -17,7 +17,7 @@ pub fn build(b: *Builder) void {
|
||||||
exe.addBuildOption(bool, "terminal_version", terminal_version);
|
exe.addBuildOption(bool, "terminal_version", terminal_version);
|
||||||
exe.addBuildOption(bool, "disable_colour", disable_colour);
|
exe.addBuildOption(bool, "disable_colour", disable_colour);
|
||||||
|
|
||||||
exe.strip = true;
|
//exe.strip = true;
|
||||||
exe.addPackage(.{
|
exe.addPackage(.{
|
||||||
.name = "interfaces",
|
.name = "interfaces",
|
||||||
.path = "deps/interfaces/interface.zig",
|
.path = "deps/interfaces/interface.zig",
|
||||||
|
|
|
@ -61,8 +61,17 @@ pub const Bar = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn process(self: *Bar) !void {
|
fn process(self: *Bar) !void {
|
||||||
|
var line_buffer: [512]u8 = undefined;
|
||||||
while (self.running) {
|
while (self.running) {
|
||||||
std.time.sleep(5000 * std.time.ns_per_ms);
|
const line_opt = try std.io.getStdIn().inStream().readUntilDelimiterOrEof(&line_buffer, '\n');
|
||||||
|
if (line_opt) |l| {
|
||||||
|
var line = l;
|
||||||
|
if (std.mem.eql(u8, line, "[")) continue;
|
||||||
|
if (line[0] == ',') line = line[1..line.len];
|
||||||
|
std.debug.print("{}\n", .{line});
|
||||||
|
}
|
||||||
|
|
||||||
|
//std.time.sleep(5000 * std.time.ns_per_ms);
|
||||||
//return;
|
//return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
17
src/types/mouseevent.zig
Normal file
17
src/types/mouseevent.zig
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
pub const MouseEvent = struct {
|
||||||
|
name: []const u8,
|
||||||
|
button: enum(u3) {
|
||||||
|
LeftClick = 1,
|
||||||
|
MiddleClick = 2,
|
||||||
|
RightClick = 3,
|
||||||
|
ScrollUp = 4,
|
||||||
|
ScrollDown = 5,
|
||||||
|
},
|
||||||
|
event: u16,
|
||||||
|
x: u16,
|
||||||
|
y: u16,
|
||||||
|
relative_x: u16,
|
||||||
|
relative_y: u16,
|
||||||
|
height: u16,
|
||||||
|
width: u16,
|
||||||
|
};
|
Loading…
Reference in a new issue