aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/backend/drm/renderer.h2
-rw-r--r--include/rootston/desktop.h20
-rw-r--r--include/rootston/output.h45
-rw-r--r--include/rootston/seat.h15
-rw-r--r--include/rootston/view.h48
-rw-r--r--include/wlr/interfaces/wlr_output.h5
-rw-r--r--include/wlr/render.h4
-rw-r--r--include/wlr/render/egl.h11
-rw-r--r--include/wlr/render/interface.h4
-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.h37
-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
16 files changed, 175 insertions, 35 deletions
diff --git a/include/backend/drm/renderer.h b/include/backend/drm/renderer.h
index 45127cd0..a3f19fc3 100644
--- a/include/backend/drm/renderer.h
+++ b/include/backend/drm/renderer.h
@@ -45,7 +45,7 @@ bool wlr_drm_plane_surfaces_init(struct wlr_drm_plane *plane, struct wlr_drm_bac
int32_t width, uint32_t height, uint32_t format);
void wlr_drm_surface_finish(struct wlr_drm_surface *surf);
-void wlr_drm_surface_make_current(struct wlr_drm_surface *surf);
+bool wlr_drm_surface_make_current(struct wlr_drm_surface *surf, int *buffer_age);
struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_surface *surf);
struct gbm_bo *wlr_drm_surface_get_front(struct wlr_drm_surface *surf);
void wlr_drm_surface_post(struct wlr_drm_surface *surf);
diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h
index 9dfd7b10..388fb55d 100644
--- a/include/rootston/desktop.h
+++ b/include/rootston/desktop.h
@@ -16,15 +16,7 @@
#include <wlr/types/wlr_idle.h>
#include "rootston/view.h"
#include "rootston/config.h"
-
-struct roots_output {
- struct roots_desktop *desktop;
- struct wlr_output *wlr_output;
- struct wl_listener frame;
- struct timespec last_frame;
- struct wl_list link; // roots_desktop:outputs
- struct roots_view *fullscreen_view;
-};
+#include "rootston/output.h"
struct roots_desktop {
struct wl_list views; // roots_view::link
@@ -64,7 +56,7 @@ struct roots_desktop {
struct roots_server;
struct roots_desktop *desktop_create(struct roots_server *server,
- struct roots_config *config);
+ struct roots_config *config);
void desktop_destroy(struct roots_desktop *desktop);
struct roots_output *desktop_output_from_wlr_output(
struct roots_desktop *desktop, struct wlr_output *output);
@@ -72,11 +64,11 @@ struct roots_view *desktop_view_at(struct roots_desktop *desktop, double lx,
double ly, struct wlr_surface **surface, double *sx, double *sy);
void view_init(struct roots_view *view, struct roots_desktop *desktop);
-void view_destroy(struct roots_view *view);
+void view_finish(struct roots_view *view);
void view_activate(struct roots_view *view, bool activate);
-
-void output_add_notify(struct wl_listener *listener, void *data);
-void output_remove_notify(struct wl_listener *listener, void *data);
+void view_apply_damage(struct roots_view *view);
+void view_damage_whole(struct roots_view *view);
+void view_update_position(struct roots_view *view, double x, double y);
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data);
void handle_wl_shell_surface(struct wl_listener *listener, void *data);
diff --git a/include/rootston/output.h b/include/rootston/output.h
new file mode 100644
index 00000000..89fe1d82
--- /dev/null
+++ b/include/rootston/output.h
@@ -0,0 +1,45 @@
+#ifndef _ROOTSTON_OUTPUT_H
+#define _ROOTSTON_OUTPUT_H
+
+#include <time.h>
+#include <pixman.h>
+#include <wayland-server.h>
+
+/**
+ * Damage tracking requires to keep track of previous frames' damage. To allow
+ * damage tracking to work with triple buffering, an history of two frames is
+ * required.
+ */
+#define ROOTS_OUTPUT_PREVIOUS_DAMAGE_LEN 2
+
+struct roots_desktop;
+
+struct roots_output {
+ struct roots_desktop *desktop;
+ struct wlr_output *wlr_output;
+ struct wl_list link; // roots_desktop:outputs
+
+ struct roots_view *fullscreen_view;
+
+ struct timespec last_frame;
+ pixman_region32_t damage;
+ bool frame_pending;
+
+ // circular queue for previous damage
+ pixman_region32_t previous_damage[ROOTS_OUTPUT_PREVIOUS_DAMAGE_LEN];
+ size_t previous_damage_idx;
+
+ struct wl_listener frame;
+ struct wl_listener mode;
+ struct wl_listener needs_swap;
+};
+
+void output_add_notify(struct wl_listener *listener, void *data);
+void output_remove_notify(struct wl_listener *listener, void *data);
+
+void output_damage_whole_view(struct roots_output *output,
+ struct roots_view *view);
+void output_damage_from_view(struct roots_output *output,
+ struct roots_view *view);
+
+#endif
diff --git a/include/rootston/seat.h b/include/rootston/seat.h
index 966d98e5..f1061226 100644
--- a/include/rootston/seat.h
+++ b/include/rootston/seat.h
@@ -17,12 +17,15 @@ struct roots_seat {
struct wl_list views; // roots_seat_view::link
bool has_focus;
+ struct wl_list drag_icons; // roots_drag_icon::link
+
struct wl_list keyboards;
struct wl_list pointers;
struct wl_list touch;
struct wl_list tablet_tools;
- struct wl_listener seat_destroy;
+ struct wl_listener new_drag_icon;
+ struct wl_listener destroy;
};
struct roots_seat_view {
@@ -38,6 +41,16 @@ struct roots_seat_view {
struct wl_listener view_destroy;
};
+struct roots_drag_icon {
+ struct roots_seat *seat;
+ struct wlr_drag_icon *wlr_drag_icon;
+ struct wl_list link;
+
+ struct wl_listener surface_commit;
+ struct wl_listener map;
+ struct wl_listener destroy;
+};
+
struct roots_pointer {
struct roots_seat *seat;
struct wlr_input_device *device;
diff --git a/include/rootston/view.h b/include/rootston/view.h
index e837586a..35660d64 100644
--- a/include/rootston/view.h
+++ b/include/rootston/view.h
@@ -11,6 +11,7 @@ struct roots_wl_shell_surface {
struct roots_view *view;
struct wl_listener destroy;
+ struct wl_listener new_popup;
struct wl_listener request_move;
struct wl_listener request_resize;
struct wl_listener request_maximize;
@@ -23,13 +24,15 @@ struct roots_wl_shell_surface {
struct roots_xdg_surface_v6 {
struct roots_view *view;
- struct wl_listener commit;
struct wl_listener destroy;
+ struct wl_listener new_popup;
struct wl_listener request_move;
struct wl_listener request_resize;
struct wl_listener request_maximize;
struct wl_listener request_fullscreen;
+ struct wl_listener surface_commit;
+
uint32_t pending_move_resize_configure_serial;
};
@@ -95,7 +98,11 @@ struct roots_view {
struct roots_xwayland_surface *roots_xwayland_surface;
#endif
};
+
struct wlr_surface *wlr_surface;
+ struct wl_list children; // roots_view_child::link
+
+ struct wl_listener new_subsurface;
struct {
struct wl_signal destroy;
@@ -116,6 +123,38 @@ struct roots_view {
void (*close)(struct roots_view *view);
};
+struct roots_view_child {
+ struct roots_view *view;
+ struct wlr_surface *wlr_surface;
+ struct wl_list link;
+
+ struct wl_listener commit;
+ struct wl_listener new_subsurface;
+
+ void (*destroy)(struct roots_view_child *child);
+};
+
+struct roots_subsurface {
+ struct roots_view_child view_child;
+ struct wlr_subsurface *wlr_subsurface;
+ struct wl_listener destroy;
+};
+
+struct roots_wl_shell_popup {
+ struct roots_view_child view_child;
+ struct wlr_wl_shell_surface *wlr_wl_shell_surface;
+ struct wl_listener destroy;
+ struct wl_listener set_state;
+ struct wl_listener new_popup;
+};
+
+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 new_popup;
+};
+
void view_get_box(const struct roots_view *view, struct wlr_box *box);
void view_activate(struct roots_view *view, bool active);
void view_move(struct roots_view *view, double x, double y);
@@ -143,4 +182,11 @@ enum roots_deco_part {
enum roots_deco_part view_get_deco_part(struct roots_view *view, double sx, double sy);
+void view_child_init(struct roots_view_child *child, struct roots_view *view,
+ struct wlr_surface *wlr_surface);
+void view_child_finish(struct roots_view_child *child);
+
+struct roots_subsurface *subsurface_create(struct roots_view *view,
+ struct wlr_subsurface *wlr_subsurface);
+
#endif
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;