aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/egl.h9
-rw-r--r--include/wlr/interfaces/wlr_keyboard.h5
-rw-r--r--include/wlr/interfaces/wlr_output.h3
-rw-r--r--include/wlr/render.h15
-rw-r--r--include/wlr/render/interface.h2
-rw-r--r--include/wlr/types/wlr_keyboard.h2
-rw-r--r--include/wlr/types/wlr_output.h5
-rw-r--r--include/wlr/types/wlr_screenshooter.h26
-rw-r--r--include/wlr/types/wlr_seat.h155
-rw-r--r--include/wlr/types/wlr_surface.h2
-rw-r--r--include/wlr/types/wlr_xdg_shell_v6.h38
11 files changed, 238 insertions, 24 deletions
diff --git a/include/wlr/egl.h b/include/wlr/egl.h
index 25329175..9ab4d9ce 100644
--- a/include/wlr/egl.h
+++ b/include/wlr/egl.h
@@ -10,15 +10,6 @@ struct wlr_egl {
EGLConfig config;
EGLContext context;
- PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display;
- PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window_surface;
-
- PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
- PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
- PFNEGLQUERYWAYLANDBUFFERWL eglQueryWaylandBufferWL;
- PFNEGLBINDWAYLANDDISPLAYWL eglBindWaylandDisplayWL;
- PFNEGLUNBINDWAYLANDDISPLAYWL eglUnbindWaylandDisplayWL;
-
const char *egl_exts;
const char *gl_exts;
diff --git a/include/wlr/interfaces/wlr_keyboard.h b/include/wlr/interfaces/wlr_keyboard.h
index 78c1f753..570f5721 100644
--- a/include/wlr/interfaces/wlr_keyboard.h
+++ b/include/wlr/interfaces/wlr_keyboard.h
@@ -11,7 +11,10 @@ struct wlr_keyboard_impl {
void wlr_keyboard_init(struct wlr_keyboard *keyboard, struct wlr_keyboard_impl *impl);
void wlr_keyboard_destroy(struct wlr_keyboard *keyboard);
-void wlr_keyboard_update_state(struct wlr_keyboard *keyboard,
+void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
struct wlr_event_keyboard_key *event);
+void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
+ uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
+ uint32_t group);
#endif
diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h
index 7ed19ed9..7d2821e0 100644
--- a/include/wlr/interfaces/wlr_output.h
+++ b/include/wlr/interfaces/wlr_output.h
@@ -10,7 +10,8 @@ struct wlr_output_impl {
void (*transform)(struct wlr_output *output,
enum wl_output_transform transform);
bool (*set_cursor)(struct wlr_output *output, const uint8_t *buf,
- int32_t stride, uint32_t width, uint32_t height);
+ int32_t stride, uint32_t width, uint32_t height,
+ int32_t hotspot_x, int32_t hotspot_y);
bool (*move_cursor)(struct wlr_output *output, int x, int y);
void (*destroy)(struct wlr_output *output);
void (*make_current)(struct wlr_output *output);
diff --git a/include/wlr/render.h b/include/wlr/render.h
index 2fbfb476..5027064d 100644
--- a/include/wlr/render.h
+++ b/include/wlr/render.h
@@ -30,27 +30,32 @@ struct wlr_texture *wlr_render_texture_create(struct wlr_renderer *r);
* This will render the texture at <123, 321>.
*/
bool wlr_render_with_matrix(struct wlr_renderer *r,
- struct wlr_texture *texture, const float (*matrix)[16]);
+ struct wlr_texture *texture, const float (*matrix)[16]);
/**
* Renders a solid quad in the specified color.
*/
void wlr_render_colored_quad(struct wlr_renderer *r,
- const float (*color)[4], const float (*matrix)[16]);
+ const float (*color)[4], const float (*matrix)[16]);
/**
* Renders a solid ellipse in the specified color.
*/
void wlr_render_colored_ellipse(struct wlr_renderer *r,
- const float (*color)[4], const float (*matrix)[16]);
+ const float (*color)[4], const float (*matrix)[16]);
/**
* Returns a list of pixel formats supported by this renderer.
*/
const enum wl_shm_format *wlr_renderer_get_formats(
- struct wlr_renderer *r, size_t *len);
+ struct wlr_renderer *r, size_t *len);
/**
* Returns true if this wl_buffer is a DRM buffer.
*/
bool wlr_renderer_buffer_is_drm(struct wlr_renderer *renderer,
- struct wl_resource *buffer);
+ struct wl_resource *buffer);
+/**
+ * Reads pixels and stores them in out_data as ARGB8888.
+ */
+void wlr_renderer_read_pixels(struct wlr_renderer *r, int x, int y,
+ int width, int height, void *out_data);
/**
* Destroys this wlr_renderer. Textures must be destroyed separately.
*/
diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h
index cbe33822..bbc5acb4 100644
--- a/include/wlr/render/interface.h
+++ b/include/wlr/render/interface.h
@@ -28,6 +28,8 @@ struct wlr_renderer_impl {
struct wlr_renderer *renderer, size_t *len);
bool (*buffer_is_drm)(struct wlr_renderer *renderer,
struct wl_resource *buffer);
+ void (*read_pixels)(struct wlr_renderer *renderer, int x, int y, int width,
+ int height, void *out_data);
void (*destroy)(struct wlr_renderer *renderer);
};
diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h
index 9ec8ddd4..a6726a7c 100644
--- a/include/wlr/types/wlr_keyboard.h
+++ b/include/wlr/types/wlr_keyboard.h
@@ -3,6 +3,7 @@
#include <wayland-server.h>
#include <stdint.h>
+#include <stdbool.h>
#include <wayland-server.h>
#include <xkbcommon/xkbcommon.h>
@@ -65,6 +66,7 @@ struct wlr_event_keyboard_key {
uint32_t time_sec;
uint64_t time_usec;
uint32_t keycode;
+ bool update_state;
enum wlr_key_state state;
};
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index 3208acac..52d377e3 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -37,6 +37,7 @@ struct wlr_output {
struct {
struct wl_signal frame;
+ struct wl_signal swap_buffers;
struct wl_signal resolution;
struct wl_signal destroy;
} events;
@@ -45,6 +46,7 @@ struct wlr_output {
bool is_sw;
int32_t x, y;
uint32_t width, height;
+ int32_t hotspot_x, hotspot_y;
struct wlr_renderer *renderer;
struct wlr_texture *texture;
} cursor;
@@ -58,7 +60,8 @@ bool wlr_output_set_mode(struct wlr_output *output,
void wlr_output_transform(struct wlr_output *output,
enum wl_output_transform transform);
bool wlr_output_set_cursor(struct wlr_output *output,
- const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height);
+ const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
+ int32_t hotspot_x, int32_t hotspot_y);
bool wlr_output_move_cursor(struct wlr_output *output, int x, int y);
void wlr_output_destroy(struct wlr_output *output);
void wlr_output_effective_resolution(struct wlr_output *output,
diff --git a/include/wlr/types/wlr_screenshooter.h b/include/wlr/types/wlr_screenshooter.h
new file mode 100644
index 00000000..4bda3d3c
--- /dev/null
+++ b/include/wlr/types/wlr_screenshooter.h
@@ -0,0 +1,26 @@
+#ifndef _WLR_SCREENSHOOTER_H
+#define _WLR_SCREENSHOOTER_H
+#include <wayland-server.h>
+
+struct wlr_screenshooter {
+ struct wl_global *wl_global;
+ struct wlr_renderer *renderer;
+
+ void *data;
+};
+
+struct wlr_screenshot {
+ struct wl_resource *resource;
+ struct wl_resource *output_resource;
+
+ struct wlr_output *output;
+ struct wlr_screenshooter *screenshooter;
+
+ void* data;
+};
+
+struct wlr_screenshooter *wlr_screenshooter_create(struct wl_display *display,
+ struct wlr_renderer *renderer);
+void wlr_screenshooter_destroy(struct wlr_screenshooter *screenshooter);
+
+#endif
diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h
index 489bd529..d3d3e00d 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -24,6 +24,52 @@ struct wlr_seat_handle {
struct wl_list link;
};
+struct wlr_seat_pointer_grab;
+
+struct wlr_pointer_grab_interface {
+ void (*enter)(struct wlr_seat_pointer_grab *grab,
+ struct wlr_surface *surface, double sx, double sy);
+ void (*motion)(struct wlr_seat_pointer_grab *grab, uint32_t time,
+ double sx, double sy);
+ uint32_t (*button)(struct wlr_seat_pointer_grab *grab, uint32_t time,
+ uint32_t button, uint32_t state);
+ void (*axis)(struct wlr_seat_pointer_grab *grab, uint32_t time,
+ enum wlr_axis_orientation orientation, double value);
+ void (*cancel)(struct wlr_seat_pointer_grab *grab);
+};
+
+struct wlr_seat_keyboard_grab;
+
+struct wlr_keyboard_grab_interface {
+ void (*enter)(struct wlr_seat_keyboard_grab *grab, 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 (*cancel)(struct wlr_seat_keyboard_grab *grab);
+};
+
+/**
+ * Passed to `wlr_seat_keyboard_start_grab()` to start a grab of the keyboard.
+ * The grabber is responsible for handling keyboard events for the seat.
+ */
+struct wlr_seat_keyboard_grab {
+ const struct wlr_keyboard_grab_interface *interface;
+ struct wlr_seat *seat;
+ void *data;
+};
+
+/**
+ * Passed to `wlr_seat_pointer_start_grab()` to start a grab of the pointer. The
+ * grabber is responsible for handling pointer events for the seat.
+ */
+struct wlr_seat_pointer_grab {
+ const struct wlr_pointer_grab_interface *interface;
+ struct wlr_seat *seat;
+ void *data;
+};
+
struct wlr_seat_pointer_state {
struct wlr_seat *wlr_seat;
struct wlr_seat_handle *focused_handle;
@@ -31,6 +77,9 @@ struct wlr_seat_pointer_state {
struct wl_listener surface_destroy;
struct wl_listener resource_destroy;
+
+ struct wlr_seat_pointer_grab *grab;
+ struct wlr_seat_pointer_grab *default_grab;
};
struct wlr_seat_keyboard {
@@ -50,6 +99,9 @@ struct wlr_seat_keyboard_state {
struct wl_listener surface_destroy;
struct wl_listener resource_destroy;
+
+ struct wlr_seat_keyboard_grab *grab;
+ struct wlr_seat_keyboard_grab *default_grab;
};
struct wlr_seat {
@@ -67,12 +119,17 @@ struct wlr_seat {
struct {
struct wl_signal client_bound;
struct wl_signal client_unbound;
+
+ struct wl_signal pointer_grab_begin;
+ struct wl_signal pointer_grab_end;
+
+ struct wl_signal keyboard_grab_begin;
+ struct wl_signal keyboard_grab_end;
} events;
void *data;
};
-
/**
* Allocates a new wlr_seat and adds a wl_seat global to the display.
*/
@@ -109,6 +166,8 @@ bool wlr_seat_pointer_surface_has_focus(struct wlr_seat *wlr_seat,
* Send a pointer enter event to the given surface and consider it to be the
* focused surface for the pointer. This will send a leave event to the last
* surface that was entered. Coordinates for the enter event are surface-local.
+ * Compositor should use `wlr_seat_pointer_notify_enter()` to change pointer
+ * focus to respect pointer grabs.
*/
void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
struct wlr_surface *surface, double sx, double sy);
@@ -120,22 +179,72 @@ void wlr_seat_pointer_clear_focus(struct wlr_seat *wlr_seat);
/**
* Send a motion event to the surface with pointer focus. Coordinates for the
- * motion event are surface-local.
+ * motion event are surface-local. Compositors should use
+ * `wlr_seat_pointer_notify_motion()` to send motion events to respect pointer
+ * grabs.
*/
void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time,
double sx, double sy);
/**
* Send a button event to the surface with pointer focus. Coordinates for the
- * button event are surface-local. Returns the serial.
+ * button event are surface-local. Returns the serial. Compositors should use
+ * `wlr_seat_pointer_notify_button()` to send button events to respect pointer
+ * grabs.
*/
uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, uint32_t time,
uint32_t button, uint32_t state);
+/**
+ * Send an axis event to the surface with pointer focus. Compositors should use
+ * `wlr_seat_pointer_notify_axis()` to send axis events to respect pointer
+ * grabs.
+ **/
void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
enum wlr_axis_orientation orientation, double value);
/**
+ * Start a grab of the pointer of this seat. The grabber is responsible for
+ * handling all pointer events until the grab ends.
+ */
+void wlr_seat_pointer_start_grab(struct wlr_seat *wlr_seat,
+ struct wlr_seat_pointer_grab *grab);
+
+/**
+ * End the grab of the pointer of this seat. This reverts the grab back to the
+ * default grab for the pointer.
+ */
+void wlr_seat_pointer_end_grab(struct wlr_seat *wlr_seat);
+
+/**
+ * Notify the seat of a pointer enter event to the given surface and request it to be the
+ * focused surface for the pointer. Pass surface-local coordinates where the
+ * enter occurred.
+ */
+void wlr_seat_pointer_notify_enter(struct wlr_seat *wlr_seat,
+ struct wlr_surface *surface, double sx, double sy);
+
+/**
+ * Notify the seat of motion over the given surface. Pass surface-local
+ * coordinates where the pointer motion occurred.
+ */
+void wlr_seat_pointer_notify_motion(struct wlr_seat *wlr_seat, uint32_t time,
+ double sx, double sy);
+
+/**
+ * Notify the seat that a button has been pressed. Returns the serial of the
+ * button press or zero if no button press was sent.
+ */
+uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat,
+ uint32_t time, uint32_t button, uint32_t state);
+
+/**
+ * Notify the seat of an axis event.
+ */
+void wlr_seat_pointer_notify_axis(struct wlr_seat *wlr_seat, uint32_t time,
+ enum wlr_axis_orientation orientation, double value);
+
+/**
* Attaches this keyboard to the seat. Key events from this keyboard will be
* propegated to the focused client.
*/
@@ -150,9 +259,47 @@ void wlr_seat_attach_keyboard(struct wlr_seat *seat,
void wlr_seat_detach_keyboard(struct wlr_seat *seat, struct wlr_keyboard *kb);
/**
+ * Start a grab of the keyboard of this seat. The grabber is responsible for
+ * handling all keyboard events until the grab ends.
+ */
+void wlr_seat_keyboard_start_grab(struct wlr_seat *wlr_seat,
+ struct wlr_seat_keyboard_grab *grab);
+
+/**
+ * End the grab of the keyboard of this seat. This reverts the grab back to the
+ * default grab for the keyboard.
+ */
+void wlr_seat_keyboard_end_grab(struct wlr_seat *wlr_seat);
+
+/**
+ * Send the keyboard key to focused keyboard resources. Compositors should use
+ * `wlr_seat_attach_keyboard()` to automatically handle keyboard events.
+ */
+void wlr_seat_keyboard_send_key(struct wlr_seat *seat, uint32_t time,
+ uint32_t key, uint32_t state);
+
+/**
+ * Send the modifier state to focused keyboard resources. Compositors should use
+ * `wlr_seat_attach_keyboard()` to automatically handle keyboard events.
+ */
+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);
+
+/**
+ * Notify the seat that the keyboard focus has changed and request it to be the
+ * focused surface for this keyboard. Defers to any current grab of the seat's
+ * keyboard.
+ */
+void wlr_seat_keyboard_notify_enter(struct wlr_seat *wlr_seat,
+ struct wlr_surface *surface);
+
+/**
* Send a keyboard enter event to the given surface and consider it to be the
* focused surface for the keyboard. This will send a leave event to the last
- * surface that was entered. Pass an array of currently pressed keys.
+ * surface that was entered. Compositors should use
+ * `wlr_seat_keyboard_notify_enter()` to change keyboard focus to respect
+ * keyboard grabs.
*/
void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat,
struct wlr_surface *surface);
diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h
index 23e53811..9f898b38 100644
--- a/include/wlr/types/wlr_surface.h
+++ b/include/wlr/types/wlr_surface.h
@@ -71,7 +71,7 @@ struct wlr_surface {
struct {
struct wl_signal commit;
struct wl_signal destroy;
- } signals;
+ } events;
// destroy listener used by compositor
struct wl_listener compositor_listener;
diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h
index cc52d9c7..00295ec1 100644
--- a/include/wlr/types/wlr_xdg_shell_v6.h
+++ b/include/wlr/types/wlr_xdg_shell_v6.h
@@ -2,11 +2,13 @@
#define WLR_TYPES_WLR_XDG_SHELL_V6_H
#include <wlr/types/wlr_box.h>
+#include <wlr/types/wlr_seat.h>
#include <wayland-server.h>
struct wlr_xdg_shell_v6 {
struct wl_global *wl_global;
struct wl_list clients;
+ struct wl_list popup_grabs;
uint32_t ping_timeout;
struct {
@@ -28,6 +30,27 @@ struct wlr_xdg_client_v6 {
struct wl_event_source *ping_timer;
};
+struct wlr_xdg_popup_v6 {
+ struct wlr_xdg_surface_v6 *base;
+
+ struct wl_resource *resource;
+ bool committed;
+ struct wlr_xdg_surface_v6 *parent;
+ struct wlr_seat *seat;
+ struct wlr_box geometry;
+
+ struct wl_list grab_link; // wlr_xdg_popup_grab_v6::popups
+};
+
+// each seat gets a popup grab
+struct wlr_xdg_popup_grab_v6 {
+ struct wl_client *client;
+ struct wlr_seat_pointer_grab pointer_grab;
+ struct wlr_seat_keyboard_grab keyboard_grab;
+ struct wlr_seat *seat;
+ struct wl_list popups;
+ struct wl_list link; // wlr_xdg_shell_v6::popup_grabs
+};
enum wlr_xdg_surface_v6_role {
WLR_XDG_SURFACE_V6_ROLE_NONE,
@@ -61,7 +84,6 @@ struct wlr_xdg_toplevel_v6 {
struct wlr_xdg_toplevel_v6_state current;
};
-// TODO split up into toplevel and popup configure
struct wlr_xdg_surface_v6_configure {
struct wl_list link; // wlr_xdg_surface_v6::configure_list
uint32_t serial;
@@ -74,7 +96,14 @@ struct wlr_xdg_surface_v6 {
struct wlr_surface *surface;
struct wl_list link; // wlr_xdg_client_v6::surfaces
enum wlr_xdg_surface_v6_role role;
- struct wlr_xdg_toplevel_v6 *toplevel_state;
+
+ union {
+ struct wlr_xdg_toplevel_v6 *toplevel_state;
+ struct wlr_xdg_popup_v6 *popup_state;
+ };
+
+ struct wl_list popups;
+ struct wl_list popup_link;
bool configured;
struct wl_event_source *configure_idle;
@@ -172,4 +201,9 @@ void wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
void wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
bool resizing);
+/**
+ * Request that this toplevel surface closes.
+ */
+void wlr_xdg_toplevel_v6_send_close(struct wlr_xdg_surface_v6 *surface);
+
#endif