mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
remove always and fullscreen tearing options and add ToggleTearing action
This commit is contained in:
parent
8b7e953a25
commit
acbcf4f497
7 changed files with 26 additions and 54 deletions
|
|
@ -154,6 +154,9 @@ Actions are used in menus and keyboard/mouse bindings.
|
|||
the usual keybinds will function again until switching back to the
|
||||
original window. There can be multiple windows with this mode set.
|
||||
|
||||
*<action name="ToggleTearing" />*
|
||||
Toggles tearing for the focused window.
|
||||
|
||||
*<action name="FocusOutput" output="HDMI-A-1" />*
|
||||
Give focus to topmost window on given output and warp the cursor
|
||||
to the center of the window. If the given output does not contain
|
||||
|
|
|
|||
|
|
@ -129,16 +129,12 @@ this is for compatibility with Openbox.
|
|||
*fullscreen* enables adaptive sync whenever a window is in fullscreen
|
||||
mode.
|
||||
|
||||
*<core><allowTearing>* [yes|no|fullscreen|always]
|
||||
*<core><allowTearing>* [yes|no]
|
||||
Allow tearing to reduce input lag. Default is no.
|
||||
This open requires setting the environment variable WLR_DRM_NO_ATOMIC=1.
|
||||
This option requires setting the environment variable WLR_DRM_NO_ATOMIC=1.
|
||||
|
||||
*yes* allow tearing if the active window requests it.
|
||||
|
||||
*fullscreen* allow tearing if the active window requests it or is in
|
||||
fullscreen mode.
|
||||
|
||||
*always* allow tearing regardless of window status.
|
||||
*yes* allow tearing if the active window requests it,
|
||||
or its enabled with action ToggleTearing.
|
||||
|
||||
*<core><reuseOutputMode>* [yes|no]
|
||||
Try to re-use the existing output mode (resolution / refresh rate).
|
||||
|
|
|
|||
|
|
@ -34,13 +34,6 @@ enum adaptive_sync_mode {
|
|||
LAB_ADAPTIVE_SYNC_FULLSCREEN,
|
||||
};
|
||||
|
||||
enum tearing_mode {
|
||||
LAB_TEARING_DISABLED = 0,
|
||||
LAB_TEARING_ENABLED,
|
||||
LAB_TEARING_FULLSCREEN,
|
||||
LAB_TEARING_ALWAYS,
|
||||
};
|
||||
|
||||
struct usable_area_override {
|
||||
struct border margin;
|
||||
char *output;
|
||||
|
|
@ -60,7 +53,7 @@ struct rcxml {
|
|||
bool xdg_shell_server_side_deco;
|
||||
int gap;
|
||||
enum adaptive_sync_mode adaptive_sync;
|
||||
enum tearing_mode allow_tearing;
|
||||
bool allow_tearing;
|
||||
bool reuse_output_mode;
|
||||
enum view_placement_policy placement_policy;
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ enum action_type {
|
|||
ACTION_TYPE_VIRTUAL_OUTPUT_ADD,
|
||||
ACTION_TYPE_VIRTUAL_OUTPUT_REMOVE,
|
||||
ACTION_TYPE_AUTO_PLACE,
|
||||
ACTION_TYPE_TOGGLE_TEARING,
|
||||
};
|
||||
|
||||
const char *action_names[] = {
|
||||
|
|
@ -149,6 +150,7 @@ const char *action_names[] = {
|
|||
"VirtualOutputAdd",
|
||||
"VirtualOutputRemove",
|
||||
"AutoPlace",
|
||||
"ToggleTearing",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -951,6 +953,12 @@ actions_run(struct view *activator, struct server *server,
|
|||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_TOGGLE_TEARING:
|
||||
if (view) {
|
||||
view->tearing_hint = !view->tearing_hint;
|
||||
}
|
||||
wlr_log(WLR_DEBUG, "tearing: %d", view->tearing_hint);
|
||||
break;
|
||||
case ACTION_TYPE_INVALID:
|
||||
wlr_log(WLR_ERROR, "Not executing unknown action");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -625,28 +625,6 @@ 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 (!strcasecmp(str, "always")) {
|
||||
*variable = LAB_TEARING_ALWAYS;
|
||||
} else {
|
||||
int ret = parse_bool(str, -1);
|
||||
if (ret == 1) {
|
||||
*variable = LAB_TEARING_ENABLED;
|
||||
} else {
|
||||
*variable = LAB_TEARING_DISABLED;
|
||||
}
|
||||
}
|
||||
if (*variable != LAB_TEARING_DISABLED &&
|
||||
strcmp(getenv("WLR_DRM_NO_ATOMIC"), "1")) {
|
||||
*variable = LAB_TEARING_DISABLED;
|
||||
wlr_log(WLR_INFO, "WLR_DRM_NO_ATOMIC is not 1, tearing disabled");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
entry(xmlNode *node, char *nodename, char *content)
|
||||
{
|
||||
|
|
@ -750,7 +728,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_tearing_mode(content, &rc.allow_tearing);
|
||||
set_bool(content, &rc.allow_tearing);
|
||||
if (rc.allow_tearing && strcmp(getenv("WLR_DRM_NO_ATOMIC"), "1")) {
|
||||
rc.allow_tearing = false;
|
||||
wlr_log(WLR_INFO, "WLR_DRM_NO_ATOMIC is not 1, tearing disabled");
|
||||
}
|
||||
} else if (!strcasecmp(nodename, "reuseOutputMode.core")) {
|
||||
set_bool(content, &rc.reuse_output_mode);
|
||||
} else if (!strcmp(nodename, "policy.placement")) {
|
||||
|
|
|
|||
16
src/output.c
16
src/output.c
|
|
@ -33,31 +33,21 @@ get_tearing_preference(struct output *output)
|
|||
struct server *server = output->server;
|
||||
|
||||
/* Never allow tearing when disabled */
|
||||
if (rc.allow_tearing == LAB_TEARING_DISABLED) {
|
||||
if (!rc.allow_tearing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Allows allow tearing when forced */
|
||||
if (rc.allow_tearing == LAB_TEARING_ALWAYS) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Tearing is only allowed for the output with the active view */
|
||||
if (!server->active_view || server->active_view->output != output) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* If the active view requests tearing, allow it */
|
||||
/* If the active view requests tearing, or it
|
||||
has been requested with action, allow it */
|
||||
if (server->active_view->tearing_hint) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* If the active view is fullscreen, allow tearing if configured */
|
||||
if (rc.allow_tearing == LAB_TEARING_FULLSCREEN &&
|
||||
server->active_view->fullscreen) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ set_tearing_hint(struct wl_listener *listener, void *data)
|
|||
{
|
||||
struct tearing_controller *controller = wl_container_of(listener, controller, set_hint);
|
||||
struct view *view = view_from_wlr_surface(controller->tearing_control->surface);
|
||||
if (view) {
|
||||
view->tearing_hint = controller->tearing_control->hint;
|
||||
if (view && controller->tearing_control->hint) {
|
||||
view->tearing_hint = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue