Implement tool tip -> click simulation

master
Drew DeVault 7 years ago
parent eaf6c0ccf4
commit 96b401c05d

@ -8,18 +8,11 @@
#include "rootston/desktop.h" #include "rootston/desktop.h"
void cursor_update_position(struct roots_input *input, uint32_t time) { 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_desktop *desktop = input->server->desktop;
struct roots_view *view = view_at( struct roots_view *view;
desktop, input->cursor->x, input->cursor->y); switch (input->mode) {
case ROOTS_CURSOR_PASSTHROUGH:
view = view_at(desktop, input->cursor->x, input->cursor->y);
if (view) { if (view) {
struct wlr_box box; struct wlr_box box;
view_get_input_bounds(view, &box); view_get_input_bounds(view, &box);
@ -31,6 +24,23 @@ void cursor_update_position(struct roots_input *input, uint32_t time) {
} else { } else {
wlr_seat_pointer_clear_focus(input->wl_seat); 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, 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; int i;
switch (event->state) { switch (event->state) {
case WLR_BUTTON_RELEASED: case WLR_BUTTON_RELEASED:
/* input->active_view = NULL;
if (sample->motion_context.surface) {
sample->motion_context.surface = NULL;
}
*/
break; break;
case WLR_BUTTON_PRESSED: case WLR_BUTTON_PRESSED:
i = input->input_events_idx; 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) { static void handle_tool_tip(struct wl_listener *listener, void *data) {
/* TODO
struct roots_input *input = wl_container_of(listener, input, tool_tip); struct roots_input *input = wl_container_of(listener, input, tool_tip);
struct wlr_event_tablet_tool_tip *event = data; struct wlr_event_tablet_tool_tip *event = data;
struct wlr_xdg_surface_v6 *surface = struct roots_desktop *desktop = input->server->desktop;
example_xdg_surface_at(sample, sample->cursor->x, sample->cursor->y); struct roots_view *view = view_at(
example_set_focused_surface(sample, surface); desktop, input->cursor->x, input->cursor->y);
set_view_focus(input, desktop, view);
wlr_seat_pointer_send_button(sample->wl_seat, (uint32_t)event->time_usec, wlr_seat_pointer_send_button(input->wl_seat, (uint32_t)event->time_usec,
BTN_LEFT, event->state); BTN_LEFT, event->state);
*/
} }
void cursor_initialize(struct roots_input *input) { void cursor_initialize(struct roots_input *input) {

Loading…
Cancel
Save