mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	cursor: Prevent resetting cursor icon during Move or Resize
Reported-by: @Flrian
This commit is contained in:
		
							parent
							
								
									c0f0e0c46e
								
							
						
					
					
						commit
						7af74c88a8
					
				
					 2 changed files with 26 additions and 3 deletions
				
			
		
							
								
								
									
										20
									
								
								src/cursor.c
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								src/cursor.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -38,8 +38,16 @@ cursor_rebase(struct seat *seat, struct wlr_scene_node *node,
 | 
			
		|||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (seat->server->input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
 | 
			
		||||
		/* Prevent resetting focus / cursor image when moving or resizing */
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	struct wlr_surface *focused_surface =
 | 
			
		||||
		seat->seat->pointer_state.focused_surface;
 | 
			
		||||
 | 
			
		||||
	if (surface) {
 | 
			
		||||
		if (!force && surface == seat->seat->pointer_state.focused_surface) {
 | 
			
		||||
		if (!force && surface == focused_surface) {
 | 
			
		||||
			/*
 | 
			
		||||
			 * Usually we prevent re-entering an already focused surface
 | 
			
		||||
			 * because it sends useless leave and enter events.
 | 
			
		||||
| 
						 | 
				
			
			@ -56,8 +64,8 @@ cursor_rebase(struct seat *seat, struct wlr_scene_node *node,
 | 
			
		|||
		wlr_seat_pointer_notify_clear_focus(seat->seat);
 | 
			
		||||
		wlr_seat_pointer_notify_enter(seat->seat, surface, sx, sy);
 | 
			
		||||
		wlr_seat_pointer_notify_motion(seat->seat, time_msec, sx, sy);
 | 
			
		||||
	} else {
 | 
			
		||||
		cursor_set(seat, "left_ptr");
 | 
			
		||||
	} else if (focused_surface) {
 | 
			
		||||
		cursor_set(seat, XCURSOR_DEFAULT);
 | 
			
		||||
		wlr_seat_pointer_notify_clear_focus(seat->seat);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -66,6 +74,12 @@ static void
 | 
			
		|||
request_cursor_notify(struct wl_listener *listener, void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct seat *seat = wl_container_of(listener, seat, request_cursor);
 | 
			
		||||
 | 
			
		||||
	if (seat->server->input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
 | 
			
		||||
		/* Prevent setting a cursor image when moving or resizing */
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * This event is raised by the seat when a client provides a cursor
 | 
			
		||||
	 * image
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -134,5 +134,14 @@ interactive_end(struct view *view)
 | 
			
		|||
				view_snap_to_edge(view, "down");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		/*
 | 
			
		||||
		 * First set the cursor image in case we moved / resized via SSD.
 | 
			
		||||
		 * Then allow an application to set its own image in case there
 | 
			
		||||
		 * is a surface below the cursor (e.g. moved / resized via 'Alt'
 | 
			
		||||
		 * modifier). If there is no surface below the cursor the second
 | 
			
		||||
		 * call is a no-op.
 | 
			
		||||
		 */
 | 
			
		||||
		cursor_set(&view->server->seat, XCURSOR_DEFAULT);
 | 
			
		||||
		cursor_update_focus(view->server, true);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue