aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRicardo Steijn <61013287+RicArch97@users.noreply.github.com>2024-08-05 02:13:49 +0200
committerGitHub <noreply@github.com>2024-08-05 02:13:49 +0200
commit9a1c411abd8261c121dcd50dfe54132718768084 (patch)
treeb38f31ec17b8f8408652b9ae104b6c47bce50714 /include
parentb881c2e84c4be3c7b996f85200cfe391a7979267 (diff)
Add support for tearing-control-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3871 Adds option to allow tearing per output, as well as an option to force enable or disable tearing for a specific application using a window rule. Only works with fullscreen applications.
Diffstat (limited to 'include')
-rw-r--r--include/sway/commands.h2
-rw-r--r--include/sway/config.h1
-rw-r--r--include/sway/output.h1
-rw-r--r--include/sway/server.h6
-rw-r--r--include/sway/tree/view.h12
5 files changed, 22 insertions, 0 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h
index 15cd8698..5210d3ba 100644
--- a/include/sway/commands.h
+++ b/include/sway/commands.h
@@ -104,6 +104,7 @@ struct sway_container *container_find_resize_parent(struct sway_container *con,
sway_cmd cmd_exec_validate;
sway_cmd cmd_exec_process;
+sway_cmd cmd_allow_tearing;
sway_cmd cmd_assign;
sway_cmd cmd_bar;
sway_cmd cmd_bindcode;
@@ -283,6 +284,7 @@ sway_cmd input_cmd_xkb_switch_layout;
sway_cmd input_cmd_xkb_variant;
sway_cmd output_cmd_adaptive_sync;
+sway_cmd output_cmd_allow_tearing;
sway_cmd output_cmd_background;
sway_cmd output_cmd_color_profile;
sway_cmd output_cmd_disable;
diff --git a/include/sway/config.h b/include/sway/config.h
index dfa3c1b7..d9f56157 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -289,6 +289,7 @@ struct output_config {
enum render_bit_depth render_bit_depth;
bool set_color_transform;
struct wlr_color_transform *color_transform;
+ int allow_tearing;
char *background;
char *background_option;
diff --git a/include/sway/output.h b/include/sway/output.h
index 2189c6e8..7e2d5892 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -73,6 +73,7 @@ struct sway_output {
int max_render_time; // In milliseconds
struct wl_event_source *repaint_timer;
bool gamma_lut_changed;
+ bool allow_tearing;
};
struct sway_output_non_desktop {
diff --git a/include/sway/server.h b/include/sway/server.h
index abf1b6b4..460f9e17 100644
--- a/include/sway/server.h
+++ b/include/sway/server.h
@@ -115,6 +115,10 @@ struct sway_server {
struct wl_listener xdg_activation_v1_new_token;
struct wl_listener request_set_cursor_shape;
+
+ struct wlr_tearing_control_manager_v1 *tearing_control_v1;
+ struct wl_listener tearing_control_new_object;
+ struct wl_list tearing_controllers; // sway_tearing_controller::link
struct wl_list pending_launcher_ctxs; // launcher_ctx::link
@@ -182,4 +186,6 @@ void xdg_activation_v1_handle_new_token(struct wl_listener *listener,
void set_rr_scheduling(void);
+void handle_new_tearing_hint(struct wl_listener *listener, void *data);
+
#endif
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 3ae8cf22..14aad1a1 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -4,6 +4,7 @@
#include <wlr/config.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_scene.h>
+#include <wlr/types/wlr_tearing_control_v1.h>
#include "sway/config.h"
#if WLR_HAS_XWAYLAND
#include <wlr/xwayland.h>
@@ -34,6 +35,12 @@ enum sway_view_prop {
#endif
};
+enum sway_view_tearing_mode {
+ TEARING_OVERRIDE_FALSE,
+ TEARING_OVERRIDE_TRUE,
+ TEARING_WINDOW_HINT,
+};
+
struct sway_view_impl {
void (*get_constraints)(struct sway_view *view, double *min_width,
double *max_width, double *min_height, double *max_height);
@@ -111,6 +118,9 @@ struct sway_view {
int max_render_time; // In milliseconds
enum seat_config_shortcuts_inhibit shortcuts_inhibit;
+
+ enum sway_view_tearing_mode tearing_mode;
+ enum wp_tearing_control_v1_presentation_hint tearing_hint;
};
struct sway_xdg_shell_view {
@@ -335,4 +345,6 @@ void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx);
void view_send_frame_done(struct sway_view *view);
+bool view_can_tear(struct sway_view *view);
+
#endif