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/seat.h15
-rw-r--r--include/rootston/view.h48
4 files changed, 112 insertions, 16 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/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