mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
fix crashing when a view is resized too small
this is done by limiting to a minimum of 10x10 pixels, we may make this configurable using lua in the future
This commit is contained in:
parent
eeb6bf2278
commit
9648dc7872
1 changed files with 3 additions and 2 deletions
|
|
@ -100,8 +100,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))
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue