mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	Implement tool tip -> click simulation
This commit is contained in:
		
							parent
							
								
									eaf6c0ccf4
								
							
						
					
					
						commit
						96b401c05d
					
				
					 1 changed files with 30 additions and 26 deletions
				
			
		| 
						 | 
				
			
			@ -8,18 +8,11 @@
 | 
			
		|||
#include "rootston/desktop.h"
 | 
			
		||||
 | 
			
		||||
void cursor_update_position(struct roots_input *input, uint32_t time) {
 | 
			
		||||
	/*
 | 
			
		||||
	if (input->motion_context.surface) {
 | 
			
		||||
		struct example_xdg_surface_v6 *surface;
 | 
			
		||||
		surface = sample->motion_context.surface;
 | 
			
		||||
		surface->position.lx = sample->cursor->x - sample->motion_context.off_x;
 | 
			
		||||
		surface->position.ly = sample->cursor->y - sample->motion_context.off_y;
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	*/
 | 
			
		||||
	struct roots_desktop *desktop = input->server->desktop;
 | 
			
		||||
	struct roots_view *view = view_at(
 | 
			
		||||
			desktop, input->cursor->x, input->cursor->y);
 | 
			
		||||
	struct roots_view *view;
 | 
			
		||||
	switch (input->mode) {
 | 
			
		||||
	case ROOTS_CURSOR_PASSTHROUGH:
 | 
			
		||||
		view = view_at(desktop, input->cursor->x, input->cursor->y);
 | 
			
		||||
		if (view) {
 | 
			
		||||
			struct wlr_box box;
 | 
			
		||||
			view_get_input_bounds(view, &box);
 | 
			
		||||
| 
						 | 
				
			
			@ -31,6 +24,23 @@ void cursor_update_position(struct roots_input *input, uint32_t time) {
 | 
			
		|||
		} else {
 | 
			
		||||
			wlr_seat_pointer_clear_focus(input->wl_seat);
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
	case ROOTS_CURSOR_MOVE:
 | 
			
		||||
		break;
 | 
			
		||||
	case ROOTS_CURSOR_RESIZE:
 | 
			
		||||
		break;
 | 
			
		||||
	case ROOTS_CURSOR_ROTATE:
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	/*
 | 
			
		||||
	if (input->motion_context.surface) {
 | 
			
		||||
		struct example_xdg_surface_v6 *surface;
 | 
			
		||||
		surface = sample->motion_context.surface;
 | 
			
		||||
		surface->position.lx = sample->cursor->x - sample->motion_context.off_x;
 | 
			
		||||
		surface->position.ly = sample->cursor->y - sample->motion_context.off_y;
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void set_view_focus(struct roots_input *input,
 | 
			
		||||
| 
						 | 
				
			
			@ -86,11 +96,7 @@ static void handle_cursor_button(struct wl_listener *listener, void *data) {
 | 
			
		|||
	int i;
 | 
			
		||||
	switch (event->state) {
 | 
			
		||||
	case WLR_BUTTON_RELEASED:
 | 
			
		||||
		/*
 | 
			
		||||
		if (sample->motion_context.surface) {
 | 
			
		||||
			sample->motion_context.surface = NULL;
 | 
			
		||||
		}
 | 
			
		||||
		*/
 | 
			
		||||
		input->active_view = NULL;
 | 
			
		||||
		break;
 | 
			
		||||
	case WLR_BUTTON_PRESSED:
 | 
			
		||||
		i = input->input_events_idx;
 | 
			
		||||
| 
						 | 
				
			
			@ -116,17 +122,15 @@ static void handle_tool_axis(struct wl_listener *listener, void *data) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static void handle_tool_tip(struct wl_listener *listener, void *data) {
 | 
			
		||||
	/* TODO
 | 
			
		||||
	struct roots_input *input = wl_container_of(listener, input, tool_tip);
 | 
			
		||||
	struct wlr_event_tablet_tool_tip *event = data;
 | 
			
		||||
 | 
			
		||||
	struct wlr_xdg_surface_v6 *surface =
 | 
			
		||||
		example_xdg_surface_at(sample, sample->cursor->x, sample->cursor->y);
 | 
			
		||||
	example_set_focused_surface(sample, surface);
 | 
			
		||||
 | 
			
		||||
	wlr_seat_pointer_send_button(sample->wl_seat, (uint32_t)event->time_usec,
 | 
			
		||||
	struct roots_desktop *desktop = input->server->desktop;
 | 
			
		||||
	struct roots_view *view = view_at(
 | 
			
		||||
			desktop, input->cursor->x, input->cursor->y);
 | 
			
		||||
	set_view_focus(input, desktop, view);
 | 
			
		||||
	wlr_seat_pointer_send_button(input->wl_seat, (uint32_t)event->time_usec,
 | 
			
		||||
		BTN_LEFT, event->state);
 | 
			
		||||
	*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cursor_initialize(struct roots_input *input) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue