w merge by me <3

This commit is contained in:
Harrison DiAmbrosio 2025-11-25 16:02:25 -05:00
commit b3b83fd287
11 changed files with 220 additions and 45 deletions

View file

@ -89,8 +89,11 @@ pub fn processCursorMotion(self: *Cursor, time_msec: u32) void {
if(focused_view) |view| {
view.scene_tree.node.setPosition(
std.math.clamp(@as(c_int, @intFromFloat(self.wlr_cursor.x)) - self.drag_view_offset_x, 0, std.math.maxInt(u32)),
std.math.clamp(@as(c_int, @intFromFloat(self.wlr_cursor.y)) - self.drag_view_offset_y, 0, std.math.maxInt(u32))
// TODO: add a lua option to configure the behavior of this, by
// default it will be the following:
@as(c_int, @intFromFloat(self.wlr_cursor.x)) - self.drag_view_offset_x,
@as(c_int, @intFromFloat(self.wlr_cursor.y)) - self.drag_view_offset_y
// and the user should be able to configure if it clamps or not
);
}
},
@ -100,8 +103,9 @@ pub fn processCursorMotion(self: *Cursor, time_msec: u32) void {
if(focused_view) |view| {
_ = view.xdg_toplevel.setSize(
@intCast(@as(c_int, @intFromFloat(self.wlr_cursor.x)) - view.scene_tree.node.x),
@intCast(@as(c_int, @intFromFloat(self.wlr_cursor.y)) - view.scene_tree.node.y)
// TODO: configure the min and max using lua?
std.math.clamp(@as(c_int, @as(i32, @intFromFloat(self.wlr_cursor.x)) - view.scene_tree.node.x), 10, std.math.maxInt(i32)),
std.math.clamp(@as(c_int, @as(i32, @intFromFloat(self.wlr_cursor.y)) - view.scene_tree.node.y), 10, std.math.maxInt(i32))
);
}
},