mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	Merge branch 'master' of https://github.com/johanmalm/labwc
This commit is contained in:
		
						commit
						6a00166cff
					
				
					 4 changed files with 80 additions and 8 deletions
				
			
		
							
								
								
									
										43
									
								
								src/cursor.c
									
										
									
									
									
								
							
							
						
						
									
										43
									
								
								src/cursor.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -57,6 +57,19 @@ request_set_primary_selection_notify(struct wl_listener *listener, void *data)
 | 
			
		|||
		event->serial);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
request_start_drag_notify(struct wl_listener *listener, void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct seat *seat = wl_container_of(
 | 
			
		||||
		listener, seat, request_start_drag);
 | 
			
		||||
	struct wlr_seat_request_start_drag_event *event = data;
 | 
			
		||||
	if (wlr_seat_validate_pointer_grab_serial(seat->seat, event->origin, event->serial)) {
 | 
			
		||||
		wlr_seat_start_pointer_drag(seat->seat, event->drag, event->serial);
 | 
			
		||||
	} else {
 | 
			
		||||
		wlr_data_source_destroy(event->drag->source);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
process_cursor_move(struct server *server, uint32_t time)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -191,7 +204,7 @@ process_cursor_motion(struct server *server, uint32_t time)
 | 
			
		|||
		 * the pointer over a window.
 | 
			
		||||
		 */
 | 
			
		||||
		wlr_seat_pointer_notify_enter(wlr_seat, surface, sx, sy);
 | 
			
		||||
		if (!focus_changed) {
 | 
			
		||||
		if (!focus_changed || server->seat.drag_icon) {
 | 
			
		||||
			/*
 | 
			
		||||
			 * The enter event contains coordinates, so we only need
 | 
			
		||||
			 * to notify on motion if the focus did not change.
 | 
			
		||||
| 
						 | 
				
			
			@ -207,6 +220,15 @@ process_cursor_motion(struct server *server, uint32_t time)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
start_drag(struct wl_listener *listener, void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct seat *seat = wl_container_of(listener, seat, start_drag);
 | 
			
		||||
	struct wlr_drag *wlr_drag = data;
 | 
			
		||||
	seat->drag_icon = wlr_drag->icon;
 | 
			
		||||
	wl_signal_add(&seat->drag_icon->events.destroy, &seat->destroy_drag);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
cursor_motion(struct wl_listener *listener, void *data)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -229,6 +251,18 @@ cursor_motion(struct wl_listener *listener, void *data)
 | 
			
		|||
	process_cursor_motion(seat->server, event->time_msec);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
destroy_drag(struct wl_listener *listener, void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct seat *seat = wl_container_of(listener, seat, destroy_drag);
 | 
			
		||||
 | 
			
		||||
	if (!seat->drag_icon) {
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	seat->drag_icon = NULL;
 | 
			
		||||
	desktop_focus_topmost_mapped_view(seat->server);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
cursor_motion_absolute(struct wl_listener *listener, void *data)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -444,6 +478,13 @@ cursor_init(struct seat *seat)
 | 
			
		|||
	seat->request_set_selection.notify = request_set_selection_notify;
 | 
			
		||||
	wl_signal_add(&seat->seat->events.request_set_selection,
 | 
			
		||||
		&seat->request_set_selection);
 | 
			
		||||
	seat->request_start_drag.notify = request_start_drag_notify;
 | 
			
		||||
	wl_signal_add(&seat->seat->events.request_start_drag,
 | 
			
		||||
		&seat->request_start_drag);
 | 
			
		||||
	seat->start_drag.notify = start_drag;
 | 
			
		||||
	wl_signal_add(&seat->seat->events.start_drag,
 | 
			
		||||
		&seat->start_drag);
 | 
			
		||||
	seat->destroy_drag.notify = destroy_drag;
 | 
			
		||||
 | 
			
		||||
	seat->request_set_primary_selection.notify =
 | 
			
		||||
		request_set_primary_selection_notify;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue