aboutsummaryrefslogtreecommitdiff
path: root/include/rootston
diff options
context:
space:
mode:
Diffstat (limited to 'include/rootston')
-rw-r--r--include/rootston/desktop.h20
-rw-r--r--include/rootston/output.h45
-rw-r--r--include/rootston/view.h39
3 files changed, 89 insertions, 15 deletions
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/view.h b/include/rootston/view.h
index 579b148a..8cfdf321 100644
--- a/include/rootston/view.h
+++ b/include/rootston/view.h
@@ -23,13 +23,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;
};
@@ -91,7 +93,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;
@@ -112,6 +118,30 @@ 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_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);
@@ -126,4 +156,11 @@ bool view_center(struct roots_view *view);
void view_setup(struct roots_view *view);
void view_teardown(struct roots_view *view);
+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