tearing: add 'always' which by default enables tearing for all windows

Closes #2272
This commit is contained in:
Consolatis 2024-11-16 06:28:51 +01:00
parent f8ed199197
commit 171ad56f34
5 changed files with 17 additions and 4 deletions

View file

@ -190,18 +190,24 @@ this is for compatibility with Openbox.
*fullscreen* enables adaptive sync whenever a window is in fullscreen *fullscreen* enables adaptive sync whenever a window is in fullscreen
mode. mode.
*<core><allowTearing>* [yes|no|fullscreen|fullscreenForced] *<core><allowTearing>* [yes|no|fullscreen|fullscreenForced|always]
Allow tearing to reduce input lag. Default is no. Allow tearing to reduce input lag. Default is no.
*yes* allows tearing if requested by the active window. *yes* allows tearing if requested by the active window.
*no* tearing is disabled completely.
*fullscreen* allows tearing if requested by the active window, but *fullscreen* allows tearing if requested by the active window, but
only when the window is in fullscreen mode. only when the window is in fullscreen mode.
*fullscreenForced* enables tearing whenever the active window is in *fullscreenForced* enables tearing whenever the active window is in
fullscreen mode, whether or not the application has requested tearing. fullscreen mode, whether or not the application has requested tearing.
Use the *ToggleTearing* action for forcefully enable tearing. *always* enable tearing for all windows by default, ignoring application
requests. The ToggleTearing action may be used to disable tearing.
Use the *ToggleTearing* action to forcefully enable / disable tearing
for the active window. Has no effect when allowTearing is set to no.
Note: Enabling this option with atomic mode setting is experimental. If Note: Enabling this option with atomic mode setting is experimental. If
you experience undesirable side effects when tearing is allowed, you experience undesirable side effects when tearing is allowed,

View file

@ -36,6 +36,7 @@ enum tearing_mode {
LAB_TEARING_ENABLED, LAB_TEARING_ENABLED,
LAB_TEARING_FULLSCREEN, LAB_TEARING_FULLSCREEN,
LAB_TEARING_FULLSCREEN_FORCED, LAB_TEARING_FULLSCREEN_FORCED,
LAB_TEARING_ALWAYS,
}; };
enum tiling_events_mode { enum tiling_events_mode {

View file

@ -954,6 +954,8 @@ set_tearing_mode(const char *str, enum tearing_mode *variable)
*variable = LAB_TEARING_FULLSCREEN; *variable = LAB_TEARING_FULLSCREEN;
} else if (!strcasecmp(str, "fullscreenForced")) { } else if (!strcasecmp(str, "fullscreenForced")) {
*variable = LAB_TEARING_FULLSCREEN_FORCED; *variable = LAB_TEARING_FULLSCREEN_FORCED;
} else if (!strcasecmp(str, "always")) {
*variable = LAB_TEARING_ALWAYS;
} else if (parse_bool(str, -1) == 1) { } else if (parse_bool(str, -1) == 1) {
*variable = LAB_TEARING_ENABLED; *variable = LAB_TEARING_ENABLED;
} else { } else {
@ -1447,7 +1449,7 @@ rcxml_init(void)
rc.gap = 0; rc.gap = 0;
rc.adaptive_sync = LAB_ADAPTIVE_SYNC_DISABLED; rc.adaptive_sync = LAB_ADAPTIVE_SYNC_DISABLED;
rc.allow_tearing = false; rc.allow_tearing = LAB_TEARING_DISABLED;
rc.reuse_output_mode = false; rc.reuse_output_mode = false;
rc.xwayland_persistence = false; rc.xwayland_persistence = false;

View file

@ -50,7 +50,7 @@ output_get_tearing_allowance(struct output *output)
} }
/* allow tearing for any window when requested or forced */ /* allow tearing for any window when requested or forced */
if (rc.allow_tearing == LAB_TEARING_ENABLED) { if (rc.allow_tearing == LAB_TEARING_ENABLED || rc.allow_tearing == LAB_TEARING_ALWAYS) {
if (view->force_tearing == LAB_STATE_UNSPECIFIED) { if (view->force_tearing == LAB_STATE_UNSPECIFIED) {
return view->tearing_hint; return view->tearing_hint;
} else { } else {

View file

@ -2474,6 +2474,10 @@ view_init(struct view *view)
wl_signal_init(&view->events.minimized); wl_signal_init(&view->events.minimized);
wl_signal_init(&view->events.fullscreened); wl_signal_init(&view->events.fullscreened);
wl_signal_init(&view->events.activated); wl_signal_init(&view->events.activated);
if (rc.allow_tearing == LAB_TEARING_ALWAYS) {
view->force_tearing = LAB_STATE_ENABLED;
}
} }
void void