aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/backend/drm/drm.h11
-rw-r--r--include/backend/drm/iface.h8
-rw-r--r--include/backend/drm/properties.h3
-rw-r--r--include/backend/multi.h1
-rw-r--r--include/backend/x11.h1
-rw-r--r--include/render/gles2.h13
-rw-r--r--include/rootston/cursor.h41
-rw-r--r--include/rootston/desktop.h8
-rw-r--r--include/rootston/input.h2
-rw-r--r--include/rootston/output.h4
-rw-r--r--include/rootston/seat.h12
-rw-r--r--include/rootston/text_input.h63
-rw-r--r--include/types/wlr_data_device.h1
-rw-r--r--include/util/os-compatibility.h9
-rw-r--r--include/util/shm.h7
-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
-rw-r--r--include/xwayland/xwm.h2
40 files changed, 619 insertions, 56 deletions
diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h
index ac23cd9a..de5212d3 100644
--- a/include/backend/drm/drm.h
+++ b/include/backend/drm/drm.h
@@ -6,6 +6,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+#include <time.h>
#include <wayland-server.h>
#include <wayland-util.h>
#include <wlr/backend/drm.h>
@@ -57,6 +58,9 @@ struct wlr_drm_crtc {
union wlr_drm_crtc_props props;
struct wl_list connectors;
+
+ uint16_t *gamma_table;
+ size_t gamma_table_size;
};
struct wlr_drm_backend {
@@ -64,6 +68,7 @@ struct wlr_drm_backend {
struct wlr_drm_backend *parent;
const struct wlr_drm_interface *iface;
+ clockid_t clock;
int fd;
@@ -104,10 +109,14 @@ struct wlr_drm_backend {
};
enum wlr_drm_connector_state {
+ // Connector is available but no output is plugged in
WLR_DRM_CONN_DISCONNECTED,
+ // An output just has been plugged in and is waiting for a modeset
WLR_DRM_CONN_NEEDS_MODESET,
WLR_DRM_CONN_CLEANUP,
WLR_DRM_CONN_CONNECTED,
+ // Connector disappeared, waiting for being destroyed on next page-flip
+ WLR_DRM_CONN_DISAPPEARED,
};
struct wlr_drm_mode {
@@ -147,5 +156,7 @@ void restore_drm_outputs(struct wlr_drm_backend *drm);
void scan_drm_connectors(struct wlr_drm_backend *state);
int handle_drm_event(int fd, uint32_t mask, void *data);
bool enable_drm_connector(struct wlr_output *output, bool enable);
+bool set_drm_connector_gamma(struct wlr_output *output, size_t size,
+ const uint16_t *r, const uint16_t *g, const uint16_t *b);
#endif
diff --git a/include/backend/drm/iface.h b/include/backend/drm/iface.h
index ef0e7bf8..5308b136 100644
--- a/include/backend/drm/iface.h
+++ b/include/backend/drm/iface.h
@@ -28,11 +28,11 @@ struct wlr_drm_interface {
struct wlr_drm_crtc *crtc, int x, int y);
// Set the gamma lut on crtc
bool (*crtc_set_gamma)(struct wlr_drm_backend *drm,
- struct wlr_drm_crtc *crtc, uint16_t *r, uint16_t *g, uint16_t *b,
- uint32_t size);
+ struct wlr_drm_crtc *crtc, size_t size,
+ uint16_t *r, uint16_t *g, uint16_t *b);
// Get the gamma lut size of a crtc
- uint32_t (*crtc_get_gamma_size)(struct wlr_drm_backend *drm,
- struct wlr_drm_crtc *crtc);
+ size_t (*crtc_get_gamma_size)(struct wlr_drm_backend *drm,
+ struct wlr_drm_crtc *crtc);
};
extern const struct wlr_drm_interface atomic_iface;
diff --git a/include/backend/drm/properties.h b/include/backend/drm/properties.h
index 5b17e77e..321b4492 100644
--- a/include/backend/drm/properties.h
+++ b/include/backend/drm/properties.h
@@ -14,12 +14,13 @@ union wlr_drm_connector_props {
struct {
uint32_t edid;
uint32_t dpms;
+ uint32_t link_status; // not guaranteed to exist
// atomic-modesetting only
uint32_t crtc_id;
};
- uint32_t props[3];
+ uint32_t props[4];
};
union wlr_drm_crtc_props {
diff --git a/include/backend/multi.h b/include/backend/multi.h
index c57c48f3..2f5f1bd4 100644
--- a/include/backend/multi.h
+++ b/include/backend/multi.h
@@ -8,6 +8,7 @@
struct wlr_multi_backend {
struct wlr_backend backend;
+ struct wlr_session *session;
struct wl_list backends;
diff --git a/include/backend/x11.h b/include/backend/x11.h
index 38aaad50..37e3e4b6 100644
--- a/include/backend/x11.h
+++ b/include/backend/x11.h
@@ -3,6 +3,7 @@
#include <stdbool.h>
#include <wayland-server.h>
+#include <wlr/config.h>
#include <wlr/backend/x11.h>
#include <wlr/interfaces/wlr_input_device.h>
#include <wlr/interfaces/wlr_output.h>
diff --git a/include/render/gles2.h b/include/render/gles2.h
index f649f3e2..1857383f 100644
--- a/include/render/gles2.h
+++ b/include/render/gles2.h
@@ -19,7 +19,7 @@
extern PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
struct wlr_gles2_pixel_format {
- uint32_t wl_format;
+ enum wl_shm_format wl_format;
GLint gl_format, gl_type;
int depth, bpp;
bool has_alpha;
@@ -40,6 +40,12 @@ struct wlr_gles2_renderer {
const char *exts_str;
struct {
+ bool read_format_bgra_ext;
+ bool debug_khr;
+ bool egl_image_external_oes;
+ } exts;
+
+ struct {
struct {
GLuint program;
GLint proj;
@@ -72,6 +78,7 @@ struct wlr_gles2_texture {
enum wlr_gles2_texture_type type;
int width, height;
bool has_alpha;
+ enum wl_shm_format wl_format; // used to interpret upload data
bool inverted_y;
// Not set if WLR_GLES2_TEXTURE_GLTEX
@@ -86,7 +93,9 @@ struct wlr_gles2_texture {
const struct wlr_gles2_pixel_format *get_gles2_format_from_wl(
enum wl_shm_format fmt);
-const enum wl_shm_format *get_gles2_formats(size_t *len);
+const struct wlr_gles2_pixel_format *get_gles2_format_from_gl(
+ GLint gl_format, GLint gl_type, bool alpha);
+const enum wl_shm_format *get_gles2_wl_formats(size_t *len);
struct wlr_gles2_texture *gles2_get_texture(
struct wlr_texture *wlr_texture);
diff --git a/include/rootston/cursor.h b/include/rootston/cursor.h
index 2c687a39..b5bb682f 100644
--- a/include/rootston/cursor.h
+++ b/include/rootston/cursor.h
@@ -1,6 +1,7 @@
#ifndef ROOTSTON_CURSOR_H
#define ROOTSTON_CURSOR_H
+#include <wlr/types/wlr_pointer_constraints_v1.h>
#include "rootston/seat.h"
enum roots_cursor_mode {
@@ -14,6 +15,9 @@ struct roots_cursor {
struct roots_seat *seat;
struct wlr_cursor *cursor;
+ struct wlr_pointer_constraint_v1 *active_constraint;
+ pixman_region32_t confine; // invalid if active_constraint == NULL
+
const char *default_xcursor;
enum roots_cursor_mode mode;
@@ -28,6 +32,7 @@ struct roots_cursor {
uint32_t resize_edges;
struct roots_seat_view *pointer_view;
+ struct wlr_surface *wlr_surface;
struct wl_listener motion;
struct wl_listener motion_absolute;
@@ -44,6 +49,10 @@ struct roots_cursor {
struct wl_listener tool_button;
struct wl_listener request_set_cursor;
+
+ struct wl_listener focus_change;
+
+ struct wl_listener constraint_commit;
};
struct roots_cursor *roots_cursor_create(struct roots_seat *seat);
@@ -51,36 +60,46 @@ 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);
+ struct wlr_event_pointer_motion *event);
void roots_cursor_handle_motion_absolute(struct roots_cursor *cursor,
- struct wlr_event_pointer_motion_absolute *event);
+ struct wlr_event_pointer_motion_absolute *event);
void roots_cursor_handle_button(struct roots_cursor *cursor,
- struct wlr_event_pointer_button *event);
+ struct wlr_event_pointer_button *event);
void roots_cursor_handle_axis(struct roots_cursor *cursor,
- struct wlr_event_pointer_axis *event);
+ struct wlr_event_pointer_axis *event);
void roots_cursor_handle_touch_down(struct roots_cursor *cursor,
- struct wlr_event_touch_down *event);
+ struct wlr_event_touch_down *event);
void roots_cursor_handle_touch_up(struct roots_cursor *cursor,
- struct wlr_event_touch_up *event);
+ struct wlr_event_touch_up *event);
void roots_cursor_handle_touch_motion(struct roots_cursor *cursor,
- struct wlr_event_touch_motion *event);
+ struct wlr_event_touch_motion *event);
void roots_cursor_handle_tool_axis(struct roots_cursor *cursor,
- struct wlr_event_tablet_tool_axis *event);
+ struct wlr_event_tablet_tool_axis *event);
void roots_cursor_handle_tool_tip(struct roots_cursor *cursor,
- struct wlr_event_tablet_tool_tip *event);
+ 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);
+ struct wlr_seat_pointer_request_set_cursor_event *event);
+
+void roots_cursor_handle_focus_change(struct roots_cursor *cursor,
+ struct wlr_seat_pointer_focus_change_event *event);
+
+void roots_cursor_handle_constraint_commit(struct roots_cursor *cursor);
void roots_cursor_update_position(struct roots_cursor *cursor,
- uint32_t time);
+ uint32_t time);
+
+void roots_cursor_update_focus(struct roots_cursor *cursor);
+
+void roots_cursor_constrain(struct roots_cursor *cursor,
+ struct wlr_pointer_constraint_v1 *constraint, double sx, double sy);
#endif
diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h
index 89d8af4a..345c9c09 100644
--- a/include/rootston/desktop.h
+++ b/include/rootston/desktop.h
@@ -9,13 +9,16 @@
#include <wlr/types/wlr_idle_inhibit_v1.h>
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_input_inhibitor.h>
+#include <wlr/types/wlr_input_method_v2.h>
#include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_list.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output.h>
+#include <wlr/types/wlr_presentation_time.h>
#include <wlr/types/wlr_primary_selection.h>
#include <wlr/types/wlr_screencopy_v1.h>
#include <wlr/types/wlr_screenshooter.h>
+#include <wlr/types/wlr_text_input_v3.h>
#include <wlr/types/wlr_virtual_keyboard_v1.h>
#include <wlr/types/wlr_wl_shell.h>
#include <wlr/types/wlr_xcursor_manager.h>
@@ -53,9 +56,13 @@ struct roots_desktop {
struct wlr_idle_inhibit_manager_v1 *idle_inhibit;
struct wlr_input_inhibit_manager *input_inhibit;
struct wlr_layer_shell_v1 *layer_shell;
+ struct wlr_input_method_manager_v2 *input_method;
+ struct wlr_text_input_manager_v3 *text_input;
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
struct wlr_screencopy_manager_v1 *screencopy;
struct wlr_tablet_manager_v2 *tablet_v2;
+ struct wlr_pointer_constraints_v1 *pointer_constraints;
+ struct wlr_presentation *presentation;
struct wl_listener new_output;
struct wl_listener layout_change;
@@ -67,6 +74,7 @@ struct roots_desktop {
struct wl_listener input_inhibit_activate;
struct wl_listener input_inhibit_deactivate;
struct wl_listener virtual_keyboard_new;
+ struct wl_listener pointer_constraint;
#ifdef WLR_HAS_XWAYLAND
struct wlr_xwayland *xwayland;
diff --git a/include/rootston/input.h b/include/rootston/input.h
index 2cdb13e6..31810b4d 100644
--- a/include/rootston/input.h
+++ b/include/rootston/input.h
@@ -16,7 +16,7 @@ struct roots_input {
struct wl_listener new_input;
- struct wl_list seats;
+ struct wl_list seats; // roots_seat::link
};
struct roots_input *input_create(struct roots_server *server,
diff --git a/include/rootston/output.h b/include/rootston/output.h
index f78ee81d..3f07ab6f 100644
--- a/include/rootston/output.h
+++ b/include/rootston/output.h
@@ -24,10 +24,14 @@ struct roots_output {
struct wl_listener destroy;
struct wl_listener mode;
struct wl_listener transform;
+ struct wl_listener present;
struct wl_listener damage_frame;
struct wl_listener damage_destroy;
};
+void rotate_child_position(double *sx, double *sy, double sw, double sh,
+ double pw, double ph, float rotation);
+
void handle_new_output(struct wl_listener *listener, void *data);
struct roots_view;
diff --git a/include/rootston/seat.h b/include/rootston/seat.h
index c5e584b6..0187c6cc 100644
--- a/include/rootston/seat.h
+++ b/include/rootston/seat.h
@@ -5,12 +5,13 @@
#include "rootston/input.h"
#include "rootston/keyboard.h"
#include "rootston/layers.h"
+#include "rootston/text_input.h"
struct roots_seat {
struct roots_input *input;
struct wlr_seat *seat;
struct roots_cursor *cursor;
- struct wl_list link;
+ struct wl_list link; // roots_input::seats
// coordinates of the first touch point if it exists
int32_t touch_id;
@@ -19,6 +20,8 @@ struct roots_seat {
// If the focused layer is set, views cannot receive keyboard focus
struct wlr_layer_surface_v1 *focused_layer;
+ struct roots_input_method_relay im_relay;
+
// If non-null, only this client can receive input events
struct wl_client *exclusive_client;
@@ -114,6 +117,7 @@ struct roots_tablet_tool {
struct wlr_tablet_v2_tablet_tool *tablet_v2_tool;
struct roots_seat *seat;
+ double tilt_x, tilt_y;
struct wl_listener set_cursor;
struct wl_listener tool_destroy;
@@ -122,6 +126,12 @@ struct roots_tablet_tool {
struct wl_listener tablet_destroy;
};
+struct roots_pointer_constraint {
+ struct wlr_pointer_constraint_v1 *constraint;
+
+ struct wl_listener destroy;
+};
+
struct roots_seat *roots_seat_create(struct roots_input *input, char *name);
void roots_seat_destroy(struct roots_seat *seat);
diff --git a/include/rootston/text_input.h b/include/rootston/text_input.h
new file mode 100644
index 00000000..82e45e3e
--- /dev/null
+++ b/include/rootston/text_input.h
@@ -0,0 +1,63 @@
+#ifndef ROOTSTON_TEXT_INPUT_H
+#define ROOTSTON_TEXT_INPUT_H
+
+#include <wlr/types/wlr_text_input_v3.h>
+#include <wlr/types/wlr_input_method_v2.h>
+#include <wlr/types/wlr_surface.h>
+#include "rootston/seat.h"
+
+/**
+ * The relay structure manages the relationship between text-input and
+ * input_method interfaces on a given seat. Multiple text-input interfaces may
+ * be bound to a relay, but at most one will be focused (reveiving events) at
+ * a time. At most one input-method interface may be bound to the seat. The
+ * relay manages life cycle of both sides. When both sides are present and
+ * focused, the relay passes messages between them.
+ *
+ * Text input focus is a subset of keyboard focus - if the text-input is
+ * in the focused state, wl_keyboard sent an enter as well. However, having
+ * wl_keyboard focused doesn't mean that text-input will be focused.
+ */
+struct roots_input_method_relay {
+ struct roots_seat *seat;
+
+ struct wl_list text_inputs; // roots_text_input::link
+ struct wlr_input_method_v2 *input_method; // doesn't have to be present
+
+ struct wl_listener text_input_new;
+ struct wl_listener text_input_enable;
+ struct wl_listener text_input_commit;
+ struct wl_listener text_input_disable;
+ struct wl_listener text_input_destroy;
+
+ struct wl_listener input_method_new;
+ struct wl_listener input_method_commit;
+ struct wl_listener input_method_destroy;
+};
+
+struct roots_text_input {
+ struct roots_input_method_relay *relay;
+
+ struct wlr_text_input_v3 *input;
+ // The surface getting seat's focus. Stored for when text-input cannot
+ // be sent an enter event immediately after getting focus, e.g. when
+ // there's no input method available. Cleared once text-input is entered.
+ struct wlr_surface *pending_focused_surface;
+
+ struct wl_list link;
+
+ struct wl_listener pending_focused_surface_destroy;
+};
+
+void roots_input_method_relay_init(struct roots_seat *seat,
+ struct roots_input_method_relay *relay);
+
+// Updates currently focused surface. Surface must belong to the same seat.
+void roots_input_method_relay_set_focus(struct roots_input_method_relay *relay,
+ struct wlr_surface *surface);
+
+struct roots_text_input *roots_text_input_create(
+ struct roots_input_method_relay *relay,
+ struct wlr_text_input_v3 *text_input);
+
+#endif
diff --git a/include/types/wlr_data_device.h b/include/types/wlr_data_device.h
index 972294ff..388e91a5 100644
--- a/include/types/wlr_data_device.h
+++ b/include/types/wlr_data_device.h
@@ -11,6 +11,7 @@ struct wlr_client_data_source {
struct wlr_data_source source;
struct wlr_data_source_impl impl;
struct wl_resource *resource;
+ bool finalized;
};
extern const struct wlr_surface_role drag_icon_surface_role;
diff --git a/include/util/os-compatibility.h b/include/util/os-compatibility.h
deleted file mode 100644
index 2038025e..00000000
--- a/include/util/os-compatibility.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef UTIL_OS_COMPATIBILITY_H
-#define UTIL_OS_COMPATIBILITY_H
-
-int os_fd_set_cloexec(int fd);
-int set_cloexec_or_close(int fd);
-int create_tmpfile_cloexec(char *tmpname);
-int os_create_anonymous_file(off_t size);
-
-#endif
diff --git a/include/util/shm.h b/include/util/shm.h
new file mode 100644
index 00000000..fb67b711
--- /dev/null
+++ b/include/util/shm.h
@@ -0,0 +1,7 @@
+#ifndef UTIL_SHM_H
+#define UTIL_SHM_H
+
+int create_shm_file(void);
+int allocate_shm_file(size_t size);
+
+#endif
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;
diff --git a/include/xwayland/xwm.h b/include/xwayland/xwm.h
index 3536bbc8..dc40cc3e 100644
--- a/include/xwayland/xwm.h
+++ b/include/xwayland/xwm.h
@@ -30,7 +30,7 @@ enum atom_name {
UTF8_STRING,
WM_S0,
NET_SUPPORTED,
- NET_WM_S0,
+ NET_WM_CM_S0,
NET_WM_PID,
NET_WM_NAME,
NET_WM_STATE,