aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/rootston/config.h31
-rw-r--r--include/rootston/cursor.h103
-rw-r--r--include/rootston/desktop.h2
-rw-r--r--include/rootston/input.h150
-rw-r--r--include/rootston/keyboard.h33
-rw-r--r--include/rootston/seat.h88
-rw-r--r--include/rootston/view.h21
-rw-r--r--include/rootston/xcursor.h14
-rw-r--r--include/wlr/backend/session.h2
-rw-r--r--include/wlr/types/wlr_cursor.h16
-rw-r--r--include/wlr/types/wlr_data_device.h5
-rw-r--r--include/wlr/types/wlr_keyboard.h3
-rw-r--r--include/wlr/types/wlr_output.h6
-rw-r--r--include/wlr/types/wlr_seat.h15
-rw-r--r--include/wlr/types/wlr_surface.h9
-rw-r--r--include/wlr/types/wlr_wl_shell.h6
-rw-r--r--include/wlr/types/wlr_xcursor_manager.h53
-rw-r--r--include/wlr/types/wlr_xdg_shell_v6.h14
-rw-r--r--include/wlr/xcursor.h2
-rw-r--r--include/wlr/xwayland.h1
20 files changed, 393 insertions, 181 deletions
diff --git a/include/rootston/config.h b/include/rootston/config.h
index 75c04619..71ee61c7 100644
--- a/include/rootston/config.h
+++ b/include/rootston/config.h
@@ -2,12 +2,12 @@
#define _ROOTSTON_CONFIG_H
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_input_device.h>
-#include <wlr/types/wlr_cursor.h>
-struct output_config {
+struct roots_output_config {
char *name;
enum wl_output_transform transform;
int x, y;
+ int scale;
struct wl_list link;
struct {
int width, height;
@@ -15,14 +15,15 @@ struct output_config {
} mode;
};
-struct device_config {
+struct roots_device_config {
char *name;
char *mapped_output;
struct wlr_box *mapped_box;
+ char *seat;
struct wl_list link;
};
-struct binding_config {
+struct roots_binding_config {
uint32_t modifiers;
xkb_keysym_t *keysyms;
size_t keysyms_len;
@@ -30,7 +31,7 @@ struct binding_config {
struct wl_list link;
};
-struct keyboard_config {
+struct roots_keyboard_config {
char *name;
uint32_t meta_key;
char *rules;
@@ -43,7 +44,7 @@ struct keyboard_config {
struct roots_config {
bool xwayland;
- // TODO: Multiple cursors, multiseat
+
struct {
char *mapped_output;
struct wlr_box *mapped_box;
@@ -57,29 +58,37 @@ struct roots_config {
char *startup_cmd;
};
-struct roots_config *parse_args(int argc, char *argv[]);
+/**
+ * Create a roots config from the given command line arguments. Command line
+ * arguments can specify the location of the config file. If it is not
+ * specified, the default location will be used.
+ */
+struct roots_config *roots_config_create_from_args(int argc, char *argv[]);
+/**
+ * Destroy the config and free its resources.
+ */
void roots_config_destroy(struct roots_config *config);
/**
* Get configuration for the output. If the output is not configured, returns
* NULL.
*/
-struct output_config *config_get_output(struct roots_config *config,
+struct roots_output_config *roots_config_get_output(struct roots_config *config,
struct wlr_output *output);
/**
* Get configuration for the device. If the device is not configured, returns
* NULL.
*/
-struct device_config *config_get_device(struct roots_config *config,
+struct roots_device_config *roots_config_get_device(struct roots_config *config,
struct wlr_input_device *device);
/**
* Get configuration for the keyboard. If the keyboard is not configured,
* returns NULL. A NULL device returns the default config for keyboards.
*/
-struct keyboard_config *config_get_keyboard(struct roots_config *config,
- struct wlr_input_device *device);
+struct roots_keyboard_config *roots_config_get_keyboard(
+ struct roots_config *config, struct wlr_input_device *device);
#endif
diff --git a/include/rootston/cursor.h b/include/rootston/cursor.h
new file mode 100644
index 00000000..f49b6439
--- /dev/null
+++ b/include/rootston/cursor.h
@@ -0,0 +1,103 @@
+#ifndef _ROOTSTON_CURSOR_H
+#define _ROOTSTON_CURSOR_H
+
+#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_manager *xcursor_manager;
+ 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;
+ 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;
+
+ struct wl_listener pointer_grab_begin;
+ struct wl_listener pointer_grab_end;
+
+ struct wl_listener request_set_cursor;
+};
+
+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,
+ struct wlr_event_pointer_motion *event);
+
+void roots_cursor_handle_motion_absolute(struct roots_cursor *cursor,
+ struct wlr_event_pointer_motion_absolute *event);
+
+void roots_cursor_handle_button(struct roots_cursor *cursor,
+ struct wlr_event_pointer_button *event);
+
+void roots_cursor_handle_axis(struct roots_cursor *cursor,
+ struct wlr_event_pointer_axis *event);
+
+void roots_cursor_handle_touch_down(struct roots_cursor *cursor,
+ struct wlr_event_touch_down *event);
+
+void roots_cursor_handle_touch_up(struct roots_cursor *cursor,
+ struct wlr_event_touch_up *event);
+
+void roots_cursor_handle_touch_motion(struct roots_cursor *cursor,
+ struct wlr_event_touch_motion *event);
+
+void roots_cursor_handle_tool_axis(struct roots_cursor *cursor,
+ struct wlr_event_tablet_tool_axis *event);
+
+void roots_cursor_handle_tool_tip(struct roots_cursor *cursor,
+ struct wlr_event_tablet_tool_tip *event);
+
+void roots_cursor_handle_request_set_cursor(struct roots_cursor *cursor,
+ struct wlr_seat_pointer_request_set_cursor_event *event);
+
+void roots_cursor_handle_pointer_grab_begin(struct roots_cursor *cursor,
+ struct wlr_seat_pointer_grab *grab);
+
+void roots_cursor_handle_pointer_grab_end(struct roots_cursor *cursor,
+ struct wlr_seat_pointer_grab *grab);
+
+#endif
diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h
index 376412fb..b809db43 100644
--- a/include/rootston/desktop.h
+++ b/include/rootston/desktop.h
@@ -7,6 +7,7 @@
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_wl_shell.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
+#include <wlr/types/wlr_xcursor_manager.h>
#include <wlr/types/wlr_gamma_control.h>
#include <wlr/types/wlr_screenshooter.h>
#include <wlr/types/wlr_list.h>
@@ -31,6 +32,7 @@ struct roots_desktop {
struct roots_config *config;
struct wlr_output_layout *layout;
+ struct wlr_xcursor_manager *xcursor_manager;
struct wlr_compositor *compositor;
struct wlr_wl_shell *wl_shell;
diff --git a/include/rootston/input.h b/include/rootston/input.h
index 20b73c8a..0af48577 100644
--- a/include/rootston/input.h
+++ b/include/rootston/input.h
@@ -1,171 +1,31 @@
#ifndef _ROOTSTON_INPUT_H
#define _ROOTSTON_INPUT_H
-#include <xkbcommon/xkbcommon.h>
#include <wayland-server.h>
#include <wlr/types/wlr_input_device.h>
#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"
-#define ROOTS_KEYBOARD_PRESSED_KEYSYMS_CAP 32
-
-struct roots_keyboard {
- struct roots_input *input;
- struct wlr_input_device *device;
- struct wl_listener key;
- struct wl_listener modifiers;
- struct wl_list link;
-
- xkb_keysym_t pressed_keysyms[ROOTS_KEYBOARD_PRESSED_KEYSYMS_CAP];
-};
-
-struct roots_pointer {
- struct roots_input *input;
- struct wlr_input_device *device;
- struct wl_list link;
-};
-
-struct roots_touch {
- struct roots_input *input;
- struct wlr_input_device *device;
- struct wl_list link;
-};
-
-// TODO: tablet pad
-struct roots_tablet_tool {
- struct roots_input *input;
- struct wlr_input_device *device;
- struct wl_listener axis;
- struct wl_listener proximity;
- struct wl_listener tip;
- struct wl_listener button;
- struct wl_list link;
-};
-
-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_touch_point {
- struct roots_touch *device;
- int32_t slot;
- double x, y;
- struct wl_list link;
-};
-
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;
- struct wl_list tablet_tools;
-
struct wl_listener input_add;
struct wl_listener input_remove;
- struct wl_listener cursor_motion;
- struct wl_listener cursor_motion_absolute;
- struct wl_listener cursor_button;
- struct wl_listener cursor_axis;
-
- struct wl_listener cursor_touch_down;
- struct wl_listener cursor_touch_up;
- struct wl_listener cursor_touch_motion;
-
- struct wl_listener cursor_tool_axis;
- struct wl_listener cursor_tool_tip;
-
- struct wl_listener pointer_grab_begin;
- struct wl_list touch_points;
-
- struct wl_listener pointer_grab_end;
-
- struct wl_listener request_set_cursor;
+ struct wl_list seats;
};
struct roots_input *input_create(struct roots_server *server,
struct roots_config *config);
void input_destroy(struct roots_input *input);
-void pointer_add(struct wlr_input_device *device, struct roots_input *input);
-void pointer_remove(struct wlr_input_device *device, struct roots_input *input);
-void keyboard_add(struct wlr_input_device *device, struct roots_input *input);
-void keyboard_remove(struct wlr_input_device *device, struct roots_input *input);
-void touch_add(struct wlr_input_device *device, struct roots_input *input);
-void touch_remove(struct wlr_input_device *device, struct roots_input *input);
-void tablet_tool_add(struct wlr_input_device *device, struct roots_input *input);
-void tablet_tool_remove(struct wlr_input_device *device, struct roots_input *input);
-
-void cursor_initialize(struct roots_input *input);
-void cursor_load_config(struct roots_config *config,
- struct wlr_cursor *cursor,
- struct roots_input *input,
- struct roots_desktop *desktop);
-const struct roots_input_event *get_input_event(struct roots_input *input,
- uint32_t serial);
-void view_begin_move(struct roots_input *input, struct wlr_cursor *cursor,
- struct roots_view *view);
-void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor,
- struct roots_view *view, uint32_t edges);
-
-struct wlr_xcursor *get_default_xcursor(struct wlr_xcursor_theme *theme);
-struct wlr_xcursor *get_move_xcursor(struct wlr_xcursor_theme *theme);
-struct wlr_xcursor *get_resize_xcursor(struct wlr_xcursor_theme *theme,
- uint32_t edges);
-struct wlr_xcursor *get_rotate_xcursor(struct wlr_xcursor_theme *theme);
+struct roots_seat *input_seat_from_wlr_seat(struct roots_input *input,
+ struct wlr_seat *seat);
-void set_view_focus(struct roots_input *input, struct roots_desktop *desktop,
- struct roots_view *view);
+bool input_view_has_focus(struct roots_input *input, struct roots_view *view);
#endif
diff --git a/include/rootston/keyboard.h b/include/rootston/keyboard.h
new file mode 100644
index 00000000..39650d7c
--- /dev/null
+++ b/include/rootston/keyboard.h
@@ -0,0 +1,33 @@
+#ifndef _ROOTSTON_KEYBOARD_H
+#define _ROOTSTON_KEYBOARD_H
+
+#include <xkbcommon/xkbcommon.h>
+#include "rootston/input.h"
+
+#define ROOTS_KEYBOARD_PRESSED_KEYSYMS_CAP 32
+
+struct roots_keyboard {
+ struct roots_input *input;
+ struct roots_seat *seat;
+ struct wlr_input_device *device;
+ struct roots_keyboard_config *config;
+ struct wl_list link;
+
+ struct wl_listener keyboard_key;
+ struct wl_listener keyboard_modifiers;
+
+ xkb_keysym_t pressed_keysyms_translated[ROOTS_KEYBOARD_PRESSED_KEYSYMS_CAP];
+ xkb_keysym_t pressed_keysyms_raw[ROOTS_KEYBOARD_PRESSED_KEYSYMS_CAP];
+};
+
+struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
+ struct roots_input *input);
+
+void roots_keyboard_destroy(struct roots_keyboard *keyboard);
+
+void roots_keyboard_handle_key(struct roots_keyboard *keyboard,
+ struct wlr_event_keyboard_key *event);
+
+void roots_keyboard_handle_modifiers(struct roots_keyboard *r_keyboard);
+
+#endif
diff --git a/include/rootston/seat.h b/include/rootston/seat.h
new file mode 100644
index 00000000..bef515a4
--- /dev/null
+++ b/include/rootston/seat.h
@@ -0,0 +1,88 @@
+#ifndef _ROOTSTON_SEAT_H
+#define _ROOTSTON_SEAT_H
+#include <wayland-server.h>
+#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;
+ struct wl_list touch;
+ struct wl_list tablet_tools;
+};
+
+struct roots_pointer {
+ struct roots_seat *seat;
+ struct wlr_input_device *device;
+ struct wl_list link;
+};
+
+struct roots_touch {
+ struct roots_seat *seat;
+ struct wlr_input_device *device;
+ struct wl_list link;
+};
+
+struct roots_touch_point {
+ struct roots_touch *device;
+ int32_t slot;
+ double x, y;
+ struct wl_list link;
+};
+
+struct roots_tablet_tool {
+ struct roots_seat *seat;
+ struct wlr_input_device *device;
+ struct wl_listener axis;
+ struct wl_listener proximity;
+ struct wl_listener tip;
+ struct wl_listener button;
+ struct wl_list link;
+};
+
+struct roots_seat *roots_seat_create(struct roots_input *input, char *name);
+
+void roots_seat_destroy(struct roots_seat *seat);
+
+void roots_seat_add_device(struct roots_seat *seat,
+ struct wlr_input_device *device);
+
+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
diff --git a/include/rootston/view.h b/include/rootston/view.h
index adfbe6e0..9df2ee08 100644
--- a/include/rootston/view.h
+++ b/include/rootston/view.h
@@ -11,9 +11,10 @@ struct roots_wl_shell_surface {
// TODO: Maybe destroy listener should go in roots_view
struct wl_listener destroy;
- struct wl_listener ping_timeout;
struct wl_listener request_move;
struct wl_listener request_resize;
+ struct wl_listener request_set_maximized;
+ struct wl_listener set_state;
struct wl_listener surface_commit;
};
@@ -26,6 +27,7 @@ struct roots_xdg_surface_v6 {
struct wl_listener destroy;
struct wl_listener request_move;
struct wl_listener request_resize;
+ struct wl_listener request_maximize;
struct {
bool needs_move;
@@ -42,6 +44,7 @@ struct roots_xwayland_surface {
struct wl_listener request_configure;
struct wl_listener request_move;
struct wl_listener request_resize;
+ struct wl_listener request_maximize;
struct wl_listener map_notify;
struct wl_listener unmap_notify;
};
@@ -54,8 +57,17 @@ enum roots_view_type {
struct roots_view {
struct roots_desktop *desktop;
+
double x, y;
float rotation;
+
+ bool maximized;
+ struct {
+ double x, y;
+ uint32_t width, height;
+ float rotation;
+ } saved;
+
// TODO: Something for roots-enforced width/height
enum roots_view_type type;
union {
@@ -73,25 +85,28 @@ struct roots_view {
#endif
};
struct wlr_surface *wlr_surface;
+
// TODO: This would probably be better as a field that's updated on a
// configure event from the xdg_shell
// If not then this should follow the typical type/impl pattern we use
// elsewhere
- void (*get_size)(struct roots_view *view, struct wlr_box *box);
+ void (*get_size)(const struct roots_view *view, struct wlr_box *box);
void (*activate)(struct roots_view *view, bool active);
void (*move)(struct roots_view *view, double x, double y);
void (*resize)(struct roots_view *view, uint32_t width, uint32_t height);
void (*move_resize)(struct roots_view *view, double x, double y,
uint32_t width, uint32_t height);
+ void (*maximize)(struct roots_view *view, bool maximized);
void (*close)(struct roots_view *view);
};
-void view_get_size(struct roots_view *view, struct wlr_box *box);
+void view_get_box(const struct roots_view *view, struct wlr_box *box);
void view_activate(struct roots_view *view, bool active);
void view_move(struct roots_view *view, double x, double y);
void view_resize(struct roots_view *view, uint32_t width, uint32_t height);
void view_move_resize(struct roots_view *view, double x, double y,
uint32_t width, uint32_t height);
+void view_maximize(struct roots_view *view, bool maximized);
void view_close(struct roots_view *view);
bool view_center(struct roots_view *view);
void view_setup(struct roots_view *view);
diff --git a/include/rootston/xcursor.h b/include/rootston/xcursor.h
new file mode 100644
index 00000000..bc00f79c
--- /dev/null
+++ b/include/rootston/xcursor.h
@@ -0,0 +1,14 @@
+#ifndef _ROOTSTON_XCURSOR_H
+#define _ROOTSTON_XCURSOR_H
+
+#include <stdint.h>
+
+#define ROOTS_XCURSOR_SIZE 16
+
+#define ROOTS_XCURSOR_DEFAULT "left_ptr"
+#define ROOTS_XCURSOR_MOVE "grabbing"
+#define ROOTS_XCURSOR_ROTATE "grabbing"
+
+const char *roots_xcursor_get_resize_name(uint32_t edges);
+
+#endif
diff --git a/include/wlr/backend/session.h b/include/wlr/backend/session.h
index 94002bc5..5c822ea9 100644
--- a/include/wlr/backend/session.h
+++ b/include/wlr/backend/session.h
@@ -79,6 +79,6 @@ void wlr_session_signal_add(struct wlr_session *session, int fd,
bool wlr_session_change_vt(struct wlr_session *session, unsigned vt);
size_t wlr_session_find_gpus(struct wlr_session *session,
- size_t ret_len, int ret[static ret_len]);
+ size_t ret_len, int *ret);
#endif
diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h
index 1aac2b94..0db32eb2 100644
--- a/include/wlr/types/wlr_cursor.h
+++ b/include/wlr/types/wlr_cursor.h
@@ -6,7 +6,6 @@
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_box.h>
-#include <wlr/xcursor.h>
struct wlr_cursor_state;
@@ -60,9 +59,22 @@ void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
double delta_x, double delta_y);
+/**
+ * Set the cursor image. stride is given in bytes. If pixels is NULL, hides the
+ * cursor.
+ *
+ * If scale isn't zero, the image is only set on outputs having the provided
+ * scale.
+ */
void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels,
int32_t stride, uint32_t width, uint32_t height, int32_t hotspot_x,
- int32_t hotspot_y);
+ int32_t hotspot_y, uint32_t scale);
+
+/**
+ * Set the cursor surface. The surface can be committed to update the cursor
+ * image. The surface position is substracted from the hotspot. A NULL surface
+ * commit hides the cursor.
+ */
void wlr_cursor_set_surface(struct wlr_cursor *cur, struct wlr_surface *surface,
int32_t hotspot_x, int32_t hotspot_y);
diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h
index 691e2df8..f45c15a2 100644
--- a/include/wlr/types/wlr_data_device.h
+++ b/include/wlr/types/wlr_data_device.h
@@ -75,6 +75,11 @@ struct wlr_data_device_manager *wlr_data_device_manager_create(
struct wl_display *display);
/**
+ * Destroys a wlr_data_device_manager and removes its wl_data_device_manager global.
+ */
+void wlr_data_device_manager_destroy(struct wlr_data_device_manager *manager);
+
+/**
* Creates a new wl_data_offer if there is a wl_data_source currently set as
* the seat selection and sends it to the seat client, followed by the
* wl_data_device.selection() event. If there is no current selection, the
diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h
index af837ff5..e2d50b03 100644
--- a/include/wlr/types/wlr_keyboard.h
+++ b/include/wlr/types/wlr_keyboard.h
@@ -28,6 +28,8 @@ enum wlr_keyboard_modifier {
WLR_MODIFIER_MOD5 = 128,
};
+#define WLR_KEYBOARD_KEYS_CAP 32
+
struct wlr_keyboard_impl;
struct wlr_keyboard {
@@ -41,6 +43,7 @@ struct wlr_keyboard {
xkb_led_index_t led_indexes[WLR_LED_COUNT];
xkb_mod_index_t mod_indexes[WLR_MODIFIER_COUNT];
+ uint32_t keycodes[WLR_KEYBOARD_KEYS_CAP];
struct {
xkb_mod_mask_t depressed;
xkb_mod_mask_t latched;
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index e6323f9c..cf000019 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -14,7 +14,7 @@ struct wlr_output_mode {
struct wlr_output_cursor {
struct wlr_output *output;
- int32_t x, y;
+ double x, y;
bool enabled;
uint32_t width, height;
int32_t hotspot_x, hotspot_y;
@@ -43,6 +43,7 @@ struct wlr_output {
char name[16];
char make[48];
char model[16];
+ char serial[16];
uint32_t scale;
int32_t width, height;
int32_t phys_width, phys_height; // mm
@@ -95,7 +96,8 @@ bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor,
int32_t hotspot_x, int32_t hotspot_y);
void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y);
-bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y);
+bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
+ double x, double y);
void wlr_output_cursor_destroy(struct wlr_output_cursor *cursor);
#endif
diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h
index b8b467d2..a5f00402 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -1,6 +1,6 @@
#ifndef WLR_TYPES_WLR_SEAT_H
#define WLR_TYPES_WLR_SEAT_H
-
+#include <time.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_keyboard.h>
@@ -45,9 +45,7 @@ struct wlr_keyboard_grab_interface {
struct wlr_surface *surface);
void (*key)(struct wlr_seat_keyboard_grab *grab, uint32_t time,
uint32_t key, uint32_t state);
- void (*modifiers)(struct wlr_seat_keyboard_grab *grab,
- uint32_t mods_depressed, uint32_t mods_latched,
- uint32_t mods_locked, uint32_t group);
+ void (*modifiers)(struct wlr_seat_keyboard_grab *grab);
void (*cancel)(struct wlr_seat_keyboard_grab *grab);
};
@@ -111,6 +109,7 @@ struct wlr_seat {
struct wl_list clients;
char *name;
uint32_t capabilities;
+ struct timespec last_event;
struct wlr_data_device *data_device; // TODO needed?
struct wlr_data_source *selection_source;
@@ -296,17 +295,13 @@ void wlr_seat_keyboard_notify_key(struct wlr_seat *seat, uint32_t time,
* Send the modifier state to focused keyboard resources. Compositors should use
* `wlr_seat_keyboard_notify_modifiers()` to respect any keyboard grabs.
*/
-void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat,
- uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
- uint32_t group);
+void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat);
/**
* Notify the seat that the modifiers for the keyboard have changed. Defers to
* any keyboard grabs.
*/
-void wlr_seat_keyboard_notify_modifiers(struct wlr_seat *seat,
- uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
- uint32_t group);
+void wlr_seat_keyboard_notify_modifiers(struct wlr_seat *seat);
/**
* Notify the seat that the keyboard focus has changed and request it to be the
diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h
index ea4184aa..cea53109 100644
--- a/include/wlr/types/wlr_surface.h
+++ b/include/wlr/types/wlr_surface.h
@@ -1,10 +1,10 @@
#ifndef WLR_TYPES_WLR_SURFACE_H
#define WLR_TYPES_WLR_SURFACE_H
-
#include <wayland-server.h>
#include <pixman.h>
#include <stdint.h>
#include <stdbool.h>
+#include <wlr/types/wlr_output.h>
struct wlr_frame_callback {
struct wl_resource *resource;
@@ -135,4 +135,11 @@ struct wlr_surface *wlr_surface_get_main_surface(struct wlr_surface *surface);
*/
struct wlr_subsurface *wlr_surface_subsurface_at(struct wlr_surface *surface,
double sx, double sy, double *sub_x, double *sub_y);
+
+void wlr_surface_send_enter(struct wlr_surface *surface,
+ struct wlr_output *output);
+
+void wlr_surface_send_leave(struct wlr_surface *surface,
+ struct wlr_output *output);
+
#endif
diff --git a/include/wlr/types/wlr_wl_shell.h b/include/wlr/types/wlr_wl_shell.h
index 4e814817..24936a34 100644
--- a/include/wlr/types/wlr_wl_shell.h
+++ b/include/wlr/types/wlr_wl_shell.h
@@ -42,6 +42,8 @@ struct wlr_wl_shell_popup_grab {
enum wlr_wl_shell_surface_state {
WLR_WL_SHELL_SURFACE_STATE_NONE,
WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL,
+ WLR_WL_SHELL_SURFACE_STATE_MAXIMIZED,
+ WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN,
WLR_WL_SHELL_SURFACE_STATE_TRANSIENT,
WLR_WL_SHELL_SURFACE_STATE_POPUP,
};
@@ -93,14 +95,14 @@ struct wlr_wl_shell_surface {
struct wlr_wl_shell_surface_move_event {
struct wl_client *client;
struct wlr_wl_shell_surface *surface;
- struct wlr_seat_handle *seat_handle;
+ struct wlr_seat_client *seat;
uint32_t serial;
};
struct wlr_wl_shell_surface_resize_event {
struct wl_client *client;
struct wlr_wl_shell_surface *surface;
- struct wlr_seat_handle *seat_handle;
+ struct wlr_seat_client *seat;
uint32_t serial;
enum wl_shell_surface_resize edges;
};
diff --git a/include/wlr/types/wlr_xcursor_manager.h b/include/wlr/types/wlr_xcursor_manager.h
new file mode 100644
index 00000000..c78a6e8d
--- /dev/null
+++ b/include/wlr/types/wlr_xcursor_manager.h
@@ -0,0 +1,53 @@
+#ifndef WLR_TYPES_WLR_XCURSOR_MANAGER_H
+#define WLR_TYPES_WLR_XCURSOR_MANAGER_H
+
+#include <wayland-server.h>
+#include <wlr/types/wlr_cursor.h>
+#include <wlr/xcursor.h>
+
+/**
+ * A scaled XCursor theme.
+ */
+struct wlr_xcursor_manager_theme {
+ uint32_t scale;
+ struct wlr_xcursor_theme *theme;
+ struct wl_list link;
+};
+
+/**
+ * Manage multiple XCursor themes with different scales and set `wlr_cursor`
+ * images.
+ *
+ * This manager can be used to display cursor images on multiple outputs having
+ * different scale factors.
+ */
+struct wlr_xcursor_manager {
+ char *name;
+ uint32_t size;
+ struct wl_list scaled_themes; // wlr_xcursor_manager_theme::link
+};
+
+/**
+ * Create a new XCursor manager. After initialization, scaled themes need to be
+ * loaded with `wlr_xcursor_manager_load`. `size` is the unscaled cursor theme
+ * size.
+ */
+struct wlr_xcursor_manager *wlr_xcursor_manager_create(const char *name,
+ uint32_t size);
+
+void wlr_xcursor_manager_destroy(struct wlr_xcursor_manager *manager);
+
+int wlr_xcursor_manager_load(struct wlr_xcursor_manager *manager,
+ uint32_t scale);
+
+struct wlr_xcursor *wlr_xcursor_manager_get_xcursor(
+ struct wlr_xcursor_manager *manager, const char *name, uint32_t scale);
+
+/**
+ * Set a `wlr_cursor` image. The manager uses all currently loaded scaled
+ * themes.
+ */
+void wlr_xcursor_manager_set_cursor_image(struct wlr_xcursor_manager *manager,
+ const char *name, struct wlr_cursor *cursor);
+
+#endif
diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h
index b0de41e2..e3982003 100644
--- a/include/wlr/types/wlr_xdg_shell_v6.h
+++ b/include/wlr/types/wlr_xdg_shell_v6.h
@@ -126,6 +126,8 @@ struct wlr_xdg_surface_v6 {
struct wl_signal ack_configure;
struct wl_signal ping_timeout;
+ struct wl_signal request_maximize;
+ struct wl_signal request_fullscreen;
struct wl_signal request_minimize;
struct wl_signal request_move;
struct wl_signal request_resize;
@@ -138,14 +140,14 @@ struct wlr_xdg_surface_v6 {
struct wlr_xdg_toplevel_v6_move_event {
struct wl_client *client;
struct wlr_xdg_surface_v6 *surface;
- struct wlr_seat_handle *seat_handle;
+ struct wlr_seat_client *seat;
uint32_t serial;
};
struct wlr_xdg_toplevel_v6_resize_event {
struct wl_client *client;
struct wlr_xdg_surface_v6 *surface;
- struct wlr_seat_handle *seat_handle;
+ struct wlr_seat_client *seat;
uint32_t serial;
uint32_t edges;
};
@@ -153,7 +155,7 @@ struct wlr_xdg_toplevel_v6_resize_event {
struct wlr_xdg_toplevel_v6_show_window_menu_event {
struct wl_client *client;
struct wlr_xdg_surface_v6 *surface;
- struct wlr_seat_handle *seat_handle;
+ struct wlr_seat_client *seat;
uint32_t serial;
uint32_t x;
uint32_t y;
@@ -208,6 +210,12 @@ void wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
void wlr_xdg_toplevel_v6_send_close(struct wlr_xdg_surface_v6 *surface);
/**
+ * Compute the popup position in surface-local coordinates.
+ */
+void wlr_xdg_surface_v6_popup_get_position(struct wlr_xdg_surface_v6 *surface,
+ double *popup_sx, double *popup_sy);
+
+/**
* Find a popup within this surface at the surface-local coordinates. Returns
* the popup and coordinates in the topmost surface coordinate system or NULL if
* no popup is found at that location.
diff --git a/include/wlr/xcursor.h b/include/wlr/xcursor.h
index c12d5405..b6362b06 100644
--- a/include/wlr/xcursor.h
+++ b/include/wlr/xcursor.h
@@ -61,7 +61,7 @@ struct wlr_xcursor_theme *wlr_xcursor_theme_load(const char *name, int size);
void wlr_xcursor_theme_destroy(struct wlr_xcursor_theme *theme);
struct wlr_xcursor *wlr_xcursor_theme_get_cursor(
- struct wlr_xcursor_theme *theme, const char *name);
+ struct wlr_xcursor_theme *theme, const char *name);
int wlr_xcursor_frame(struct wlr_xcursor *cursor, uint32_t time);
diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h
index bea97394..6518b703 100644
--- a/include/wlr/xwayland.h
+++ b/include/wlr/xwayland.h
@@ -29,6 +29,7 @@ struct wlr_xwayland {
struct wlr_xwayland_cursor *cursor;
struct {
+ struct wl_signal ready;
struct wl_signal new_surface;
} events;