diff --git a/docs/labwc-actions.5.scd b/docs/labwc-actions.5.scd
index 9d55f63f..8462bca4 100644
--- a/docs/labwc-actions.5.scd
+++ b/docs/labwc-actions.5.scd
@@ -157,6 +157,7 @@ Actions are used in menus and keyboard/mouse bindings.
**
Toggles tearing for the focused window.
+ Requires the config option 'allowTearing'.
**
Give focus to topmost window on given output and warp the cursor
diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd
index e634a27c..c7de9cd3 100644
--- a/docs/labwc-config.5.scd
+++ b/docs/labwc-config.5.scd
@@ -142,11 +142,14 @@ this is for compatibility with Openbox.
*fullscreen* enables adaptive sync whenever a window is in fullscreen
mode.
-** [yes|no]
+** [yes|no|fullscreen]
Allow tearing to reduce input lag. Default is no.
This option requires setting the environment variable
WLR_DRM_NO_ATOMIC=1.
- *yes* allow tearing if requested by the active window.
+
+ *yes* allows tearing if requested by the active window.
+
+ *fullscreen* enables tearing automatically for fullscreen windows.
** [yes|no]
Try to re-use the existing output mode (resolution / refresh rate).
diff --git a/include/config/rcxml.h b/include/config/rcxml.h
index 8e417000..f6d153b3 100644
--- a/include/config/rcxml.h
+++ b/include/config/rcxml.h
@@ -35,6 +35,12 @@ enum adaptive_sync_mode {
LAB_ADAPTIVE_SYNC_FULLSCREEN,
};
+enum tearing_mode {
+ LAB_TEARING_DISABLED = 0,
+ LAB_TEARING_ENABLED,
+ LAB_TEARING_FULLSCREEN,
+};
+
enum tiling_events_mode {
LAB_TILING_EVENTS_NEVER = 0,
LAB_TILING_EVENTS_REGION = 1 << 0,
@@ -65,7 +71,7 @@ struct rcxml {
bool xdg_shell_server_side_deco;
int gap;
enum adaptive_sync_mode adaptive_sync;
- bool allow_tearing;
+ enum tearing_mode allow_tearing;
bool reuse_output_mode;
enum view_placement_policy placement_policy;
diff --git a/src/config/rcxml.c b/src/config/rcxml.c
index 56f93e36..182d61de 100644
--- a/src/config/rcxml.c
+++ b/src/config/rcxml.c
@@ -695,6 +695,18 @@ set_adaptive_sync_mode(const char *str, enum adaptive_sync_mode *variable)
}
}
+static void
+set_tearing_mode(const char *str, enum tearing_mode *variable)
+{
+ if (!strcasecmp(str, "fullscreen")) {
+ *variable = LAB_TEARING_FULLSCREEN;
+ } else if (parse_bool(str, -1) == 1) {
+ *variable = LAB_TEARING_ENABLED;
+ } else {
+ *variable = LAB_TEARING_DISABLED;
+ }
+}
+
static void
entry(xmlNode *node, char *nodename, char *content)
{
@@ -803,11 +815,11 @@ entry(xmlNode *node, char *nodename, char *content)
} else if (!strcasecmp(nodename, "adaptiveSync.core")) {
set_adaptive_sync_mode(content, &rc.adaptive_sync);
} else if (!strcasecmp(nodename, "allowTearing.core")) {
- set_bool(content, &rc.allow_tearing);
+ set_tearing_mode(content, &rc.allow_tearing);
if (rc.allow_tearing) {
char *no_atomic_env = getenv("WLR_DRM_NO_ATOMIC");
if (!no_atomic_env || strcmp(no_atomic_env, "1") != 0) {
- rc.allow_tearing = false;
+ rc.allow_tearing = LAB_TEARING_DISABLED;
wlr_log(WLR_ERROR, "tearing requires WLR_DRM_NO_ATOMIC=1");
}
}
diff --git a/src/output.c b/src/output.c
index e1c615e7..f1066edb 100644
--- a/src/output.c
+++ b/src/output.c
@@ -44,6 +44,12 @@ get_tearing_preference(struct output *output)
return false;
}
+ /* If configured, automatically enable tearing for fullscreen applications */
+ if (rc.allow_tearing == LAB_TEARING_FULLSCREEN
+ && server->active_view->fullscreen) {
+ return true;
+ }
+
/* If the active view requests tearing, or it is toggled on with action, allow it */
return server->active_view->tearing_hint;
}