2018-02-12 21:29:23 +01:00
|
|
|
#ifndef ROOTSTON_CURSOR_H
|
|
|
|
#define ROOTSTON_CURSOR_H
|
2017-11-05 15:20:11 +01:00
|
|
|
|
2018-08-10 18:19:16 +02:00
|
|
|
#include <wlr/types/wlr_pointer_constraints_v1.h>
|
2017-11-05 15:20:11 +01:00
|
|
|
#include "rootston/seat.h"
|
|
|
|
|
2017-11-07 21:56:11 +01:00
|
|
|
enum roots_cursor_mode {
|
|
|
|
ROOTS_CURSOR_PASSTHROUGH = 0,
|
|
|
|
ROOTS_CURSOR_MOVE = 1,
|
|
|
|
ROOTS_CURSOR_RESIZE = 2,
|
|
|
|
ROOTS_CURSOR_ROTATE = 3,
|
|
|
|
};
|
|
|
|
|
2017-11-05 15:20:11 +01:00
|
|
|
struct roots_cursor {
|
|
|
|
struct roots_seat *seat;
|
|
|
|
struct wlr_cursor *cursor;
|
|
|
|
|
2018-08-10 18:19:16 +02:00
|
|
|
struct wlr_pointer_constraint_v1 *active_constraint;
|
|
|
|
pixman_region32_t confine; // invalid if active_constraint == NULL
|
|
|
|
|
2017-12-11 10:36:22 +01:00
|
|
|
const char *default_xcursor;
|
|
|
|
|
2017-11-07 21:56:11 +01:00
|
|
|
enum roots_cursor_mode mode;
|
|
|
|
|
|
|
|
// state from input (review if this is necessary)
|
2017-11-12 11:10:56 +01:00
|
|
|
struct wlr_xcursor_manager *xcursor_manager;
|
2017-11-07 21:56:11 +01:00
|
|
|
struct wlr_seat *wl_seat;
|
|
|
|
struct wl_client *cursor_client;
|
|
|
|
int offs_x, offs_y;
|
|
|
|
int view_x, view_y, view_width, view_height;
|
|
|
|
float view_rotation;
|
|
|
|
uint32_t resize_edges;
|
|
|
|
|
2018-01-17 01:04:26 +01:00
|
|
|
struct roots_seat_view *pointer_view;
|
2018-08-06 11:39:34 +02:00
|
|
|
struct wlr_surface *wlr_surface;
|
2018-01-17 01:04:26 +01:00
|
|
|
|
2017-11-05 15:20:11 +01:00
|
|
|
struct wl_listener motion;
|
|
|
|
struct wl_listener motion_absolute;
|
|
|
|
struct wl_listener button;
|
|
|
|
struct wl_listener axis;
|
|
|
|
|
|
|
|
struct wl_listener touch_down;
|
|
|
|
struct wl_listener touch_up;
|
|
|
|
struct wl_listener touch_motion;
|
|
|
|
|
|
|
|
struct wl_listener tool_axis;
|
|
|
|
struct wl_listener tool_tip;
|
2018-04-24 08:10:45 +02:00
|
|
|
struct wl_listener tool_proximity;
|
2018-05-04 11:46:32 +02:00
|
|
|
struct wl_listener tool_button;
|
2017-11-08 21:23:56 +01:00
|
|
|
|
|
|
|
struct wl_listener request_set_cursor;
|
2018-08-10 18:19:16 +02:00
|
|
|
|
|
|
|
struct wl_listener focus_change;
|
|
|
|
|
|
|
|
struct wl_listener constraint_commit;
|
2017-11-05 15:20:11 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct roots_cursor *roots_cursor_create(struct roots_seat *seat);
|
|
|
|
|
|
|
|
void roots_cursor_destroy(struct roots_cursor *cursor);
|
|
|
|
|
|
|
|
void roots_cursor_handle_motion(struct roots_cursor *cursor,
|
2018-08-08 13:59:03 +02:00
|
|
|
struct wlr_event_pointer_motion *event);
|
2017-11-05 15:20:11 +01:00
|
|
|
|
|
|
|
void roots_cursor_handle_motion_absolute(struct roots_cursor *cursor,
|
2018-08-08 13:59:03 +02:00
|
|
|
struct wlr_event_pointer_motion_absolute *event);
|
2017-11-05 15:20:11 +01:00
|
|
|
|
|
|
|
void roots_cursor_handle_button(struct roots_cursor *cursor,
|
2018-08-08 13:59:03 +02:00
|
|
|
struct wlr_event_pointer_button *event);
|
2017-11-05 15:20:11 +01:00
|
|
|
|
|
|
|
void roots_cursor_handle_axis(struct roots_cursor *cursor,
|
2018-08-08 13:59:03 +02:00
|
|
|
struct wlr_event_pointer_axis *event);
|
2017-11-05 15:20:11 +01:00
|
|
|
|
|
|
|
void roots_cursor_handle_touch_down(struct roots_cursor *cursor,
|
2018-08-08 13:59:03 +02:00
|
|
|
struct wlr_event_touch_down *event);
|
2017-11-05 15:20:11 +01:00
|
|
|
|
|
|
|
void roots_cursor_handle_touch_up(struct roots_cursor *cursor,
|
2018-08-08 13:59:03 +02:00
|
|
|
struct wlr_event_touch_up *event);
|
2017-11-05 15:20:11 +01:00
|
|
|
|
|
|
|
void roots_cursor_handle_touch_motion(struct roots_cursor *cursor,
|
2018-08-08 13:59:03 +02:00
|
|
|
struct wlr_event_touch_motion *event);
|
2017-11-05 15:20:11 +01:00
|
|
|
|
|
|
|
void roots_cursor_handle_tool_axis(struct roots_cursor *cursor,
|
2018-08-08 13:59:03 +02:00
|
|
|
struct wlr_event_tablet_tool_axis *event);
|
2017-11-05 15:20:11 +01:00
|
|
|
|
|
|
|
void roots_cursor_handle_tool_tip(struct roots_cursor *cursor,
|
2018-08-08 13:59:03 +02:00
|
|
|
struct wlr_event_tablet_tool_tip *event);
|
2017-11-05 15:20:11 +01:00
|
|
|
|
2017-11-08 21:23:56 +01:00
|
|
|
void roots_cursor_handle_request_set_cursor(struct roots_cursor *cursor,
|
2018-08-08 13:59:03 +02:00
|
|
|
struct wlr_seat_pointer_request_set_cursor_event *event);
|
2017-11-08 21:23:56 +01:00
|
|
|
|
2018-08-10 18:19:16 +02:00
|
|
|
void roots_cursor_handle_focus_change(struct roots_cursor *cursor,
|
|
|
|
struct wlr_seat_pointer_focus_change_event *event);
|
|
|
|
|
|
|
|
void roots_cursor_handle_constraint_commit(struct roots_cursor *cursor);
|
|
|
|
|
2018-07-29 19:02:00 +02:00
|
|
|
void roots_cursor_update_position(struct roots_cursor *cursor,
|
2018-08-08 13:59:03 +02:00
|
|
|
uint32_t time);
|
2018-07-29 19:02:00 +02:00
|
|
|
|
2018-08-08 13:43:44 +02:00
|
|
|
void roots_cursor_update_focus(struct roots_cursor *cursor);
|
|
|
|
|
2018-08-10 18:19:16 +02:00
|
|
|
void roots_cursor_constrain(struct roots_cursor *cursor,
|
|
|
|
struct wlr_pointer_constraint_v1 *constraint, double sx, double sy);
|
|
|
|
|
2017-11-05 15:20:11 +01:00
|
|
|
#endif
|