2018-12-31 00:12:33 +01:00
|
|
|
#ifndef CG_SEAT_H
|
|
|
|
|
#define CG_SEAT_H
|
|
|
|
|
|
2019-12-20 17:16:53 +01:00
|
|
|
#include <wayland-server-core.h>
|
2018-12-31 00:12:33 +01:00
|
|
|
#include <wlr/types/wlr_cursor.h>
|
2019-01-11 15:20:13 +01:00
|
|
|
#include <wlr/types/wlr_data_device.h>
|
2018-12-31 00:12:33 +01:00
|
|
|
#include <wlr/types/wlr_input_device.h>
|
|
|
|
|
#include <wlr/types/wlr_seat.h>
|
|
|
|
|
#include <wlr/types/wlr_xcursor_manager.h>
|
|
|
|
|
|
|
|
|
|
#include "server.h"
|
|
|
|
|
#include "view.h"
|
|
|
|
|
|
2018-12-31 17:24:21 +01:00
|
|
|
#define DEFAULT_XCURSOR "left_ptr"
|
|
|
|
|
#define XCURSOR_SIZE 24
|
|
|
|
|
|
2018-12-31 00:12:33 +01:00
|
|
|
struct cg_seat {
|
|
|
|
|
struct wlr_seat *seat;
|
|
|
|
|
struct cg_server *server;
|
|
|
|
|
struct wl_listener destroy;
|
|
|
|
|
|
|
|
|
|
struct wl_list keyboards;
|
2020-02-21 21:19:12 +01:00
|
|
|
struct wl_list keyboard_groups;
|
2018-12-31 00:12:33 +01:00
|
|
|
struct wl_list pointers;
|
2019-01-03 22:29:08 +01:00
|
|
|
struct wl_list touch;
|
2018-12-31 00:12:33 +01:00
|
|
|
struct wl_listener new_input;
|
|
|
|
|
|
|
|
|
|
struct wlr_cursor *cursor;
|
|
|
|
|
struct wlr_xcursor_manager *xcursor_manager;
|
2023-11-09 17:14:37 +01:00
|
|
|
struct wl_listener cursor_motion_relative;
|
2018-12-31 00:12:33 +01:00
|
|
|
struct wl_listener cursor_motion_absolute;
|
|
|
|
|
struct wl_listener cursor_button;
|
|
|
|
|
struct wl_listener cursor_axis;
|
2019-02-16 01:09:27 +01:00
|
|
|
struct wl_listener cursor_frame;
|
2019-01-03 22:29:08 +01:00
|
|
|
|
|
|
|
|
int32_t touch_id;
|
2020-01-05 13:13:32 +01:00
|
|
|
double touch_lx;
|
|
|
|
|
double touch_ly;
|
2019-01-03 22:29:08 +01:00
|
|
|
struct wl_listener touch_down;
|
|
|
|
|
struct wl_listener touch_up;
|
|
|
|
|
struct wl_listener touch_motion;
|
2023-08-23 18:40:15 +02:00
|
|
|
struct wl_listener touch_frame;
|
2019-01-03 22:29:08 +01:00
|
|
|
|
2019-01-11 15:20:13 +01:00
|
|
|
struct wl_list drag_icons;
|
2019-02-25 17:12:56 -05:00
|
|
|
struct wl_listener request_start_drag;
|
|
|
|
|
struct wl_listener start_drag;
|
2019-01-11 15:20:13 +01:00
|
|
|
|
2018-12-31 00:12:33 +01:00
|
|
|
struct wl_listener request_set_cursor;
|
2019-02-16 01:23:09 +01:00
|
|
|
struct wl_listener request_set_selection;
|
|
|
|
|
struct wl_listener request_set_primary_selection;
|
2018-12-31 00:12:33 +01:00
|
|
|
};
|
|
|
|
|
|
2020-02-21 21:19:12 +01:00
|
|
|
struct cg_keyboard_group {
|
|
|
|
|
struct wlr_keyboard_group *wlr_group;
|
2018-12-31 00:12:33 +01:00
|
|
|
struct cg_seat *seat;
|
|
|
|
|
struct wl_listener key;
|
2020-02-21 21:19:12 +01:00
|
|
|
struct wl_listener modifiers;
|
|
|
|
|
struct wl_list link; // cg_seat::keyboard_groups
|
2023-01-07 14:28:40 +00:00
|
|
|
bool is_virtual;
|
2018-12-31 00:12:33 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct cg_pointer {
|
|
|
|
|
struct wl_list link; // seat::pointers
|
|
|
|
|
struct cg_seat *seat;
|
2022-10-12 03:37:05 -04:00
|
|
|
struct wlr_pointer *pointer;
|
2018-12-31 00:12:33 +01:00
|
|
|
|
|
|
|
|
struct wl_listener destroy;
|
|
|
|
|
};
|
|
|
|
|
|
2019-01-03 22:29:08 +01:00
|
|
|
struct cg_touch {
|
|
|
|
|
struct wl_list link; // seat::touch
|
|
|
|
|
struct cg_seat *seat;
|
2022-10-12 03:37:05 -04:00
|
|
|
struct wlr_touch *touch;
|
2019-01-03 22:29:08 +01:00
|
|
|
|
|
|
|
|
struct wl_listener destroy;
|
|
|
|
|
};
|
|
|
|
|
|
2019-01-11 15:20:13 +01:00
|
|
|
struct cg_drag_icon {
|
|
|
|
|
struct wl_list link; // seat::drag_icons
|
|
|
|
|
struct cg_seat *seat;
|
|
|
|
|
struct wlr_drag_icon *wlr_drag_icon;
|
2022-12-14 13:56:15 -05:00
|
|
|
struct wlr_scene_tree *scene_tree;
|
2019-12-29 16:07:14 +01:00
|
|
|
|
|
|
|
|
/* The drag icon has a position in layout coordinates. */
|
2020-01-05 13:13:32 +01:00
|
|
|
double lx, ly;
|
2019-01-11 15:20:13 +01:00
|
|
|
|
|
|
|
|
struct wl_listener destroy;
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-08 16:49:12 +01:00
|
|
|
struct cg_seat *seat_create(struct cg_server *server, struct wlr_backend *backend);
|
2019-02-02 17:13:10 +01:00
|
|
|
void seat_destroy(struct cg_seat *seat);
|
2018-12-31 00:12:33 +01:00
|
|
|
struct cg_view *seat_get_focus(struct cg_seat *seat);
|
|
|
|
|
void seat_set_focus(struct cg_seat *seat, struct cg_view *view);
|
2023-11-08 17:22:06 +01:00
|
|
|
void seat_center_cursor(struct cg_seat *seat);
|
2018-12-31 00:12:33 +01:00
|
|
|
|
|
|
|
|
#endif
|