aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-06-17 14:49:18 +0100
committeremersion <contact@emersion.fr>2018-06-17 14:49:18 +0100
commit57548b557ae9e4f2b03c2d78996706f0990ab9d6 (patch)
tree85d7ae8d5d3f302d16914690f8e30e40e8ba0969 /include/wlr
parentbd0c1b794992bf94560bd429f4057c9d09989f06 (diff)
parentfb118ac9966bbb663ddb9964f54c879a0bb88fba (diff)
Merge branch 'master' into screencontent
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/backend/session.h6
-rw-r--r--include/wlr/render/egl.h23
-rw-r--r--include/wlr/render/interface.h2
-rw-r--r--include/wlr/render/wlr_renderer.h6
-rw-r--r--include/wlr/types/wlr_buffer.h63
-rw-r--r--include/wlr/types/wlr_data_device.h5
-rw-r--r--include/wlr/types/wlr_keyboard.h2
-rw-r--r--include/wlr/types/wlr_seat.h2
-rw-r--r--include/wlr/types/wlr_surface.h25
-rw-r--r--include/wlr/types/wlr_xdg_shell.h10
-rw-r--r--include/wlr/types/wlr_xdg_shell_v6.h10
11 files changed, 127 insertions, 27 deletions
diff --git a/include/wlr/backend/session.h b/include/wlr/backend/session.h
index 4d04b363..1cf41939 100644
--- a/include/wlr/backend/session.h
+++ b/include/wlr/backend/session.h
@@ -25,8 +25,12 @@ struct wlr_session {
struct wl_signal session_signal;
bool active;
+ /*
+ * 0 if virtual terminals are not supported
+ * i.e. seat != "seat0"
+ */
unsigned vtnr;
- char seat[8];
+ char seat[256];
struct udev *udev;
struct udev_monitor *mon;
diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h
index 39b1d3d9..6b887f4f 100644
--- a/include/wlr/render/egl.h
+++ b/include/wlr/render/egl.h
@@ -16,13 +16,15 @@ struct wlr_egl {
const char *exts_str;
struct {
- bool buffer_age;
- bool swap_buffers_with_damage;
- bool dmabuf_import;
- bool dmabuf_import_modifiers;
- bool dmabuf_export;
- bool bind_wayland_display;
- } egl_exts;
+ bool bind_wayland_display_wl;
+ bool buffer_age_ext;
+ bool image_base_khr;
+ bool image_dma_buf_export_mesa;
+ bool image_dmabuf_import_ext;
+ bool image_dmabuf_import_modifiers_ext;
+ bool swap_buffers_with_damage_ext;
+ bool swap_buffers_with_damage_khr;
+ } exts;
struct wl_display *wl_display;
};
@@ -69,13 +71,6 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
struct wlr_dmabuf_attributes *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_attributes *attributes);
-
-/**
* Get the available dmabuf formats
*/
int wlr_egl_get_dmabuf_formats(struct wlr_egl *egl, int **formats);
diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h
index af4bc75e..fb427c89 100644
--- a/include/wlr/render/interface.h
+++ b/include/wlr/render/interface.h
@@ -30,8 +30,6 @@ struct wlr_renderer_impl {
struct wl_resource *resource);
void (*wl_drm_buffer_get_size)(struct wlr_renderer *renderer,
struct wl_resource *buffer, int *width, int *height);
- bool (*check_import_dmabuf)(struct wlr_renderer *renderer,
- struct wlr_dmabuf_attributes *attribs);
int (*get_dmabuf_formats)(struct wlr_renderer *renderer, int **formats);
int (*get_dmabuf_modifiers)(struct wlr_renderer *renderer, int format,
uint64_t **modifiers);
diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h
index dd62944f..c715e4b0 100644
--- a/include/wlr/render/wlr_renderer.h
+++ b/include/wlr/render/wlr_renderer.h
@@ -85,12 +85,6 @@ 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);
/**
- * 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_renderer_check_import_dmabuf(struct wlr_renderer *renderer,
- struct wlr_dmabuf_attributes *attributes);
-/**
* Reads out of pixels of the currently bound surface into data. `stride` is in
* bytes.
*/
diff --git a/include/wlr/types/wlr_buffer.h b/include/wlr/types/wlr_buffer.h
new file mode 100644
index 00000000..eabc8b51
--- /dev/null
+++ b/include/wlr/types/wlr_buffer.h
@@ -0,0 +1,63 @@
+#ifndef WLR_TYPES_WLR_BUFFER_H
+#define WLR_TYPES_WLR_BUFFER_H
+
+#include <pixman.h>
+#include <wayland-server.h>
+
+/**
+ * A client buffer.
+ */
+struct wlr_buffer {
+ /**
+ * The buffer resource, if any. Will be NULL if the client destroys it.
+ */
+ struct wl_resource *resource;
+ /**
+ * The buffer's texture, if any. A buffer will not have a texture if the
+ * client destroys the buffer before it has been released.
+ */
+ struct wlr_texture *texture;
+ bool released;
+ size_t n_refs;
+
+ struct wl_listener resource_destroy;
+};
+
+struct wlr_renderer;
+
+/**
+ * Check if a resource is a wl_buffer resource.
+ */
+bool wlr_resource_is_buffer(struct wl_resource *resource);
+/**
+ * Get the size of a wl_buffer resource.
+ */
+bool wlr_buffer_get_resource_size(struct wl_resource *resource,
+ struct wlr_renderer *renderer, int *width, int *height);
+
+/**
+ * Upload a buffer to the GPU and reference it.
+ */
+struct wlr_buffer *wlr_buffer_create(struct wlr_renderer *renderer,
+ struct wl_resource *resource);
+/**
+ * Reference the buffer.
+ */
+struct wlr_buffer *wlr_buffer_ref(struct wlr_buffer *buffer);
+/**
+ * Unreference the buffer. After this call, `buffer` may not be accessed
+ * anymore.
+ */
+void wlr_buffer_unref(struct wlr_buffer *buffer);
+/**
+ * Try to update the buffer's content. On success, returns the updated buffer
+ * and destroys the provided `buffer`. On error, `buffer` is intact and NULL is
+ * returned.
+ *
+ * Fails if there's more than one reference to the buffer or if the texture
+ * isn't mutable.
+ */
+struct wlr_buffer *wlr_buffer_apply_damage(struct wlr_buffer *buffer,
+ struct wl_resource *resource, pixman_region32_t *damage);
+
+#endif
diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h
index 80d4bc8b..4de4d610 100644
--- a/include/wlr/types/wlr_data_device.h
+++ b/include/wlr/types/wlr_data_device.h
@@ -88,12 +88,15 @@ struct wlr_drag_icon {
int32_t sx, sy;
struct {
- struct wl_signal map; // emitted when mapped or unmapped
+ struct wl_signal map;
+ struct wl_signal unmap;
struct wl_signal destroy;
} events;
struct wl_listener surface_destroy;
struct wl_listener seat_client_destroy;
+
+ void *data;
};
struct wlr_drag {
diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h
index 97288508..67d4e5be 100644
--- a/include/wlr/types/wlr_keyboard.h
+++ b/include/wlr/types/wlr_keyboard.h
@@ -89,7 +89,7 @@ enum wlr_key_state {
struct wlr_event_keyboard_key {
uint32_t time_msec;
uint32_t keycode;
- bool update_state;
+ bool update_state; // if backend doesn't update modifiers on its own
enum wlr_key_state state;
};
diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h
index f4840c89..5e04003d 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -13,11 +13,11 @@
* managed by wlr_seat; some may be NULL.
*/
struct wlr_seat_client {
- struct wl_resource *wl_resource;
struct wl_client *client;
struct wlr_seat *seat;
// lists of wl_resource
+ struct wl_list wl_resources;
struct wl_list pointers;
struct wl_list keyboards;
struct wl_list touches;
diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h
index d1127c86..8517934a 100644
--- a/include/wlr/types/wlr_surface.h
+++ b/include/wlr/types/wlr_surface.h
@@ -62,12 +62,20 @@ struct wlr_subsurface {
struct {
struct wl_signal destroy;
} events;
+
+ void *data;
};
struct wlr_surface {
struct wl_resource *resource;
struct wlr_renderer *renderer;
- struct wlr_texture *texture;
+ /**
+ * The surface's buffer, if any. A surface has an attached buffer when it
+ * commits with a non-null buffer in its pending state. A surface will not
+ * have a buffer if it has never committed one, has committed a null buffer,
+ * or something went wrong with uploading the buffer.
+ */
+ struct wlr_buffer *buffer;
struct wlr_surface_state *current, *pending;
const char *role; // the lifetime-bound role or null
@@ -123,6 +131,13 @@ int wlr_surface_set_role(struct wlr_surface *surface, const char *role,
bool wlr_surface_has_buffer(struct wlr_surface *surface);
/**
+ * Get the texture of the buffer currently attached to this surface. Returns
+ * NULL if no buffer is currently attached or if something went wrong with
+ * uploading the buffer.
+ */
+struct wlr_texture *wlr_surface_get_texture(struct wlr_surface *surface);
+
+/**
* Create a new subsurface resource with the provided new ID. If `resource_list`
* is non-NULL, adds the subsurface's resource to the list.
*/
@@ -159,6 +174,14 @@ void wlr_surface_send_leave(struct wlr_surface *surface,
void wlr_surface_send_frame_done(struct wlr_surface *surface,
const struct timespec *when);
+struct wlr_box;
+/**
+ * Get the bounding box that contains the surface and all subsurfaces in
+ * surface coordinates.
+ * X and y may be negative, if there are subsurfaces with negative position.
+ */
+void wlr_surface_get_extends(struct wlr_surface *surface, struct wlr_box *box);
+
/**
* Set a callback for surface commit that runs before all the other callbacks.
* This is intended for use by the surface role.
diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h
index 5eb30a16..01dc17fe 100644
--- a/include/wlr/types/wlr_xdg_shell.h
+++ b/include/wlr/types/wlr_xdg_shell.h
@@ -118,6 +118,7 @@ struct wlr_xdg_toplevel {
struct wl_signal request_move;
struct wl_signal request_resize;
struct wl_signal request_show_window_menu;
+ struct wl_signal set_parent;
} events;
};
@@ -342,6 +343,15 @@ struct wlr_xdg_surface *wlr_xdg_surface_from_wlr_surface(
struct wlr_surface *surface);
/**
+ * Get the surface geometry.
+ * This is either the geometry as set by the client, or defaulted to the bounds
+ * of the surface + the subsurfaces (as specified by the protocol).
+ *
+ * The x and y value can be <0
+ */
+void wlr_xdg_surface_get_geometry(struct wlr_xdg_surface *surface, struct wlr_box *box);
+
+/**
* Call `iterator` on each surface in the xdg-surface tree, with the surface's
* position relative to the root xdg-surface. The function is called from root to
* leaves (in rendering order).
diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h
index 2fdf49e5..5f98eb13 100644
--- a/include/wlr/types/wlr_xdg_shell_v6.h
+++ b/include/wlr/types/wlr_xdg_shell_v6.h
@@ -126,6 +126,7 @@ struct wlr_xdg_toplevel_v6 {
struct wl_signal request_move;
struct wl_signal request_resize;
struct wl_signal request_show_window_menu;
+ struct wl_signal set_parent;
} events;
};
@@ -319,6 +320,15 @@ struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_from_wlr_surface(
struct wlr_surface *surface);
/**
+ * Get the surface geometry.
+ * This is either the geometry as set by the client, or defaulted to the bounds
+ * of the surface + the subsurfaces (as specified by the protocol).
+ *
+ * The x and y value can be <0
+ */
+void wlr_xdg_surface_v6_get_geometry(struct wlr_xdg_surface_v6 *surface, struct wlr_box *box);
+
+/**
* Call `iterator` on each surface in the xdg-surface tree, with the surface's
* position relative to the root xdg-surface. The function is called from root to
* leaves (in rendering order).