diff options
Diffstat (limited to 'include/wlr')
-rw-r--r-- | include/wlr/interfaces/wlr_output.h | 5 | ||||
-rw-r--r-- | include/wlr/render.h | 4 | ||||
-rw-r--r-- | include/wlr/render/egl.h | 11 | ||||
-rw-r--r-- | include/wlr/render/interface.h | 4 | ||||
-rw-r--r-- | include/wlr/types/wlr_compositor.h | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_data_device.h | 4 | ||||
-rw-r--r-- | include/wlr/types/wlr_output.h | 37 | ||||
-rw-r--r-- | include/wlr/types/wlr_seat.h | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_surface.h | 5 | ||||
-rw-r--r-- | include/wlr/types/wlr_wl_shell.h | 1 | ||||
-rw-r--r-- | include/wlr/types/wlr_xdg_shell_v6.h | 5 |
11 files changed, 62 insertions, 18 deletions
diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index d5837def..f2b65066 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,6 @@ 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); #endif diff --git a/include/wlr/render.h b/include/wlr/render.h index 5027064d..bfd9e829 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,9 @@ 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); +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 bbc5acb4..3927795d 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_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 55431ab1..823c3b5e 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> @@ -47,22 +49,24 @@ 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; + pixman_region32_t damage; // damage for cursors and fullscreen surface 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; @@ -102,14 +106,29 @@ void wlr_output_set_scale(struct wlr_output *output, float scale); void wlr_output_destroy(struct wlr_output *output); 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); 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; |