aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/backend/drm/drm.h1
-rw-r--r--include/render/gles2.h41
-rw-r--r--include/rootston/config.h2
-rw-r--r--include/rootston/desktop.h5
-rw-r--r--include/rootston/layers.h25
-rw-r--r--include/rootston/output.h8
-rw-r--r--include/rootston/view.h5
-rw-r--r--include/wlr/render/egl.h20
-rw-r--r--include/wlr/render/interface.h45
-rw-r--r--include/wlr/render/wlr_renderer.h31
-rw-r--r--include/wlr/render/wlr_texture.h63
-rw-r--r--include/wlr/types/wlr_box.h2
-rw-r--r--include/wlr/types/wlr_cursor.h25
-rw-r--r--include/wlr/types/wlr_layer_shell.h100
-rw-r--r--include/wlr/types/wlr_linux_dmabuf.h13
-rw-r--r--include/wlr/types/wlr_xdg_shell.h34
-rw-r--r--include/wlr/types/wlr_xdg_shell_v6.h34
-rw-r--r--include/wlr/util/region.h7
-rw-r--r--include/xwayland/xwm.h1
19 files changed, 328 insertions, 134 deletions
diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h
index 26189340..cb10ad20 100644
--- a/include/backend/drm/drm.h
+++ b/include/backend/drm/drm.h
@@ -27,7 +27,6 @@ struct wlr_drm_plane {
// Only used by cursor
float matrix[9];
- struct wlr_texture *wlr_tex;
struct gbm_bo *cursor_bo;
bool cursor_enabled;
int32_t cursor_hotspot_x, cursor_hotspot_y;
diff --git a/include/render/gles2.h b/include/render/gles2.h
index 43a8d648..32cb3221 100644
--- a/include/render/gles2.h
+++ b/include/render/gles2.h
@@ -28,6 +28,7 @@ struct wlr_gles2_renderer {
struct wlr_renderer wlr_renderer;
struct wlr_egl *egl;
+ const char *exts_str;
struct {
GLuint quad;
@@ -38,21 +39,49 @@ struct wlr_gles2_renderer {
} shaders;
};
+enum wlr_gles2_texture_type {
+ WLR_GLES2_TEXTURE_GLTEX,
+ WLR_GLES2_TEXTURE_WL_DRM_GL,
+ WLR_GLES2_TEXTURE_WL_DRM_EXT,
+ WLR_GLES2_TEXTURE_DMABUF,
+};
+
struct wlr_gles2_texture {
struct wlr_texture wlr_texture;
- struct wlr_egl *egl;
- GLuint tex_id;
- const struct gles2_pixel_format *pixel_format;
+ struct wlr_gles2_renderer *renderer;
+ enum wlr_gles2_texture_type type;
+ int width, height;
+ bool has_alpha;
+ bool inverted_y;
+
+ // Not set if WLR_GLES2_TEXTURE_GLTEX
EGLImageKHR image;
- GLenum target;
+ GLuint image_tex;
+
+ union {
+ GLuint gl_tex;
+ struct wl_resource *wl_drm;
+ };
};
const struct gles2_pixel_format *gles2_format_from_wl(enum wl_shm_format fmt);
const enum wl_shm_format *gles2_formats(size_t *len);
-struct wlr_texture *gles2_texture_create();
-struct wlr_gles2_texture *gles2_get_texture(struct wlr_texture *wlr_texture);
+struct wlr_gles2_renderer *gles2_get_renderer(
+ struct wlr_renderer *wlr_renderer);
+struct wlr_gles2_renderer *gles2_get_renderer_in_context(
+ struct wlr_renderer *wlr_renderer);
+
+struct wlr_gles2_texture *gles2_get_texture_in_context(
+ struct wlr_texture *wlr_texture);
+struct wlr_texture *gles2_texture_from_pixels(struct wlr_renderer *wlr_renderer,
+ enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width, uint32_t height,
+ const void *data);
+struct wlr_texture *gles2_texture_from_wl_drm(struct wlr_renderer *wlr_renderer,
+ struct wl_resource *data);
+struct wlr_texture *gles2_texture_from_dmabuf(struct wlr_renderer *wlr_renderer,
+ struct wlr_dmabuf_buffer_attribs *attribs);
void gles2_push_marker(const char *file, const char *func);
void gles2_pop_marker(void);
diff --git a/include/rootston/config.h b/include/rootston/config.h
index 9926d9c2..0a67ac1e 100644
--- a/include/rootston/config.h
+++ b/include/rootston/config.h
@@ -66,8 +66,10 @@ struct roots_config {
struct wl_list bindings;
struct wl_list keyboards;
struct wl_list cursors;
+
char *config_path;
char *startup_cmd;
+ bool debug_damage_tracking;
};
/**
diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h
index 5986c96f..5714aa0a 100644
--- a/include/rootston/desktop.h
+++ b/include/rootston/desktop.h
@@ -7,6 +7,7 @@
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_gamma_control.h>
#include <wlr/types/wlr_idle.h>
+#include <wlr/types/wlr_layer_shell.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_list.h>
#include <wlr/types/wlr_output_layout.h>
@@ -48,12 +49,14 @@ struct roots_desktop {
struct wlr_idle *idle;
struct wlr_idle_inhibit_manager_v1 *idle_inhibit;
struct wlr_linux_dmabuf *linux_dmabuf;
+ struct wlr_layer_shell *layer_shell;
struct wl_listener new_output;
struct wl_listener layout_change;
struct wl_listener xdg_shell_v6_surface;
struct wl_listener xdg_shell_surface;
struct wl_listener wl_shell_surface;
+ struct wl_listener layer_shell_surface;
struct wl_listener decoration_new;
#ifdef WLR_HAS_XWAYLAND
@@ -83,10 +86,12 @@ void view_update_size(struct roots_view *view, uint32_t width, uint32_t height);
void view_initial_focus(struct roots_view *view);
void view_map(struct roots_view *view, struct wlr_surface *surface);
void view_unmap(struct roots_view *view);
+void view_arrange_maximized(struct roots_view *view);
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data);
void handle_xdg_shell_surface(struct wl_listener *listener, void *data);
void handle_wl_shell_surface(struct wl_listener *listener, void *data);
+void handle_layer_shell_surface(struct wl_listener *listener, void *data);
void handle_xwayland_surface(struct wl_listener *listener, void *data);
#endif
diff --git a/include/rootston/layers.h b/include/rootston/layers.h
new file mode 100644
index 00000000..35f5399e
--- /dev/null
+++ b/include/rootston/layers.h
@@ -0,0 +1,25 @@
+#ifndef ROOTSTON_LAYERS_H
+#define ROOTSTON_LAYERS_H
+#include <stdbool.h>
+#include <wlr/config.h>
+#include <wlr/types/wlr_box.h>
+#include <wlr/types/wlr_surface.h>
+#include <wlr/types/wlr_layer_shell.h>
+
+struct roots_layer_surface {
+ struct wlr_layer_surface *layer_surface;
+ struct wl_list link;
+
+ struct wl_listener destroy;
+ struct wl_listener map;
+ struct wl_listener unmap;
+ struct wl_listener surface_commit;
+ struct wl_listener output_destroy;
+ struct wl_listener output_mode;
+ struct wl_listener output_transform;
+
+ bool configured;
+ struct wlr_box geo;
+};
+
+#endif
diff --git a/include/rootston/output.h b/include/rootston/output.h
index a852a204..e40ad776 100644
--- a/include/rootston/output.h
+++ b/include/rootston/output.h
@@ -4,6 +4,7 @@
#include <pixman.h>
#include <time.h>
#include <wayland-server.h>
+#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_output_damage.h>
struct roots_desktop;
@@ -14,10 +15,13 @@ struct roots_output {
struct wl_list link; // roots_desktop:outputs
struct roots_view *fullscreen_view;
+ struct wl_list layers[4]; // layer_surface::link
struct timespec last_frame;
struct wlr_output_damage *damage;
+ struct wlr_box usable_area;
+
struct wl_listener destroy;
struct wl_listener damage_frame;
struct wl_listener damage_destroy;
@@ -35,5 +39,9 @@ void output_damage_from_view(struct roots_output *output,
struct roots_view *view);
void output_damage_whole_drag_icon(struct roots_output *output,
struct roots_drag_icon *icon);
+void output_damage_from_local_surface(struct roots_output *output,
+ struct wlr_surface *surface, double ox, double oy, float rotation);
+void output_damage_whole_local_surface(struct roots_output *output,
+ struct wlr_surface *surface, double ox, double oy, float rotation);
#endif
diff --git a/include/rootston/view.h b/include/rootston/view.h
index 775f3d11..6e746e8c 100644
--- a/include/rootston/view.h
+++ b/include/rootston/view.h
@@ -1,6 +1,5 @@
#ifndef ROOTSTON_VIEW_H
#define ROOTSTON_VIEW_H
-
#include <stdbool.h>
#include <wlr/config.h>
#include <wlr/types/wlr_box.h>
@@ -177,6 +176,8 @@ struct roots_xdg_popup_v6 {
struct roots_view_child view_child;
struct wlr_xdg_popup_v6 *wlr_popup;
struct wl_listener destroy;
+ struct wl_listener map;
+ struct wl_listener unmap;
struct wl_listener new_popup;
};
@@ -184,6 +185,8 @@ struct roots_xdg_popup {
struct roots_view_child view_child;
struct wlr_xdg_popup *wlr_popup;
struct wl_listener destroy;
+ struct wl_listener map;
+ struct wl_listener unmap;
struct wl_listener new_popup;
};
diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h
index aa429e8e..20127e38 100644
--- a/include/wlr/render/egl.h
+++ b/include/wlr/render/egl.h
@@ -13,14 +13,14 @@ struct wlr_egl {
EGLConfig config;
EGLContext context;
- const char *egl_exts_str;
- const char *gl_exts_str;
+ const char *exts_str;
struct {
bool buffer_age;
bool swap_buffers_with_damage;
bool dmabuf_import;
bool dmabuf_import_modifiers;
+ bool bind_wayland_display;
} egl_exts;
struct wl_display *wl_display;
@@ -47,36 +47,24 @@ void wlr_egl_finish(struct wlr_egl *egl);
bool wlr_egl_bind_display(struct wlr_egl *egl, struct wl_display *local_display);
/**
- * Refer to the eglQueryWaylandBufferWL extension function.
- */
-bool wlr_egl_query_buffer(struct wlr_egl *egl, struct wl_resource *buf,
- EGLint attrib, EGLint *value);
-
-/**
* Returns a surface for the given native window
* The window must match the remote display the wlr_egl was created with.
*/
EGLSurface wlr_egl_create_surface(struct wlr_egl *egl, void *window);
/**
- * Creates an egl image from the given client buffer and attributes.
- */
-EGLImageKHR wlr_egl_create_image(struct wlr_egl *egl,
- EGLenum target, EGLClientBuffer buffer, const EGLint *attribs);
-
-/**
* Creates an egl image from the given dmabuf attributes. Check usability
* of the dmabuf with wlr_egl_check_import_dmabuf once first.
*/
EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
- struct wlr_dmabuf_buffer_attribs *attributes);
+ struct wlr_dmabuf_buffer_attribs *attributes);
/**
* Try to import the given dmabuf. On success return true false otherwise.
* If this succeeds the dmabuf can be used for rendering on a texture
*/
bool wlr_egl_check_import_dmabuf(struct wlr_egl *egl,
- struct wlr_dmabuf_buffer *dmabuf);
+ struct wlr_dmabuf_buffer *dmabuf);
/**
* Get the available dmabuf formats
diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h
index 7f25c0ff..597e4b39 100644
--- a/include/wlr/render/interface.h
+++ b/include/wlr/render/interface.h
@@ -23,55 +23,48 @@ struct wlr_renderer_impl {
void (*end)(struct wlr_renderer *renderer);
void (*clear)(struct wlr_renderer *renderer, const float color[static 4]);
void (*scissor)(struct wlr_renderer *renderer, struct wlr_box *box);
- struct wlr_texture *(*texture_create)(struct wlr_renderer *renderer);
bool (*render_texture_with_matrix)(struct wlr_renderer *renderer,
struct wlr_texture *texture, const float matrix[static 9],
float alpha);
- void (*render_quad)(struct wlr_renderer *renderer,
+ void (*render_quad_with_matrix)(struct wlr_renderer *renderer,
const float color[static 4], const float matrix[static 9]);
- void (*render_ellipse)(struct wlr_renderer *renderer,
+ void (*render_ellipse_with_matrix)(struct wlr_renderer *renderer,
const float color[static 4], const float matrix[static 9]);
const enum wl_shm_format *(*formats)(
struct wlr_renderer *renderer, size_t *len);
- bool (*buffer_is_drm)(struct wlr_renderer *renderer,
- struct wl_resource *buffer);
+ bool (*resource_is_wl_drm_buffer)(struct wlr_renderer *renderer,
+ struct wl_resource *resource);
+ void (*wl_drm_buffer_get_size)(struct wlr_renderer *renderer,
+ struct wl_resource *buffer, int *width, int *height);
bool (*read_pixels)(struct wlr_renderer *renderer, enum wl_shm_format 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,
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);
+ struct wlr_texture *(*texture_from_wl_drm)(struct wlr_renderer *renderer,
+ struct wl_resource *data);
+ struct wlr_texture *(*texture_from_dmabuf)(struct wlr_renderer *renderer,
+ struct wlr_dmabuf_buffer_attribs *attribs);
void (*destroy)(struct wlr_renderer *renderer);
};
void wlr_renderer_init(struct wlr_renderer *renderer,
- const struct wlr_renderer_impl *impl);
+ const struct wlr_renderer_impl *impl);
struct wlr_texture_impl {
- bool (*upload_pixels)(struct wlr_texture *texture,
- enum wl_shm_format format, int stride, int width, int height,
- const unsigned char *pixels);
- bool (*update_pixels)(struct wlr_texture *texture,
- enum wl_shm_format format, int stride, int x, int y,
- int width, int height, const unsigned char *pixels);
- bool (*upload_shm)(struct wlr_texture *texture, uint32_t format,
- struct wl_shm_buffer *shm);
- bool (*update_shm)(struct wlr_texture *texture, uint32_t format,
- int x, int y, int width, int height, struct wl_shm_buffer *shm);
- bool (*upload_drm)(struct wlr_texture *texture,
- struct wl_resource *drm_buf);
- bool (*upload_eglimage)(struct wlr_texture *texture, EGLImageKHR image,
- uint32_t width, uint32_t height);
- bool (*upload_dmabuf)(struct wlr_texture *texture,
- struct wl_resource *dmabuf_resource);
- void (*get_buffer_size)(struct wlr_texture *texture,
- struct wl_resource *resource, int *width, int *height);
+ void (*get_size)(struct wlr_texture *texture, int *width, int *height);
+ 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);
void (*destroy)(struct wlr_texture *texture);
};
void wlr_texture_init(struct wlr_texture *texture,
const struct wlr_texture_impl *impl);
-void wlr_texture_get_buffer_size(struct wlr_texture *texture,
- struct wl_resource *resource, int *width, int *height);
#endif
diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h
index 6f0d2ecc..65fc7b19 100644
--- a/include/wlr/render/wlr_renderer.h
+++ b/include/wlr/render/wlr_renderer.h
@@ -1,8 +1,6 @@
#ifndef WLR_RENDER_WLR_RENDERER_H
#define WLR_RENDER_WLR_RENDERER_H
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
#include <stdint.h>
#include <wayland-server-protocol.h>
#include <wlr/render/wlr_texture.h>
@@ -22,10 +20,6 @@ void wlr_renderer_clear(struct wlr_renderer *r, const float color[static 4]);
*/
void wlr_renderer_scissor(struct wlr_renderer *r, struct wlr_box *box);
/**
- * Requests a texture handle from this renderer.
- */
-struct wlr_texture *wlr_render_texture_create(struct wlr_renderer *r);
-/**
* Renders the requested texture.
*/
bool wlr_render_texture(struct wlr_renderer *r, struct wlr_texture *texture,
@@ -36,14 +30,24 @@ bool wlr_render_texture(struct wlr_renderer *r, struct wlr_texture *texture,
bool wlr_render_texture_with_matrix(struct wlr_renderer *r,
struct wlr_texture *texture, const float matrix[static 9], float alpha);
/**
- * Renders a solid quad in the specified color.
+ * Renders a solid rectangle in the specified color.
+ */
+void wlr_render_rect(struct wlr_renderer *r, const struct wlr_box *box,
+ const float color[static 4], const float projection[static 9]);
+/**
+ * Renders a solid quadrangle in the specified color with the specified matrix.
*/
-void wlr_render_colored_quad(struct wlr_renderer *r,
+void wlr_render_quad_with_matrix(struct wlr_renderer *r,
const float color[static 4], const float matrix[static 9]);
/**
* Renders a solid ellipse in the specified color.
*/
-void wlr_render_colored_ellipse(struct wlr_renderer *r,
+void wlr_render_ellipse(struct wlr_renderer *r, const struct wlr_box *box,
+ const float color[static 4], const float projection[static 9]);
+/**
+ * Renders a solid ellipse in the specified color with the specified matrix.
+ */
+void wlr_render_ellipse_with_matrix(struct wlr_renderer *r,
const float color[static 4], const float matrix[static 9]);
/**
* Returns a list of pixel formats supported by this renderer.
@@ -51,11 +55,16 @@ void wlr_render_colored_ellipse(struct wlr_renderer *r,
const enum wl_shm_format *wlr_renderer_get_formats(struct wlr_renderer *r,
size_t *len);
/**
- * Returns true if this wl_buffer is a DRM buffer.
+ * Returns true if this wl_buffer is a wl_drm buffer.
*/
-bool wlr_renderer_buffer_is_drm(struct wlr_renderer *renderer,
+bool wlr_renderer_resource_is_wl_drm_buffer(struct wlr_renderer *renderer,
struct wl_resource *buffer);
/**
+ * Gets the width and height of a wl_drm buffer.
+ */
+void wlr_renderer_wl_drm_buffer_get_size(struct wlr_renderer *renderer,
+ struct wl_resource *buffer, int *width, int *height);
+/**
* 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 095097e6..ab361298 100644
--- a/include/wlr/render/wlr_texture.h
+++ b/include/wlr/render/wlr_texture.h
@@ -5,62 +5,49 @@
#include <EGL/eglext.h>
#include <stdint.h>
#include <wayland-server-protocol.h>
+#include <wlr/types/wlr_linux_dmabuf.h>
+struct wlr_renderer;
struct wlr_texture_impl;
struct wlr_texture {
const struct wlr_texture_impl *impl;
-
- bool valid;
- uint32_t format;
- int width, height;
- bool inverted_y;
- struct wl_signal destroy_signal;
- struct wl_resource *resource;
};
/**
- * Copies pixels to this texture. The buffer is not accessed after this function
- * returns.
+ * Create a new texture from raw pixel data. `stride` is in bytes. The returned
+ * texture is mutable.
*/
-bool wlr_texture_upload_pixels(struct wlr_texture *tex,
- enum wl_shm_format format, int stride, int width, int height,
- const unsigned char *pixels);
+struct wlr_texture *wlr_texture_from_pixels(struct wlr_renderer *renderer,
+ enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width, uint32_t height,
+ const void *data);
+
/**
- * Copies pixels to this texture. The buffer is not accessed after this function
- * returns. Under some circumstances, this function may re-upload the entire
- * buffer - therefore, the entire buffer must be valid.
+ * Create a new texture from a wayland DRM resource. The returned texture is
+ * immutable.
*/
-bool wlr_texture_update_pixels(struct wlr_texture *surf,
- enum wl_shm_format format, int stride, int x, int y,
- int width, int height, const unsigned char *pixels);
+struct wlr_texture *wlr_texture_from_wl_drm(struct wlr_renderer *renderer,
+ struct wl_resource *data);
+
/**
- * Copies pixels from a wl_shm_buffer into this texture. The buffer is not
- * accessed after this function returns.
+ * Create a new texture from a DMA-BUF. The returned texture is immutable.
*/
-bool wlr_texture_upload_shm(struct wlr_texture *tex, uint32_t format,
- struct wl_shm_buffer *shm);
+struct wlr_texture *wlr_texture_from_dmabuf(struct wlr_renderer *renderer,
+ struct wlr_dmabuf_buffer_attribs *attribs);
+
/**
- * Attaches the contents from the given wl_drm wl_buffer resource onto the
- * texture. The wl_resource is not used after this call.
- * Will fail (return false) if the given resource is no drm buffer.
+ * Get the texture width and height.
*/
-bool wlr_texture_upload_drm(struct wlr_texture *tex,
- struct wl_resource *drm_buffer);
-
-bool wlr_texture_upload_eglimage(struct wlr_texture *tex,
- EGLImageKHR image, uint32_t width, uint32_t height);
+void wlr_texture_get_size(struct wlr_texture *texture, int *width, int *height);
-bool wlr_texture_upload_dmabuf(struct wlr_texture *tex,
- struct wl_resource *dmabuf_resource);
/**
- * Copies a rectangle of pixels from a wl_shm_buffer onto the texture. The
- * buffer is not accessed after this function returns. Under some circumstances,
- * this function may re-upload the entire buffer - therefore, the entire buffer
- * must be valid.
+ * Update a texture with raw pixels. The texture must be mutable.
*/
-bool wlr_texture_update_shm(struct wlr_texture *surf, uint32_t format,
- int x, int y, int width, int height, struct wl_shm_buffer *shm);
+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 src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
+ const void *data);
+
/**
* Destroys this wlr_texture.
*/
diff --git a/include/wlr/types/wlr_box.h b/include/wlr/types/wlr_box.h
index fc86f0ac..0e586a18 100644
--- a/include/wlr/types/wlr_box.h
+++ b/include/wlr/types/wlr_box.h
@@ -27,7 +27,7 @@ void wlr_box_transform(const struct wlr_box *box,
struct wlr_box *dest);
/**
- * Creates the smallest box that contains a rotated box.
+ * Creates the smallest box that contains the box rotated about its center.
*/
void wlr_box_rotated_bounds(const struct wlr_box *box, float rotation,
struct wlr_box *dest);
diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h
index da010972..70dca9f7 100644
--- a/include/wlr/types/wlr_cursor.h
+++ b/include/wlr/types/wlr_cursor.h
@@ -7,12 +7,37 @@
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output.h>
+/**
+ * wlr_cursor implements the behavior of the "cursor", that is, the image on the
+ * screen typically moved about with a mouse or so. It provides tracking for
+ * this in global coordinates, and integrates with wlr_output,
+ * wlr_output_layout, and wlr_input_device. You can use it to abstract multiple
+ * input devices over a single cursor, constrain cursor movement to the usable
+ * area of a wlr_output_layout and communicate position updates to the hardware
+ * cursor, constrain specific input devices to specific outputs or regions of
+ * the screen, and so on.
+ */
+
struct wlr_cursor_state;
struct wlr_cursor {
struct wlr_cursor_state *state;
double x, y;
+ /**
+ * The interpretation of these signals is the responsibility of the
+ * compositor, but some helpers are provided for your benefit. If you
+ * receive a relative motion event, for example, you may want to call
+ * wlr_cursor_move. If you receive an absolute event, call
+ * wlr_cursor_warp_absolute. If you pass an input device into these
+ * functions, it will apply the region/output constraints associated with
+ * that device to the resulting cursor motion. If an output layout is
+ * attached, these functions will constrain the resulting cursor motion to
+ * within the usable space of the output layout.
+ *
+ * Re-broadcasting these signals to, for example, a wlr_seat, is also your
+ * responsibility.
+ */
struct {
struct wl_signal motion;
struct wl_signal motion_absolute;
diff --git a/include/wlr/types/wlr_layer_shell.h b/include/wlr/types/wlr_layer_shell.h
new file mode 100644
index 00000000..8cc7782f
--- /dev/null
+++ b/include/wlr/types/wlr_layer_shell.h
@@ -0,0 +1,100 @@
+#ifndef WLR_TYPES_WLR_LAYER_SHELL_H
+#define WLR_TYPES_WLR_LAYER_SHELL_H
+#include <stdbool.h>
+#include <stdint.h>
+#include <wayland-server.h>
+#include <wlr/types/wlr_box.h>
+#include <wlr/types/wlr_surface.h>
+#include "wlr-layer-shell-unstable-v1-protocol.h"
+
+/**
+ * wlr_layer_shell allows clients to arrange themselves in "layers" on the
+ * desktop in accordance with the wlr-layer-shell protocol. When a client is
+ * added, the new_surface signal will be raised and passed a reference to our
+ * wlr_layer_surface. At this time, the client will have configured the surface
+ * as it desires, including information like desired anchors and margins. The
+ * compositor should use this information to decide how to arrange the layer
+ * on-screen, then determine the dimensions of the layer and call
+ * wlr_layer_surface_configure. The client will then attach a buffer and commit
+ * the surface, at which point the wlr_layer_surface map signal is raised and
+ * the compositor should begin rendering the surface.
+ */
+struct wlr_layer_shell {
+ struct wl_global *wl_global;
+ struct wl_list client_resources; // wl_resource
+
+ struct wl_listener display_destroy;
+
+ struct {
+ struct wl_signal new_surface;
+ } events;
+
+ void *data;
+};
+
+struct wlr_layer_surface_state {
+ uint32_t anchor;
+ int32_t exclusive_zone;
+ struct {
+ uint32_t top, right, bottom, left;
+ } margin;
+ bool keyboard_interactive;
+ uint32_t desired_width, desired_height;
+ uint32_t actual_width, actual_height;
+};
+
+struct wlr_layer_surface_configure {
+ struct wl_list link; // wlr_layer_surface::configure_list
+ uint32_t serial;
+ struct wlr_layer_surface_state state;
+};
+
+struct wlr_layer_surface {
+ struct wlr_surface *surface;
+ struct wlr_output *output;
+ struct wl_resource *resource;
+ struct wlr_layer_shell *shell;
+
+ const char *namespace;
+ enum zwlr_layer_shell_v1_layer layer;
+
+ bool added, configured, mapped, closed;
+ uint32_t configure_serial;
+ struct wl_event_source *configure_idle;
+ uint32_t configure_next_serial;
+ struct wl_list configure_list;
+
+ struct wlr_layer_surface_configure *acked_configure;
+
+ struct wlr_layer_surface_state client_pending;
+ struct wlr_layer_surface_state server_pending;
+ struct wlr_layer_surface_state current;
+
+ struct wl_listener surface_destroy_listener;
+
+ struct {
+ struct wl_signal destroy;
+ struct wl_signal map;
+ struct wl_signal unmap;
+ } events;
+
+ void *data;
+};
+
+struct wlr_layer_shell *wlr_layer_shell_create(struct wl_display *display);
+void wlr_layer_shell_destroy(struct wlr_layer_shell *layer_shell);
+
+/**
+ * Notifies the layer surface to configure itself with this width/height. The
+ * layer_surface will signal its map event when the surface is ready to assume
+ * this size.
+ */
+void wlr_layer_surface_configure(struct wlr_layer_surface *surface,
+ uint32_t width, uint32_t height);
+
+/**
+ * Unmaps this layer surface and notifies the client that it has been closed.
+ */
+void wlr_layer_surface_close(struct wlr_layer_surface *surface);
+
+#endif
diff --git a/include/wlr/types/wlr_linux_dmabuf.h b/include/wlr/types/wlr_linux_dmabuf.h
index 9d71e598..c06d8a87 100644
--- a/include/wlr/types/wlr_linux_dmabuf.h
+++ b/include/wlr/types/wlr_linux_dmabuf.h
@@ -11,6 +11,12 @@
#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
#endif
+enum {
+ WLR_DMABUF_BUFFER_ATTRIBS_FLAGS_Y_INVERT = 1,
+ WLR_DMABUF_BUFFER_ATTRIBS_FLAGS_INTERLACED = 2,
+ WLR_DMABUF_BUFFER_ATTRIBS_FLAGS_BOTTOM_FIRST = 4,
+};
+
struct wlr_dmabuf_buffer_attribs {
/* set via params_add */
int n_planes;
@@ -22,7 +28,7 @@ struct wlr_dmabuf_buffer_attribs {
int32_t width;
int32_t height;
uint32_t format;
- uint32_t flags; /* enum zlinux_buffer_params_flags */
+ uint32_t flags;
};
struct wlr_dmabuf_buffer {
@@ -52,11 +58,6 @@ struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_buffer_resource(
struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_params_resource(
struct wl_resource *params_resource);
-/**
- * Returns true if the given dmabuf has y-axis inverted, false otherwise
- */
-bool wlr_dmabuf_buffer_has_inverted_y(struct wlr_dmabuf_buffer *dmabuf);
-
/* the protocol interface */
struct wlr_linux_dmabuf {
struct wl_global *wl_global;
diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h
index a5fa093b..9938f4b1 100644
--- a/include/wlr/types/wlr_xdg_shell.h
+++ b/include/wlr/types/wlr_xdg_shell.h
@@ -40,6 +40,9 @@ struct wlr_xdg_popup {
bool committed;
struct wlr_xdg_surface *parent;
struct wlr_seat *seat;
+
+ // Position of the popup relative to the upper left corner of the window
+ // geometry of the parent surface
struct wlr_box geometry;
struct wl_list grab_link; // wlr_xdg_popup_grab::popups
@@ -74,9 +77,22 @@ struct wlr_xdg_toplevel {
struct wlr_xdg_surface *base;
struct wlr_xdg_surface *parent;
bool added;
- struct wlr_xdg_toplevel_state next; // client protocol requests
- struct wlr_xdg_toplevel_state pending; // user configure requests
+
+ struct wlr_xdg_toplevel_state client_pending;
+ struct wlr_xdg_toplevel_state server_pending;
struct wlr_xdg_toplevel_state current;
+
+ char *title;
+ char *app_id;
+
+ struct {
+ struct wl_signal request_maximize;
+ struct wl_signal request_fullscreen;
+ struct wl_signal request_minimize;
+ struct wl_signal request_move;
+ struct wl_signal request_resize;
+ struct wl_signal request_show_window_menu;
+ } events;
};
struct wlr_xdg_surface_configure {
@@ -106,9 +122,6 @@ struct wlr_xdg_surface {
uint32_t configure_next_serial;
struct wl_list configure_list;
- char *title;
- char *app_id;
-
bool has_next_geometry;
struct wlr_box next_geometry;
struct wlr_box geometry;
@@ -121,13 +134,6 @@ struct wlr_xdg_surface {
struct wl_signal new_popup;
struct wl_signal map;
struct wl_signal unmap;
-
- struct wl_signal request_maximize;
- struct wl_signal request_fullscreen;
- struct wl_signal request_minimize;
- struct wl_signal request_move;
- struct wl_signal request_resize;
- struct wl_signal request_show_window_menu;
} events;
void *data;
@@ -204,9 +210,9 @@ uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface,
bool resizing);
/**
- * Request that this toplevel surface closes.
+ * Request that this xdg surface closes.
*/
-void wlr_xdg_toplevel_send_close(struct wlr_xdg_surface *surface);
+void wlr_xdg_surface_send_close(struct wlr_xdg_surface *surface);
/**
* Compute the popup position in surface-local coordinates.
diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h
index e085c493..e2a58669 100644
--- a/include/wlr/types/wlr_xdg_shell_v6.h
+++ b/include/wlr/types/wlr_xdg_shell_v6.h
@@ -111,6 +111,9 @@ struct wlr_xdg_popup_v6 {
bool committed;
struct wlr_xdg_surface_v6 *parent;
struct wlr_seat *seat;
+
+ // Position of the popup relative to the upper left corner of the window
+ // geometry of the parent surface
struct wlr_box geometry;
struct wlr_xdg_positioner_v6_attributes positioner;
@@ -147,9 +150,22 @@ struct wlr_xdg_toplevel_v6 {
struct wlr_xdg_surface_v6 *base;
struct wlr_xdg_surface_v6 *parent;
bool added;
- struct wlr_xdg_toplevel_v6_state next; // client protocol requests
- struct wlr_xdg_toplevel_v6_state pending; // user configure requests
+
+ struct wlr_xdg_toplevel_v6_state client_pending;
+ struct wlr_xdg_toplevel_v6_state server_pending;
struct wlr_xdg_toplevel_v6_state current;
+
+ char *title;
+ char *app_id;
+
+ struct {
+ struct wl_signal request_maximize;
+ struct wl_signal request_fullscreen;
+ struct wl_signal request_minimize;
+ struct wl_signal request_move;
+ struct wl_signal request_resize;
+ struct wl_signal request_show_window_menu;
+ } events;
};
struct wlr_xdg_surface_v6_configure {
@@ -179,9 +195,6 @@ struct wlr_xdg_surface_v6 {
uint32_t configure_next_serial;
struct wl_list configure_list;
- char *title;
- char *app_id;
-
bool has_next_geometry;
struct wlr_box next_geometry;
struct wlr_box geometry;
@@ -194,13 +207,6 @@ struct wlr_xdg_surface_v6 {
struct wl_signal new_popup;
struct wl_signal map;
struct wl_signal unmap;
-
- struct wl_signal request_maximize;
- struct wl_signal request_fullscreen;
- struct wl_signal request_minimize;
- struct wl_signal request_move;
- struct wl_signal request_resize;
- struct wl_signal request_show_window_menu;
} events;
void *data;
@@ -277,9 +283,9 @@ uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
bool resizing);
/**
- * Request that this toplevel surface closes.
+ * Request that this xdg surface closes.
*/
-void wlr_xdg_toplevel_v6_send_close(struct wlr_xdg_surface_v6 *surface);
+void wlr_xdg_surface_v6_send_close(struct wlr_xdg_surface_v6 *surface);
/**
* Compute the popup position in surface-local coordinates.
diff --git a/include/wlr/util/region.h b/include/wlr/util/region.h
index 7883af97..c0fe6063 100644
--- a/include/wlr/util/region.h
+++ b/include/wlr/util/region.h
@@ -26,4 +26,11 @@ void wlr_region_transform(pixman_region32_t *dst, pixman_region32_t *src,
void wlr_region_expand(pixman_region32_t *dst, pixman_region32_t *src,
int distance);
+/*
+ * Builds the smallest possible region that contains the region rotated about
+ * the point (ox, oy).
+ */
+void wlr_region_rotated_bounds(pixman_region32_t *dst, pixman_region32_t *src,
+ float rotation, int ox, int oy);
+
#endif
diff --git a/include/xwayland/xwm.h b/include/xwayland/xwm.h
index 4b15cc84..9e21ea3a 100644
--- a/include/xwayland/xwm.h
+++ b/include/xwayland/xwm.h
@@ -2,6 +2,7 @@
#define XWAYLAND_XWM_H
#include <wayland-server-core.h>
+#include <wlr/config.h>
#include <wlr/xwayland.h>
#include <xcb/render.h>