fix: correctly handle negative coordinates in tui.update_hover
This commit is contained in:
		
							parent
							
								
									f56326be80
								
							
						
					
					
						commit
						1c6a832255
					
				
					 1 changed files with 4 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -509,7 +509,7 @@ fn send_mouse_drag(self: *Self, y: c_int, x: c_int, from: tp.pid_ref, m: tp.mess
 | 
			
		|||
fn update_hover(self: *Self, y: c_int, x: c_int) !?*Widget {
 | 
			
		||||
    self.last_hover_y = y;
 | 
			
		||||
    self.last_hover_x = x;
 | 
			
		||||
    if (self.find_coord_widget(@intCast(y), @intCast(x))) |w| {
 | 
			
		||||
    if (y > 0 and x > 0) if (self.find_coord_widget(@intCast(y), @intCast(x))) |w| {
 | 
			
		||||
        if (if (self.hover_focus) |h| h != w else true) {
 | 
			
		||||
            var buf: [256]u8 = undefined;
 | 
			
		||||
            if (self.hover_focus) |h| {
 | 
			
		||||
| 
						 | 
				
			
			@ -520,10 +520,9 @@ fn update_hover(self: *Self, y: c_int, x: c_int) !?*Widget {
 | 
			
		|||
            _ = try w.send(tp.self_pid(), tp.message.fmtbuf(&buf, .{ "H", true }) catch |e| return tp.exit_error(e, @errorReturnTrace()));
 | 
			
		||||
        }
 | 
			
		||||
        return w;
 | 
			
		||||
    } else {
 | 
			
		||||
        try self.clear_hover_focus();
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
    };
 | 
			
		||||
    try self.clear_hover_focus();
 | 
			
		||||
    return null;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn clear_hover_focus(self: *Self) tp.result {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue