aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/interfaces/wlr_output.h6
-rw-r--r--include/wlr/render.h9
-rw-r--r--include/wlr/render/egl.h11
-rw-r--r--include/wlr/render/interface.h4
-rw-r--r--include/wlr/types/wlr_box.h14
-rw-r--r--include/wlr/types/wlr_compositor.h2
-rw-r--r--include/wlr/types/wlr_data_device.h4
-rw-r--r--include/wlr/types/wlr_output.h55
-rw-r--r--include/wlr/types/wlr_seat.h2
-rw-r--r--include/wlr/types/wlr_surface.h5
-rw-r--r--include/wlr/types/wlr_wl_shell.h1
-rw-r--r--include/wlr/types/wlr_xdg_shell_v6.h5
-rw-r--r--include/wlr/util/region.h29
13 files changed, 127 insertions, 20 deletions
diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h
index d5837def..652be45e 100644
--- a/include/wlr/interfaces/wlr_output.h
+++ b/include/wlr/interfaces/wlr_output.h
@@ -18,8 +18,8 @@ struct wlr_output_impl {
int32_t hotspot_x, int32_t hotspot_y, bool update_pixels);
bool (*move_cursor)(struct wlr_output *output, int x, int y);
void (*destroy)(struct wlr_output *output);
- void (*make_current)(struct wlr_output *output);
- void (*swap_buffers)(struct wlr_output *output);
+ bool (*make_current)(struct wlr_output *output, int *buffer_age);
+ bool (*swap_buffers)(struct wlr_output *output);
void (*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);
@@ -32,5 +32,7 @@ void wlr_output_update_mode(struct wlr_output *output,
void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
int32_t height, int32_t refresh);
void wlr_output_update_enabled(struct wlr_output *output, bool enabled);
+void wlr_output_update_needs_swap(struct wlr_output *output);
+void wlr_output_send_frame(struct wlr_output *output);
#endif
diff --git a/include/wlr/render.h b/include/wlr/render.h
index 00088b52..c277ab17 100644
--- a/include/wlr/render.h
+++ b/include/wlr/render.h
@@ -5,6 +5,7 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <wayland-server-protocol.h>
+#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_output.h>
struct wlr_texture;
@@ -12,6 +13,14 @@ struct wlr_renderer;
void wlr_renderer_begin(struct wlr_renderer *r, struct wlr_output *output);
void wlr_renderer_end(struct wlr_renderer *r);
+void wlr_renderer_clear(struct wlr_renderer *r, float red, float green,
+ float blue, float alpha);
+/**
+ * Defines a scissor box. Only pixels that lie within the scissor box can be
+ * modified by drawing functions. Providing a NULL `box` disables the scissor
+ * box.
+ */
+void wlr_renderer_scissor(struct wlr_renderer *r, struct wlr_box *box);
/**
* Requests a texture handle from this renderer.
*/
diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h
index bdb8d286..6979fd9b 100644
--- a/include/wlr/render/egl.h
+++ b/include/wlr/render/egl.h
@@ -11,8 +11,12 @@ struct wlr_egl {
EGLConfig config;
EGLContext context;
- const char *egl_exts;
- const char *gl_exts;
+ const char *egl_exts_str;
+ const char *gl_exts_str;
+
+ struct {
+ bool buffer_age;
+ } egl_exts;
struct wl_display *wl_display;
};
@@ -65,4 +69,7 @@ bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImageKHR image);
*/
const char *egl_error(void);
+bool wlr_egl_make_current(struct wlr_egl *egl, EGLSurface surface,
+ int *buffer_age);
+
#endif
diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h
index bb337409..2531f33c 100644
--- a/include/wlr/render/interface.h
+++ b/include/wlr/render/interface.h
@@ -6,6 +6,7 @@
#include <EGL/eglext.h>
#include <stdbool.h>
#include <wlr/render.h>
+#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_output.h>
struct wlr_renderer_impl;
@@ -17,6 +18,9 @@ struct wlr_renderer {
struct wlr_renderer_impl {
void (*begin)(struct wlr_renderer *renderer, struct wlr_output *output);
void (*end)(struct wlr_renderer *renderer);
+ void (*clear)(struct wlr_renderer *renderer, float red, float green,
+ float blue, float alpha);
+ void (*scissor)(struct wlr_renderer *renderer, struct wlr_box *box);
struct wlr_texture *(*texture_create)(struct wlr_renderer *renderer);
bool (*render_with_matrix)(struct wlr_renderer *renderer,
struct wlr_texture *texture, const float (*matrix)[16]);
diff --git a/include/wlr/types/wlr_box.h b/include/wlr/types/wlr_box.h
index 0588201c..fc86f0ac 100644
--- a/include/wlr/types/wlr_box.h
+++ b/include/wlr/types/wlr_box.h
@@ -2,6 +2,7 @@
#define WLR_TYPES_WLR_BOX_H
#include <stdbool.h>
+#include <wayland-server.h>
struct wlr_box {
int x, y;
@@ -18,8 +19,17 @@ bool wlr_box_contains_point(const struct wlr_box *box, double x, double y);
bool wlr_box_empty(const struct wlr_box *box);
-enum wl_output_transform;
+/**
+ * Transforms a box inside a `width` x `height` box.
+ */
void wlr_box_transform(const struct wlr_box *box,
- enum wl_output_transform transform, struct wlr_box *dest);
+ enum wl_output_transform transform, int width, int height,
+ struct wlr_box *dest);
+
+/**
+ * Creates the smallest box that contains a rotated box.
+ */
+void wlr_box_rotated_bounds(const struct wlr_box *box, float rotation,
+ struct wlr_box *dest);
#endif
diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h
index ceeb64ca..8481c590 100644
--- a/include/wlr/types/wlr_compositor.h
+++ b/include/wlr/types/wlr_compositor.h
@@ -13,7 +13,7 @@ struct wlr_compositor {
struct wl_listener display_destroy;
struct {
- struct wl_signal create_surface;
+ struct wl_signal new_surface;
} events;
};
diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h
index 54514b4c..ff4a0f7e 100644
--- a/include/wlr/types/wlr_data_device.h
+++ b/include/wlr/types/wlr_data_device.h
@@ -71,10 +71,10 @@ struct wlr_drag_icon {
bool is_pointer;
int32_t touch_id;
- int32_t sx;
- int32_t sy;
+ int32_t sx, sy;
struct {
+ struct wl_signal map; // emitted when mapped or unmapped
struct wl_signal destroy;
} events;
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index 9df2001e..a1058a8c 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -2,6 +2,8 @@
#define WLR_TYPES_WLR_OUTPUT_H
#include <stdbool.h>
+#include <time.h>
+#include <pixman.h>
#include <wayland-util.h>
#include <wayland-server.h>
@@ -51,22 +53,26 @@ struct wlr_output {
char serial[16];
int32_t phys_width, phys_height; // mm
+ // Note: some backends may have zero modes
+ struct wl_list modes;
+ struct wlr_output_mode *current_mode;
+ int32_t width, height;
+ int32_t refresh; // mHz, may be zero
+
bool enabled;
float scale;
enum wl_output_subpixel subpixel;
enum wl_output_transform transform;
- bool needs_swap;
+ bool needs_swap;
+ // damage for cursors and fullscreen surface, in output-local coordinates
+ pixman_region32_t damage;
+ bool frame_pending;
float transform_matrix[16];
- // Note: some backends may have zero modes
- struct wl_list modes;
- struct wlr_output_mode *current_mode;
- int32_t width, height;
- int32_t refresh; // mHz
-
struct {
struct wl_signal frame;
+ struct wl_signal needs_swap;
struct wl_signal swap_buffers;
struct wl_signal enable;
struct wl_signal mode;
@@ -75,9 +81,12 @@ struct wlr_output {
struct wl_signal destroy;
} events;
+ struct wl_event_source *idle_frame;
+
struct wlr_surface *fullscreen_surface;
struct wl_listener fullscreen_surface_commit;
struct wl_listener fullscreen_surface_destroy;
+ int fullscreen_width, fullscreen_height;
struct wl_list cursors; // wlr_output_cursor::link
struct wlr_output_cursor *hardware_cursor;
@@ -104,16 +113,44 @@ void wlr_output_set_transform(struct wlr_output *output,
void wlr_output_set_position(struct wlr_output *output, int32_t lx, int32_t ly);
void wlr_output_set_scale(struct wlr_output *output, float scale);
void wlr_output_destroy(struct wlr_output *output);
+/**
+ * Computes the transformed output resolution.
+ */
+void wlr_output_transformed_resolution(struct wlr_output *output,
+ int *width, int *height);
+/**
+ * Computes the transformed and scaled output resolution.
+ */
void wlr_output_effective_resolution(struct wlr_output *output,
int *width, int *height);
-void wlr_output_make_current(struct wlr_output *output);
-void wlr_output_swap_buffers(struct wlr_output *output);
+/**
+ * Makes the output rendering context current.
+ *
+ * `buffer_age` is set to the drawing buffer age in number of frames or -1 if
+ * unknown. This is useful for damage tracking.
+ */
+bool wlr_output_make_current(struct wlr_output *output, int *buffer_age);
+/**
+ * Swaps the output buffers. If the time of the frame isn't known, set `when` to
+ * NULL. If the compositor doesn't support damage tracking, set `damage` to
+ * NULL.
+ *
+ * Swapping buffers schedules a `frame` event.
+ */
+bool wlr_output_swap_buffers(struct wlr_output *output, struct timespec *when,
+ pixman_region32_t *damage);
+/**
+ * Manually schedules a `frame` event. If a `frame` event is already pending,
+ * it is a no-op.
+ */
+void wlr_output_schedule_frame(struct wlr_output *output);
void wlr_output_set_gamma(struct wlr_output *output,
uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b);
uint32_t wlr_output_get_gamma_size(struct wlr_output *output);
void wlr_output_set_fullscreen_surface(struct wlr_output *output,
struct wlr_surface *surface);
+
struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output);
/**
* Sets the cursor image. The image must be already scaled for the output.
diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h
index c2a89f33..ffdabd98 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -209,6 +209,8 @@ struct wlr_seat {
struct wl_signal selection;
struct wl_signal primary_selection;
+ struct wl_signal new_drag_icon;
+
struct wl_signal destroy;
} events;
diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h
index 9f88d044..50316abc 100644
--- a/include/wlr/types/wlr_surface.h
+++ b/include/wlr/types/wlr_surface.h
@@ -56,6 +56,10 @@ struct wlr_subsurface {
struct wl_list parent_pending_link;
struct wl_listener parent_destroy_listener;
+
+ struct {
+ struct wl_signal destroy;
+ } events;
};
struct wlr_surface {
@@ -70,6 +74,7 @@ struct wlr_surface {
struct {
struct wl_signal commit;
+ struct wl_signal new_subsurface;
struct wl_signal destroy;
} events;
diff --git a/include/wlr/types/wlr_wl_shell.h b/include/wlr/types/wlr_wl_shell.h
index 375477c7..00f2bb69 100644
--- a/include/wlr/types/wlr_wl_shell.h
+++ b/include/wlr/types/wlr_wl_shell.h
@@ -79,6 +79,7 @@ struct wlr_wl_shell_surface {
struct {
struct wl_signal destroy;
struct wl_signal ping_timeout;
+ struct wl_signal new_popup;
struct wl_signal request_move;
struct wl_signal request_resize;
diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h
index 280bea27..c7b1a24b 100644
--- a/include/wlr/types/wlr_xdg_shell_v6.h
+++ b/include/wlr/types/wlr_xdg_shell_v6.h
@@ -34,6 +34,7 @@ struct wlr_xdg_client_v6 {
struct wlr_xdg_popup_v6 {
struct wlr_xdg_surface_v6 *base;
+ struct wl_list link;
struct wl_resource *resource;
bool committed;
@@ -104,8 +105,7 @@ struct wlr_xdg_surface_v6 {
struct wlr_xdg_popup_v6 *popup_state;
};
- struct wl_list popups;
- struct wl_list popup_link;
+ struct wl_list popups; // wlr_xdg_popup_v6::link
bool configured;
bool added;
@@ -126,6 +126,7 @@ struct wlr_xdg_surface_v6 {
struct {
struct wl_signal destroy;
struct wl_signal ping_timeout;
+ struct wl_signal new_popup;
struct wl_signal request_maximize;
struct wl_signal request_fullscreen;
diff --git a/include/wlr/util/region.h b/include/wlr/util/region.h
new file mode 100644
index 00000000..7883af97
--- /dev/null
+++ b/include/wlr/util/region.h
@@ -0,0 +1,29 @@
+#ifndef WLR_UTIL_REGION_H
+#define WLR_UTIL_REGION_H
+
+#include <pixman.h>
+#include <wayland-server.h>
+
+/**
+ * Scales a region, ie. multiplies all its coordinates by `scale`.
+ *
+ * The resulting coordinates are rounded up or down so that the new region is
+ * at least as big as the original one.
+ */
+void wlr_region_scale(pixman_region32_t *dst, pixman_region32_t *src,
+ float scale);
+
+/**
+ * Applies a transform to a region inside a box of size `width` x `height`.
+ */
+void wlr_region_transform(pixman_region32_t *dst, pixman_region32_t *src,
+ enum wl_output_transform transform, int width, int height);
+
+/**
+ * Expands the region of `distance`. If `distance` is negative, it shrinks the
+ * region.
+ */
+void wlr_region_expand(pixman_region32_t *dst, pixman_region32_t *src,
+ int distance);
+
+#endif