mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
tearing: add fullscreen option
If set, labwc will try to automatically enable tearing for fullscreen applications. Fixes: #1557
This commit is contained in:
parent
7110b7cf3e
commit
db7f300554
5 changed files with 33 additions and 5 deletions
|
|
@ -157,6 +157,7 @@ Actions are used in menus and keyboard/mouse bindings.
|
||||||
|
|
||||||
*<action name="ToggleTearing" />*
|
*<action name="ToggleTearing" />*
|
||||||
Toggles tearing for the focused window.
|
Toggles tearing for the focused window.
|
||||||
|
Requires the config option 'allowTearing'.
|
||||||
|
|
||||||
*<action name="FocusOutput" output="HDMI-A-1" />*
|
*<action name="FocusOutput" output="HDMI-A-1" />*
|
||||||
Give focus to topmost window on given output and warp the cursor
|
Give focus to topmost window on given output and warp the cursor
|
||||||
|
|
|
||||||
|
|
@ -142,11 +142,14 @@ 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]
|
*<core><allowTearing>* [yes|no|fullscreen]
|
||||||
Allow tearing to reduce input lag. Default is no.
|
Allow tearing to reduce input lag. Default is no.
|
||||||
This option requires setting the environment variable
|
This option requires setting the environment variable
|
||||||
WLR_DRM_NO_ATOMIC=1.
|
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.
|
||||||
|
|
||||||
*<core><reuseOutputMode>* [yes|no]
|
*<core><reuseOutputMode>* [yes|no]
|
||||||
Try to re-use the existing output mode (resolution / refresh rate).
|
Try to re-use the existing output mode (resolution / refresh rate).
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,12 @@ enum adaptive_sync_mode {
|
||||||
LAB_ADAPTIVE_SYNC_FULLSCREEN,
|
LAB_ADAPTIVE_SYNC_FULLSCREEN,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum tearing_mode {
|
||||||
|
LAB_TEARING_DISABLED = 0,
|
||||||
|
LAB_TEARING_ENABLED,
|
||||||
|
LAB_TEARING_FULLSCREEN,
|
||||||
|
};
|
||||||
|
|
||||||
enum tiling_events_mode {
|
enum tiling_events_mode {
|
||||||
LAB_TILING_EVENTS_NEVER = 0,
|
LAB_TILING_EVENTS_NEVER = 0,
|
||||||
LAB_TILING_EVENTS_REGION = 1 << 0,
|
LAB_TILING_EVENTS_REGION = 1 << 0,
|
||||||
|
|
@ -65,7 +71,7 @@ struct rcxml {
|
||||||
bool xdg_shell_server_side_deco;
|
bool xdg_shell_server_side_deco;
|
||||||
int gap;
|
int gap;
|
||||||
enum adaptive_sync_mode adaptive_sync;
|
enum adaptive_sync_mode adaptive_sync;
|
||||||
bool allow_tearing;
|
enum tearing_mode allow_tearing;
|
||||||
bool reuse_output_mode;
|
bool reuse_output_mode;
|
||||||
enum view_placement_policy placement_policy;
|
enum view_placement_policy placement_policy;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
static void
|
||||||
entry(xmlNode *node, char *nodename, char *content)
|
entry(xmlNode *node, char *nodename, char *content)
|
||||||
{
|
{
|
||||||
|
|
@ -803,11 +815,11 @@ entry(xmlNode *node, char *nodename, char *content)
|
||||||
} else if (!strcasecmp(nodename, "adaptiveSync.core")) {
|
} else if (!strcasecmp(nodename, "adaptiveSync.core")) {
|
||||||
set_adaptive_sync_mode(content, &rc.adaptive_sync);
|
set_adaptive_sync_mode(content, &rc.adaptive_sync);
|
||||||
} else if (!strcasecmp(nodename, "allowTearing.core")) {
|
} else if (!strcasecmp(nodename, "allowTearing.core")) {
|
||||||
set_bool(content, &rc.allow_tearing);
|
set_tearing_mode(content, &rc.allow_tearing);
|
||||||
if (rc.allow_tearing) {
|
if (rc.allow_tearing) {
|
||||||
char *no_atomic_env = getenv("WLR_DRM_NO_ATOMIC");
|
char *no_atomic_env = getenv("WLR_DRM_NO_ATOMIC");
|
||||||
if (!no_atomic_env || strcmp(no_atomic_env, "1") != 0) {
|
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");
|
wlr_log(WLR_ERROR, "tearing requires WLR_DRM_NO_ATOMIC=1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,12 @@ get_tearing_preference(struct output *output)
|
||||||
return false;
|
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 */
|
/* If the active view requests tearing, or it is toggled on with action, allow it */
|
||||||
return server->active_view->tearing_hint;
|
return server->active_view->tearing_hint;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue