aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/backend.h9
-rw-r--r--include/wlr/backend/drm.h2
-rw-r--r--include/wlr/backend/interface.h3
-rw-r--r--include/wlr/backend/multi.h1
-rw-r--r--include/wlr/interfaces/wlr_output.h9
-rw-r--r--include/wlr/render/dmabuf.h4
-rw-r--r--include/wlr/render/egl.h1
-rw-r--r--include/wlr/render/interface.h11
-rw-r--r--include/wlr/render/wlr_renderer.h5
-rw-r--r--include/wlr/render/wlr_texture.h7
-rw-r--r--include/wlr/types/meson.build11
-rw-r--r--include/wlr/types/wlr_box.h3
-rw-r--r--include/wlr/types/wlr_cursor.h12
-rw-r--r--include/wlr/types/wlr_data_device.h1
-rw-r--r--include/wlr/types/wlr_input_method_v2.h87
-rw-r--r--include/wlr/types/wlr_output.h40
-rw-r--r--include/wlr/types/wlr_pointer_constraints_v1.h102
-rw-r--r--include/wlr/types/wlr_presentation_time.h59
-rw-r--r--include/wlr/types/wlr_region.h3
-rw-r--r--include/wlr/types/wlr_seat.h15
-rw-r--r--include/wlr/types/wlr_surface.h5
-rw-r--r--include/wlr/types/wlr_text_input_v3.h93
-rw-r--r--include/wlr/util/region.h5
-rw-r--r--include/wlr/xwayland.h1
24 files changed, 463 insertions, 26 deletions
diff --git a/include/wlr/backend.h b/include/wlr/backend.h
index 39d072e2..54f2b5e8 100644
--- a/include/wlr/backend.h
+++ b/include/wlr/backend.h
@@ -57,5 +57,14 @@ void wlr_backend_destroy(struct wlr_backend *backend);
* Obtains the wlr_renderer reference this backend is using.
*/
struct wlr_renderer *wlr_backend_get_renderer(struct wlr_backend *backend);
+/**
+ * Obtains the wlr_session reference from this backend if there is any.
+ * Might return NULL for backends that don't use a session.
+ */
+struct wlr_session *wlr_backend_get_session(struct wlr_backend *backend);
+/**
+ * Returns the clock used by the backend for presentation feedback.
+ */
+clockid_t wlr_backend_get_presentation_clock(struct wlr_backend *backend);
#endif
diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h
index 5d47647d..3724adfb 100644
--- a/include/wlr/backend/drm.h
+++ b/include/wlr/backend/drm.h
@@ -34,6 +34,4 @@ bool wlr_output_is_drm(struct wlr_output *output);
typedef struct _drmModeModeInfo drmModeModeInfo;
bool wlr_drm_connector_add_mode(struct wlr_output *output, const drmModeModeInfo *mode);
-struct wlr_session *wlr_drm_backend_get_session(struct wlr_backend *backend);
-
#endif
diff --git a/include/wlr/backend/interface.h b/include/wlr/backend/interface.h
index f3dee69b..4a6a5cbb 100644
--- a/include/wlr/backend/interface.h
+++ b/include/wlr/backend/interface.h
@@ -10,6 +10,7 @@
#define WLR_BACKEND_INTERFACE_H
#include <stdbool.h>
+#include <time.h>
#include <wlr/backend.h>
#include <wlr/render/egl.h>
@@ -17,6 +18,8 @@ struct wlr_backend_impl {
bool (*start)(struct wlr_backend *backend);
void (*destroy)(struct wlr_backend *backend);
struct wlr_renderer *(*get_renderer)(struct wlr_backend *backend);
+ struct wlr_session *(*get_session)(struct wlr_backend *backend);
+ clockid_t (*get_presentation_clock)(struct wlr_backend *backend);
};
/**
diff --git a/include/wlr/backend/multi.h b/include/wlr/backend/multi.h
index ef908d26..0687f4b6 100644
--- a/include/wlr/backend/multi.h
+++ b/include/wlr/backend/multi.h
@@ -28,7 +28,6 @@ void wlr_multi_backend_remove(struct wlr_backend *multi,
struct wlr_backend *backend);
bool wlr_backend_is_multi(struct wlr_backend *backend);
-struct wlr_session *wlr_multi_get_session(struct wlr_backend *base);
bool wlr_multi_is_empty(struct wlr_backend *backend);
void wlr_multi_for_each_backend(struct wlr_backend *backend,
diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h
index 4cbf0d67..f7ffe3b4 100644
--- a/include/wlr/interfaces/wlr_output.h
+++ b/include/wlr/interfaces/wlr_output.h
@@ -28,11 +28,12 @@ struct wlr_output_impl {
void (*destroy)(struct wlr_output *output);
bool (*make_current)(struct wlr_output *output, int *buffer_age);
bool (*swap_buffers)(struct wlr_output *output, pixman_region32_t *damage);
- bool (*set_gamma)(struct wlr_output *output,
- uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b);
- uint32_t (*get_gamma_size)(struct wlr_output *output);
+ bool (*set_gamma)(struct wlr_output *output, size_t size,
+ const uint16_t *r, const uint16_t *g, const uint16_t *b);
+ size_t (*get_gamma_size)(struct wlr_output *output);
bool (*export_dmabuf)(struct wlr_output *output,
struct wlr_dmabuf_attributes *attribs);
+ bool (*schedule_frame)(struct wlr_output *output);
};
void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
@@ -45,5 +46,7 @@ void wlr_output_update_enabled(struct wlr_output *output, bool enabled);
void wlr_output_update_needs_swap(struct wlr_output *output);
void wlr_output_damage_whole(struct wlr_output *output);
void wlr_output_send_frame(struct wlr_output *output);
+void wlr_output_send_present(struct wlr_output *output,
+ struct wlr_output_event_present *event);
#endif
diff --git a/include/wlr/render/dmabuf.h b/include/wlr/render/dmabuf.h
index 33c3a129..32cfe874 100644
--- a/include/wlr/render/dmabuf.h
+++ b/include/wlr/render/dmabuf.h
@@ -16,6 +16,10 @@
#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
#endif
+#ifndef DRM_FORMAT_MOD_LINEAR
+#define DRM_FORMAT_MOD_LINEAR 0
+#endif
+
#define WLR_DMABUF_MAX_PLANES 4
enum wlr_dmabuf_attributes_flags {
diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h
index c42b0325..30de3d26 100644
--- a/include/wlr/render/egl.h
+++ b/include/wlr/render/egl.h
@@ -17,6 +17,7 @@
#include <wlr/render/dmabuf.h>
struct wlr_egl {
+ EGLenum platform;
EGLDisplay display;
EGLConfig config;
EGLContext context;
diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h
index 63f4265c..6b80a077 100644
--- a/include/wlr/render/interface.h
+++ b/include/wlr/render/interface.h
@@ -34,6 +34,8 @@ struct wlr_renderer_impl {
const float color[static 4], const float matrix[static 9]);
const enum wl_shm_format *(*formats)(
struct wlr_renderer *renderer, size_t *len);
+ bool (*format_supported)(struct wlr_renderer *renderer,
+ enum wl_shm_format fmt);
bool (*resource_is_wl_drm_buffer)(struct wlr_renderer *renderer,
struct wl_resource *resource);
void (*wl_drm_buffer_get_size)(struct wlr_renderer *renderer,
@@ -41,12 +43,11 @@ struct wlr_renderer_impl {
int (*get_dmabuf_formats)(struct wlr_renderer *renderer, int **formats);
int (*get_dmabuf_modifiers)(struct wlr_renderer *renderer, int format,
uint64_t **modifiers);
+ enum wl_shm_format (*preferred_read_format)(struct wlr_renderer *renderer);
bool (*read_pixels)(struct wlr_renderer *renderer, enum wl_shm_format fmt,
uint32_t *flags, uint32_t stride, uint32_t width, uint32_t height,
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
void *data);
- bool (*format_supported)(struct wlr_renderer *renderer,
- enum wl_shm_format fmt);
struct wlr_texture *(*texture_from_pixels)(struct wlr_renderer *renderer,
enum wl_shm_format fmt, uint32_t stride, uint32_t width,
uint32_t height, const void *data);
@@ -66,9 +67,9 @@ struct wlr_texture_impl {
void (*get_size)(struct wlr_texture *texture, int *width, int *height);
bool (*is_opaque)(struct wlr_texture *texture);
bool (*write_pixels)(struct wlr_texture *texture,
- enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width,
- uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t dst_x,
- uint32_t dst_y, const void *data);
+ uint32_t stride, uint32_t width, uint32_t height,
+ uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
+ const void *data);
bool (*to_dmabuf)(struct wlr_texture *texture,
struct wlr_dmabuf_attributes *attribs);
void (*destroy)(struct wlr_texture *texture);
diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h
index 9c031b7f..02b4a11e 100644
--- a/include/wlr/render/wlr_renderer.h
+++ b/include/wlr/render/wlr_renderer.h
@@ -97,6 +97,11 @@ int wlr_renderer_get_dmabuf_formats(struct wlr_renderer *renderer,
int wlr_renderer_get_dmabuf_modifiers(struct wlr_renderer *renderer, int format,
uint64_t **modifiers);
/**
+ * Get the preferred format for reading pixels.
+ */
+bool wlr_renderer_preferred_read_format(struct wlr_renderer *renderer,
+ enum wl_shm_format *fmt);
+/**
* Reads out of pixels of the currently bound surface into data. `stride` is in
* bytes.
*
diff --git a/include/wlr/render/wlr_texture.h b/include/wlr/render/wlr_texture.h
index dbfabfee..f210717a 100644
--- a/include/wlr/render/wlr_texture.h
+++ b/include/wlr/render/wlr_texture.h
@@ -54,10 +54,11 @@ void wlr_texture_get_size(struct wlr_texture *texture, int *width, int *height);
bool wlr_texture_is_opaque(struct wlr_texture *texture);
/**
- * Update a texture with raw pixels. The texture must be mutable.
- */
+ * Update a texture with raw pixels. The texture must be mutable, and the input
+ * data must have the same pixel format that the texture was created with.
+ */
bool wlr_texture_write_pixels(struct wlr_texture *texture,
- enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width, uint32_t height,
+ uint32_t stride, uint32_t width, uint32_t height,
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
const void *data);
diff --git a/include/wlr/types/meson.build b/include/wlr/types/meson.build
index 6a8955c3..3f61ae20 100644
--- a/include/wlr/types/meson.build
+++ b/include/wlr/types/meson.build
@@ -5,21 +5,23 @@ install_headers(
'wlr_cursor.h',
'wlr_data_device.h',
'wlr_export_dmabuf_v1.h',
- 'wlr_gamma_control.h',
'wlr_gamma_control_v1.h',
- 'wlr_idle.h',
+ 'wlr_gamma_control.h',
'wlr_idle_inhibit_v1.h',
+ 'wlr_idle.h',
'wlr_input_device.h',
'wlr_input_inhibitor.h',
+ 'wlr_input_method_v2.h',
'wlr_keyboard.h',
'wlr_layer_shell_v1.h',
'wlr_linux_dmabuf_v1.h',
'wlr_list.h',
'wlr_matrix.h',
- 'wlr_output.h',
'wlr_output_damage.h',
'wlr_output_layout.h',
+ 'wlr_output.h',
'wlr_pointer.h',
+ 'wlr_presentation_time.h',
'wlr_primary_selection.h',
'wlr_region.h',
'wlr_screencopy_v1.h',
@@ -30,13 +32,14 @@ install_headers(
'wlr_tablet_pad.h',
'wlr_tablet_tool.h',
'wlr_tablet_v2.h',
+ 'wlr_text_input_v3.h',
'wlr_touch.h',
'wlr_virtual_keyboard_v1.h',
'wlr_wl_shell.h',
'wlr_xcursor_manager.h',
'wlr_xdg_decoration_v1.h',
'wlr_xdg_output_v1.h',
- 'wlr_xdg_shell.h',
'wlr_xdg_shell_v6.h',
+ 'wlr_xdg_shell.h',
subdir: 'wlr/types',
)
diff --git a/include/wlr/types/wlr_box.h b/include/wlr/types/wlr_box.h
index 11a53b56..8e25918b 100644
--- a/include/wlr/types/wlr_box.h
+++ b/include/wlr/types/wlr_box.h
@@ -9,6 +9,7 @@
#ifndef WLR_TYPES_WLR_BOX_H
#define WLR_TYPES_WLR_BOX_H
+#include <pixman.h>
#include <stdbool.h>
#include <wayland-server.h>
@@ -40,4 +41,6 @@ void wlr_box_transform(const struct wlr_box *box,
void wlr_box_rotated_bounds(const struct wlr_box *box, float rotation,
struct wlr_box *dest);
+void wlr_box_from_pixman_box32(const pixman_box32_t box, struct wlr_box *dest);
+
#endif
diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h
index ba582be9..44ced1f0 100644
--- a/include/wlr/types/wlr_cursor.h
+++ b/include/wlr/types/wlr_cursor.h
@@ -91,6 +91,18 @@ bool wlr_cursor_warp(struct wlr_cursor *cur, struct wlr_input_device *dev,
void wlr_cursor_absolute_to_layout_coords(struct wlr_cursor *cur,
struct wlr_input_device *dev, double x, double y, double *lx, double *ly);
+
+/**
+ * Warp the cursor to the given x and y coordinates. If the given point is out
+ * of the layout boundaries or constraints, the closest point will be used.
+ * If one coordinate is NAN, it will be ignored.
+ *
+ * `dev` may be passed to respect device mapping constraints. If `dev` is NULL,
+ * device mapping constraints will be ignored.
+ */
+void wlr_cursor_warp_closest(struct wlr_cursor *cur,
+ struct wlr_input_device *dev, double x, double y);
+
/**
* Warp the cursor to the given x and y in absolute 0..1 coordinates. If the
* given point is out of the layout boundaries or constraints, the closest point
diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h
index c45e8d1c..9ce8f400 100644
--- a/include/wlr/types/wlr_data_device.h
+++ b/include/wlr/types/wlr_data_device.h
@@ -73,7 +73,6 @@ struct wlr_data_source {
// source status
bool accepted;
struct wlr_data_offer *offer;
- struct wlr_seat_client *seat_client;
// drag'n'drop status
enum wl_data_device_manager_dnd_action current_dnd_action;
diff --git a/include/wlr/types/wlr_input_method_v2.h b/include/wlr/types/wlr_input_method_v2.h
new file mode 100644
index 00000000..d22d54d1
--- /dev/null
+++ b/include/wlr/types/wlr_input_method_v2.h
@@ -0,0 +1,87 @@
+/*
+ * This an unstable interface of wlroots. No guarantees are made regarding the
+ * future consistency of this API.
+ */
+#ifndef WLR_USE_UNSTABLE
+#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
+#endif
+
+#ifndef WLR_TYPES_WLR_INPUT_METHOD_V2_H
+#define WLR_TYPES_WLR_INPUT_METHOD_V2_H
+#include <stdint.h>
+#include <stdlib.h>
+#include <wayland-server.h>
+#include <wlr/types/wlr_seat.h>
+
+struct wlr_input_method_v2_preedit_string {
+ char *text;
+ int32_t cursor_begin;
+ int32_t cursor_end;
+};
+
+struct wlr_input_method_v2_delete_surrounding_text {
+ uint32_t before_length;
+ uint32_t after_length;
+};
+
+struct wlr_input_method_v2_state {
+ struct wlr_input_method_v2_preedit_string preedit;
+ char *commit_text;
+ struct wlr_input_method_v2_delete_surrounding_text delete;
+};
+
+struct wlr_input_method_v2 {
+ struct wl_resource *resource;
+
+ struct wlr_seat *seat;
+
+ struct wlr_input_method_v2_state pending;
+ struct wlr_input_method_v2_state current;
+ bool active; // pending compositor-side state
+ bool client_active; // state known to the client
+ uint32_t current_serial; // received in last commit call
+
+ struct wl_list link;
+
+ struct wl_listener seat_destroy;
+
+ struct {
+ struct wl_signal commit; // (struct wlr_input_method_v2*)
+ struct wl_signal destroy; // (struct wlr_input_method_v2*)
+ } events;
+};
+
+struct wlr_input_method_manager_v2 {
+ struct wl_global *global;
+ struct wl_list bound_resources; // struct wl_resource*::link
+ struct wl_list input_methods; // struct wlr_input_method_v2*::link
+
+ struct wl_listener display_destroy;
+
+ struct {
+ struct wl_signal input_method; // (struct wlr_input_method_v2*)
+ struct wl_signal destroy; // (struct wlr_input_method_manager_v2*)
+ } events;
+};
+
+struct wlr_input_method_manager_v2 *wlr_input_method_manager_v2_create(
+ struct wl_display *display);
+void wlr_input_method_manager_v2_destroy(
+ struct wlr_input_method_manager_v2 *manager);
+
+void wlr_input_method_v2_send_activate(
+ struct wlr_input_method_v2 *input_method);
+void wlr_input_method_v2_send_deactivate(
+ struct wlr_input_method_v2 *input_method);
+void wlr_input_method_v2_send_surrounding_text(
+ struct wlr_input_method_v2 *input_method, const char *text,
+ uint32_t cursor, uint32_t anchor);
+void wlr_input_method_v2_send_content_type(
+ struct wlr_input_method_v2 *input_method, uint32_t hint,
+ uint32_t purpose);
+void wlr_input_method_v2_send_text_change_cause(
+ struct wlr_input_method_v2 *input_method, uint32_t cause);
+void wlr_input_method_v2_send_done(struct wlr_input_method_v2 *input_method);
+void wlr_input_method_v2_send_unavailable(
+ struct wlr_input_method_v2 *input_method);
+#endif
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index ecd4f759..9ccfbbb5 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -65,7 +65,7 @@ struct wlr_output {
struct wl_list resources;
char name[24];
- char make[48];
+ char make[56];
char model[16];
char serial[16];
int32_t phys_width, phys_height; // mm
@@ -88,9 +88,15 @@ struct wlr_output {
float transform_matrix[9];
struct {
+ // Request to render a frame
struct wl_signal frame;
+ // Emitted when buffers need to be swapped (because software cursors or
+ // fullscreen damage or because of backend-specific logic)
struct wl_signal needs_swap;
+ // Emitted right before buffer swap
struct wl_signal swap_buffers; // wlr_output_event_swap_buffers
+ // Emitted right after the buffer has been presented to the user
+ struct wl_signal present; // wlr_output_event_present
struct wl_signal enable;
struct wl_signal mode;
struct wl_signal scale;
@@ -123,6 +129,32 @@ struct wlr_output_event_swap_buffers {
pixman_region32_t *damage;
};
+enum wlr_output_present_flag {
+ // The presentation was synchronized to the "vertical retrace" by the
+ // display hardware such that tearing does not happen.
+ WLR_OUTPUT_PRESENT_VSYNC = 0x1,
+ // The display hardware provided measurements that the hardware driver
+ // converted into a presentation timestamp.
+ WLR_OUTPUT_PRESENT_HW_CLOCK = 0x2,
+ // The display hardware signalled that it started using the new image
+ // content.
+ WLR_OUTPUT_PRESENT_HW_COMPLETION = 0x4,
+ // The presentation of this update was done zero-copy.
+ WLR_OUTPUT_PRESENT_ZERO_COPY = 0x8,
+};
+
+struct wlr_output_event_present {
+ struct wlr_output *output;
+ // Time when the content update turned into light the first time.
+ struct timespec *when;
+ // Vertical retrace counter. Zero if unavailable.
+ unsigned seq;
+ // Prediction of how many nanoseconds after `when` the very next output
+ // refresh may occur. Zero if unknown.
+ int refresh; // nsec
+ uint32_t flags; // enum wlr_output_present_flag
+};
+
struct wlr_surface;
/**
@@ -182,7 +214,7 @@ void wlr_output_schedule_frame(struct wlr_output *output);
/**
* Returns the maximum length of each gamma ramp, or 0 if unsupported.
*/
-uint32_t wlr_output_get_gamma_size(struct wlr_output *output);
+size_t wlr_output_get_gamma_size(struct wlr_output *output);
/**
* Sets the gamma table for this output. `r`, `g` and `b` are gamma ramps for
* red, green and blue. `size` is the length of the ramps and must not exceed
@@ -190,8 +222,8 @@ uint32_t wlr_output_get_gamma_size(struct wlr_output *output);
*
* Providing zero-sized ramps resets the gamma table.
*/
-bool wlr_output_set_gamma(struct wlr_output *output,
- uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b);
+bool wlr_output_set_gamma(struct wlr_output *output, size_t size,
+ const uint16_t *r, const uint16_t *g, const uint16_t *b);
bool wlr_output_export_dmabuf(struct wlr_output *output,
struct wlr_dmabuf_attributes *attribs);
void wlr_output_set_fullscreen_surface(struct wlr_output *output,
diff --git a/include/wlr/types/wlr_pointer_constraints_v1.h b/include/wlr/types/wlr_pointer_constraints_v1.h
new file mode 100644
index 00000000..fef8c2e9
--- /dev/null
+++ b/include/wlr/types/wlr_pointer_constraints_v1.h
@@ -0,0 +1,102 @@
+/*
+ * This an unstable interface of wlroots. No guarantees are made regarding the
+ * future consistency of this API.
+ */
+#ifndef WLR_USE_UNSTABLE
+#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
+#endif
+
+#ifndef WLR_TYPES_WLR_POINTER_CONSTRAINTS_V1_H
+#define WLR_TYPES_WLR_POINTER_CONSTRAINTS_V1_H
+
+#include <stdint.h>
+#include <wayland-server.h>
+#include <pixman.h>
+#include <wlr/types/wlr_box.h>
+#include <wlr/types/wlr_seat.h>
+#include "pointer-constraints-unstable-v1-protocol.h"
+
+struct wlr_seat;
+
+enum wlr_pointer_constraint_v1_type {
+ WLR_POINTER_CONSTRAINT_V1_LOCKED,
+ WLR_POINTER_CONSTRAINT_V1_CONFINED,
+};
+
+enum wlr_pointer_constraint_v1_state_field {
+ WLR_POINTER_CONSTRAINT_V1_STATE_REGION = 1 << 0,
+ WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT = 1 << 1,
+};
+
+struct wlr_pointer_constraint_v1_state {
+ uint32_t committed; // enum wlr_pointer_constraint_v1_state_field
+ pixman_region32_t region;
+
+ // only valid for locked_pointer
+ struct {
+ double x, y;
+ } cursor_hint;
+};
+
+struct wlr_pointer_constraint_v1 {
+ struct wlr_pointer_constraints_v1 *pointer_constraints;
+
+ struct wl_resource *resource;
+ struct wlr_surface *surface;
+ struct wlr_seat *seat;
+ enum zwp_pointer_constraints_v1_lifetime lifetime;
+ enum wlr_pointer_constraint_v1_type type;
+ pixman_region32_t region;
+
+ struct wlr_pointer_constraint_v1_state current, pending;
+
+ struct wl_listener surface_commit;
+ struct wl_listener surface_destroy;
+ struct wl_listener seat_destroy;
+
+ struct wl_list link; // wlr_pointer_constraints_v1::constraints
+
+ struct {
+ struct wl_signal destroy;
+ } events;
+
+ void *data;
+};
+
+struct wlr_pointer_constraints_v1 {
+ struct wl_list resources; // wl_resource_get_link
+ struct wl_global *global;
+
+ struct {
+ /**
+ * Called when a new pointer constraint is created.
+ *
+ * data: struct wlr_pointer_constraint_v1 *
+ */
+ struct wl_signal new_constraint;
+ } events;
+
+ struct wl_list constraints; // wlr_pointer_constraint_v1::link
+
+ void *data;
+};
+
+struct wlr_pointer_constraints_v1 *wlr_pointer_constraints_v1_create(
+ struct wl_display *display);
+void wlr_pointer_constraints_v1_destroy(
+ struct wlr_pointer_constraints_v1 *pointer_constraints);
+
+struct wlr_pointer_constraint_v1 *
+ wlr_pointer_constraints_v1_constraint_for_surface(
+ struct wlr_pointer_constraints_v1 *pointer_constraints,
+ struct wlr_surface *surface, struct wlr_seat *seat);
+
+void wlr_pointer_constraint_v1_send_activated(
+ struct wlr_pointer_constraint_v1 *constraint);
+/**
+ * Deactivate the constraint. May destroy the constraint.
+ */
+void wlr_pointer_constraint_v1_send_deactivated(
+ struct wlr_pointer_constraint_v1 *constraint);
+
+#endif
diff --git a/include/wlr/types/wlr_presentation_time.h b/include/wlr/types/wlr_presentation_time.h
new file mode 100644
index 00000000..9f9f0e87
--- /dev/null
+++ b/include/wlr/types/wlr_presentation_time.h
@@ -0,0 +1,59 @@
+/*
+ * This an unstable interface of wlroots. No guarantees are made regarding the
+ * future consistency of this API.
+ */
+#ifndef WLR_USE_UNSTABLE
+#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
+#endif
+
+#ifndef WLR_TYPES_WLR_PRESENTATION_TIME_H
+#define WLR_TYPES_WLR_PRESENTATION_TIME_H
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <time.h>
+#include <wayland-server.h>
+
+struct wlr_presentation {
+ struct wl_global *global;
+ struct wl_list resources; // wl_resource_get_link
+ struct wl_list feedbacks; // wlr_presentation_feedback::link
+ clockid_t clock;
+
+ struct {
+ struct wl_signal destroy;
+ } events;
+
+ struct wl_listener display_destroy;
+};
+
+struct wlr_presentation_feedback {
+ struct wl_resource *resource;
+ struct wlr_presentation *presentation;
+ struct wlr_surface *surface;
+ bool committed;
+ struct wl_list link; // wlr_presentation::feedbacks
+
+ struct wl_listener surface_commit;
+ struct wl_listener surface_destroy;
+};
+
+struct wlr_presentation_event {
+ struct wlr_output *output;
+ uint64_t tv_sec;
+ uint32_t tv_nsec;
+ uint32_t refresh;
+ uint64_t seq;
+ uint32_t flags; // wp_presentation_feedback_kind
+};
+
+struct wlr_backend;
+
+struct wlr_presentation *wlr_presentation_create(struct wl_display *display,
+ struct wlr_backend *backend);
+void wlr_presentation_destroy(struct wlr_presentation *presentation);
+void wlr_presentation_send_surface_presented(
+ struct wlr_presentation *presentation, struct wlr_surface *surface,
+ struct wlr_presentation_event *event);
+
+#endif
diff --git a/include/wlr/types/wlr_region.h b/include/wlr/types/wlr_region.h
index 3c4a0532..ec7f73aa 100644
--- a/include/wlr/types/wlr_region.h
+++ b/include/wlr/types/wlr_region.h
@@ -10,8 +10,7 @@
#define WLR_TYPES_WLR_REGION_H
#include <pixman.h>
-
-struct wl_resource;
+#include <wayland-server-protocol.h>
/*
* Creates a new region resource with the provided new ID. If `resource_list` is
diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h
index b3c02cf2..59de8207 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -146,6 +146,10 @@ struct wlr_seat_pointer_state {
uint32_t grab_time;
struct wl_listener surface_destroy;
+
+ struct {
+ struct wl_signal focus_change; // wlr_seat_pointer_focus_change_event
+ } events;
};
// TODO: May be useful to be able to simulate keyboard input events
@@ -238,6 +242,12 @@ struct wlr_seat_pointer_request_set_cursor_event {
int32_t hotspot_x, hotspot_y;
};
+struct wlr_seat_pointer_focus_change_event {
+ struct wlr_seat *seat;
+ struct wlr_surface *old_surface, *new_surface;
+ double sx, sy;
+};
+
/**
* Allocates a new wlr_seat and adds a wl_seat global to the display.
*/
@@ -546,6 +556,9 @@ bool wlr_seat_touch_has_grab(struct wlr_seat *seat);
bool wlr_seat_validate_grab_serial(struct wlr_seat *seat, uint32_t serial);
struct wlr_seat_client *wlr_seat_client_from_resource(
- struct wl_resource *resource);
+ struct wl_resource *resource);
+
+struct wlr_seat_client *wlr_seat_client_from_pointer_resource(
+ struct wl_resource *resource);
#endif
diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h
index 6177e059..b8f8c02a 100644
--- a/include/wlr/types/wlr_surface.h
+++ b/include/wlr/types/wlr_surface.h
@@ -83,6 +83,11 @@ struct wlr_surface {
*/
pixman_region32_t opaque_region;
/**
+ * The current input region, in surface-local coordinates. It is clipped to
+ * the surface bounds.
+ */
+ pixman_region32_t input_region;
+ /**
* `current` contains the current, committed surface state. `pending`
* accumulates state changes from the client between commits and shouldn't
* be accessed by the compositor directly. `previous` contains the state of
diff --git a/include/wlr/types/wlr_text_input_v3.h b/include/wlr/types/wlr_text_input_v3.h
new file mode 100644
index 00000000..0db0cf47
--- /dev/null
+++ b/include/wlr/types/wlr_text_input_v3.h
@@ -0,0 +1,93 @@
+/*
+ * This an unstable interface of wlroots. No guarantees are made regarding the
+ * future consistency of this API.
+ */
+#ifndef WLR_USE_UNSTABLE
+#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
+#endif
+
+#ifndef WLR_TYPES_WLR_TEXT_INPUT_V3_H
+#define WLR_TYPES_WLR_TEXT_INPUT_V3_H
+
+#include <wayland-server.h>
+#include <wlr/types/wlr_seat.h>
+#include <wlr/types/wlr_surface.h>
+
+struct wlr_text_input_v3_state {
+ struct {
+ char *text; // NULL is allowed and equivalent to empty string
+ uint32_t cursor;
+ uint32_t anchor;
+ } surrounding;
+
+ uint32_t text_change_cause;
+
+ struct {
+ uint32_t hint;
+ uint32_t purpose;
+ } content_type;
+
+ struct {
+ int32_t x;
+ int32_t y;
+ int32_t width;
+ int32_t height;
+ } cursor_rectangle;
+};
+
+struct wlr_text_input_v3 {
+ struct wlr_seat *seat; // becomes null when seat destroyed
+ struct wl_resource *resource;
+ struct wlr_surface *focused_surface;
+ struct wlr_text_input_v3_state pending;
+ struct wlr_text_input_v3_state current;
+ uint32_t current_serial; // next in line to send
+ bool pending_enabled;
+ bool current_enabled;
+
+ struct wl_list link;
+
+ struct wl_listener surface_destroy;
+ struct wl_listener seat_destroy;
+
+ struct {
+ struct wl_signal enable; // (struct wlr_text_input_v3*)
+ struct wl_signal commit; // (struct wlr_text_input_v3*)
+ struct wl_signal disable; // (struct wlr_text_input_v3*)
+ struct wl_signal destroy; // (struct wlr_text_input_v3*)
+ } events;
+};
+
+struct wlr_text_input_manager_v3 {
+ struct wl_global *global;
+
+ struct wl_list bound_resources; // struct wl_resource*::link
+ struct wl_list text_inputs; // struct wlr_text_input_v3::resource::link
+
+ struct wl_listener display_destroy;
+
+ struct {
+ struct wl_signal text_input; // (struct wlr_text_input_v3*)
+ struct wl_signal destroy; // (struct wlr_input_method_manager_v3*)
+ } events;
+};
+
+struct wlr_text_input_manager_v3 *wlr_text_input_manager_v3_create(
+ struct wl_display *wl_display);
+void wlr_text_input_manager_v3_destroy(
+ struct wlr_text_input_manager_v3 *manager);
+
+// Sends enter to the surface and saves it
+void wlr_text_input_v3_send_enter(struct wlr_text_input_v3 *text_input,
+ struct wlr_surface *wlr_surface);
+// Sends leave to the currently focused surface and clears it
+void wlr_text_input_v3_send_leave(struct wlr_text_input_v3 *text_input);
+void wlr_text_input_v3_send_preedit_string(struct wlr_text_input_v3 *text_input,
+ const char *text, uint32_t cursor_begin, uint32_t cursor_end);
+void wlr_text_input_v3_send_commit_string(struct wlr_text_input_v3 *text_input,
+ const char *text);
+void wlr_text_input_v3_send_delete_surrounding_text(
+ struct wlr_text_input_v3 *text_input, uint32_t before_length,
+ uint32_t after_length);
+void wlr_text_input_v3_send_done(struct wlr_text_input_v3 *text_input);
+#endif
diff --git a/include/wlr/util/region.h b/include/wlr/util/region.h
index 32387bfb..4aca07e1 100644
--- a/include/wlr/util/region.h
+++ b/include/wlr/util/region.h
@@ -16,6 +16,8 @@
#ifndef WLR_UTIL_REGION_H
#define WLR_UTIL_REGION_H
+
+#include <stdbool.h>
#include <pixman.h>
#include <wayland-server.h>
@@ -48,4 +50,7 @@ void wlr_region_expand(pixman_region32_t *dst, pixman_region32_t *src,
void wlr_region_rotated_bounds(pixman_region32_t *dst, pixman_region32_t *src,
float rotation, int ox, int oy);
+bool wlr_region_confine(pixman_region32_t *region, double x1, double y1, double x2,
+ double y2, double *x2_out, double *y2_out);
+
#endif
diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h
index eb5d6985..8247aa15 100644
--- a/include/wlr/xwayland.h
+++ b/include/wlr/xwayland.h
@@ -163,6 +163,7 @@ struct wlr_xwayland_surface {
struct wl_signal set_pid;
struct wl_signal set_window_type;
struct wl_signal set_hints;
+ struct wl_signal set_decorations;
struct wl_signal set_override_redirect;
struct wl_signal ping_timeout;
} events;