multiseat: somewhat working

This commit is contained in:
Tony Crisci 2017-11-07 15:56:11 -05:00
parent 2280928bb2
commit 09c6092423
18 changed files with 521 additions and 219 deletions

View file

@ -3,10 +3,45 @@
#include "rootston/seat.h"
enum roots_cursor_mode {
ROOTS_CURSOR_PASSTHROUGH = 0,
ROOTS_CURSOR_MOVE = 1,
ROOTS_CURSOR_RESIZE = 2,
ROOTS_CURSOR_ROTATE = 3,
};
enum roots_cursor_resize_edge {
ROOTS_CURSOR_RESIZE_EDGE_TOP = 1,
ROOTS_CURSOR_RESIZE_EDGE_BOTTOM = 2,
ROOTS_CURSOR_RESIZE_EDGE_LEFT = 4,
ROOTS_CURSOR_RESIZE_EDGE_RIGHT = 8,
};
struct roots_input_event {
uint32_t serial;
struct wlr_cursor *cursor;
struct wlr_input_device *device;
};
struct roots_cursor {
struct roots_seat *seat;
struct wlr_cursor *cursor;
enum roots_cursor_mode mode;
// state from input (review if this is necessary)
struct wlr_xcursor_theme *xcursor_theme;
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;
// Ring buffer of input events that could trigger move/resize/rotate
int input_events_idx;
struct wl_list touch_points;
struct roots_input_event input_events[16];
struct wl_listener motion;
struct wl_listener motion_absolute;
struct wl_listener button;

View file

@ -5,64 +5,15 @@
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_seat.h>
#include <wlr/xcursor.h>
#include "rootston/cursor.h"
#include "rootston/config.h"
#include "rootston/view.h"
#include "rootston/server.h"
enum roots_cursor_mode {
ROOTS_CURSOR_PASSTHROUGH = 0,
ROOTS_CURSOR_MOVE = 1,
ROOTS_CURSOR_RESIZE = 2,
ROOTS_CURSOR_ROTATE = 3,
};
enum roots_cursor_resize_edge {
ROOTS_CURSOR_RESIZE_EDGE_TOP = 1,
ROOTS_CURSOR_RESIZE_EDGE_BOTTOM = 2,
ROOTS_CURSOR_RESIZE_EDGE_LEFT = 4,
ROOTS_CURSOR_RESIZE_EDGE_RIGHT = 8,
};
struct roots_input_event {
uint32_t serial;
struct wlr_cursor *cursor;
struct wlr_input_device *device;
};
struct roots_drag_icon {
struct wlr_surface *surface;
struct wl_list link; // roots_input::drag_icons
bool mapped;
int32_t sx;
int32_t sy;
struct wl_listener surface_destroy;
struct wl_listener surface_commit;
};
struct roots_input {
struct roots_config *config;
struct roots_server *server;
// TODO: multiseat, multicursor
struct wlr_cursor *cursor;
struct wlr_xcursor_theme *xcursor_theme;
struct wlr_seat *wl_seat;
struct wl_list drag_icons;
struct wl_client *cursor_client;
enum roots_cursor_mode mode;
struct roots_view *active_view;
int offs_x, offs_y;
int view_x, view_y, view_width, view_height;
float view_rotation;
uint32_t resize_edges;
// Ring buffer of input events that could trigger move/resize/rotate
int input_events_idx;
struct roots_input_event input_events[16];
struct wl_list keyboards;
struct wl_list pointers;
struct wl_list touch;
@ -117,4 +68,7 @@ struct wlr_xcursor *get_rotate_xcursor(struct wlr_xcursor_theme *theme);
void set_view_focus(struct roots_input *input, struct roots_desktop *desktop,
struct roots_view *view);
struct roots_seat *input_seat_from_wlr_seat(struct roots_input *input,
struct wlr_seat *seat);
#endif

View file

@ -10,6 +10,7 @@ struct roots_keyboard {
struct roots_input *input;
struct roots_seat *seat;
struct wlr_input_device *device;
struct keyboard_config *config;
struct wl_list seat_link;
// XXX temporary
struct wl_list link;

View file

@ -6,11 +6,26 @@
#include "rootston/input.h"
#include "rootston/keyboard.h"
struct roots_drag_icon {
struct wlr_surface *surface;
struct wl_list link; // roots_seat::drag_icons
bool mapped;
int32_t sx;
int32_t sy;
struct wl_listener surface_destroy;
struct wl_listener surface_commit;
};
struct roots_seat {
struct roots_input *input;
struct wlr_seat *seat;
struct roots_cursor *cursor;
struct wl_list link;
struct wl_list drag_icons;
struct roots_view *focus;
struct wl_list keyboards;
struct wl_list pointers;
@ -57,4 +72,19 @@ void roots_seat_add_device(struct roots_seat *seat,
void roots_seat_remove_device(struct roots_seat *seat,
struct wlr_input_device *device);
void roots_seat_configure_cursor(struct roots_seat *seat);
void roots_seat_configure_xcursor(struct roots_seat *seat);
bool roots_seat_has_meta_pressed(struct roots_seat *seat);
void roots_seat_focus_view(struct roots_seat *seat, struct roots_view *view);
void roots_seat_begin_move(struct roots_seat *seat, struct roots_view *view);
void roots_seat_begin_resize(struct roots_seat *seat, struct roots_view *view,
uint32_t edges);
void roots_seat_begin_rotate(struct roots_seat *seat, struct roots_view *view);
#endif