tearing control: change options to allow_tearing, add commit fallback

This commit is contained in:
Ricardo Steijn 2023-12-03 23:58:48 +01:00
parent b9d479a7ed
commit cce9b0a7f1
9 changed files with 28 additions and 28 deletions

View file

@ -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;
@ -184,7 +185,6 @@ sway_cmd cmd_sticky;
sway_cmd cmd_swaybg_command;
sway_cmd cmd_swaynag_command;
sway_cmd cmd_swap;
sway_cmd cmd_tearing_allowed;
sway_cmd cmd_tiling_drag;
sway_cmd cmd_tiling_drag_threshold;
sway_cmd cmd_title_align;
@ -284,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;
@ -298,7 +299,6 @@ sway_cmd output_cmd_render_bit_depth;
sway_cmd output_cmd_scale;
sway_cmd output_cmd_scale_filter;
sway_cmd output_cmd_subpixel;
sway_cmd output_cmd_tearing_allowed;
sway_cmd output_cmd_toggle;
sway_cmd output_cmd_transform;
sway_cmd output_cmd_unplug;

View file

@ -112,6 +112,7 @@ static const struct cmd_handler config_handlers[] = {
/* Runtime-only commands. Keep alphabetized */
static const struct cmd_handler command_handlers[] = {
{ "allow_tearing", cmd_allow_tearing },
{ "border", cmd_border },
{ "create_output", cmd_create_output },
{ "exit", cmd_exit },
@ -136,7 +137,6 @@ static const struct cmd_handler command_handlers[] = {
{ "splitv", cmd_splitv },
{ "sticky", cmd_sticky },
{ "swap", cmd_swap },
{ "tearing_allowed", cmd_tearing_allowed },
{ "title_format", cmd_title_format },
{ "unmark", cmd_unmark },
{ "urgent", cmd_urgent },

View file

@ -3,9 +3,9 @@
#include "sway/tree/view.h"
#include "util.h"
struct cmd_results *cmd_tearing_allowed(int argc, char **argv) {
struct cmd_results *cmd_allow_tearing(int argc, char **argv) {
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "tearing_allowed", EXPECTED_AT_LEAST, 1))) {
if ((error = checkarg(argc, "allow_tearing", EXPECTED_AT_LEAST, 1))) {
return error;
}

View file

@ -8,6 +8,7 @@
// must be in order for the bsearch
static const struct cmd_handler output_handlers[] = {
{ "adaptive_sync", output_cmd_adaptive_sync },
{ "allow_tearing", output_cmd_allow_tearing },
{ "background", output_cmd_background },
{ "bg", output_cmd_background },
{ "color_profile", output_cmd_color_profile },
@ -26,7 +27,6 @@ static const struct cmd_handler output_handlers[] = {
{ "scale", output_cmd_scale },
{ "scale_filter", output_cmd_scale_filter },
{ "subpixel", output_cmd_subpixel },
{ "tearing_allowed", output_cmd_tearing_allowed },
{ "toggle", output_cmd_toggle },
{ "transform", output_cmd_transform },
{ "unplug", output_cmd_unplug },

View file

@ -2,12 +2,12 @@
#include "sway/config.h"
#include "util.h"
struct cmd_results *output_cmd_tearing_allowed(int argc, char **argv) {
struct cmd_results *output_cmd_allow_tearing(int argc, char **argv) {
if (!config->handler_context.output_config) {
return cmd_results_new(CMD_FAILURE, "Missing output config");
}
if (argc == 0) {
return cmd_results_new(CMD_INVALID, "Missing tearing_allowed argument");
return cmd_results_new(CMD_INVALID, "Missing allow_tearing argument");
}
if (parse_boolean(argv[0], true)) {

View file

@ -580,7 +580,7 @@ static bool finalize_output_config(struct output_config *oc, struct sway_output
}
if (oc && oc->tearing_allowed >= 0) {
sway_log(SWAY_DEBUG, "Set %s tearing allowed to %d",
sway_log(SWAY_DEBUG, "Set %s allow tearing to %d",
oc->name, oc->tearing_allowed);
output->tearing_allowed = oc->tearing_allowed;
}

View file

@ -42,6 +42,7 @@ sway_sources = files(
'config/seat.c',
'config/input.c',
'commands/allow_tearing.c',
'commands/assign.c',
'commands/bar.c',
'commands/bind.c',
@ -111,7 +112,6 @@ sway_sources = files(
'commands/swaybg_command.c',
'commands/swaynag_command.c',
'commands/swap.c',
'commands/tearing_allowed.c',
'commands/tiling_drag.c',
'commands/tiling_drag_threshold.c',
'commands/title_align.c',
@ -190,6 +190,7 @@ sway_sources = files(
'commands/input/xkb_variant.c',
'commands/output/adaptive_sync.c',
'commands/output/allow_tearing.c',
'commands/output/background.c',
'commands/output/disable.c',
'commands/output/dpms.c',
@ -202,7 +203,6 @@ sway_sources = files(
'commands/output/scale.c',
'commands/output/scale_filter.c',
'commands/output/subpixel.c',
'commands/output/tearing_allowed.c',
'commands/output/toggle.c',
'commands/output/transform.c',
'commands/output/unplug.c',

View file

@ -190,7 +190,7 @@ must be separated by one space. For example:
may have no effect or produce unexpected output when used together with future
HDR support features.
*output* <name> tearing_allowed yes|no
*output* <name> allow_tearing yes|no
Allows or disallows screen tearing as a result of asynchronous page flips,
and an immediate presentation mode from a client.
@ -199,7 +199,7 @@ must be separated by one space. For example:
(VSync). This prevents stutter and reduces latency in games.
To adjust whether tearing is allowed for specific applications, see
*tearing_allowed* in *sway*(5).
*allow_tearing* in *sway*(5).
This setting only has effect on fullscreen windows.

View file

@ -215,6 +215,20 @@ set|plus|minus|toggle <amount>
effect on the output the window is currently on. See *sway-output*(5) for
further details.
*allow_tearing* yes|no
Allows or disallows screen tearing as a result of asynchronous page flips
for a fullscreen application.
When this option is not set, the tearing hints provided by the application
determine whether tearing is allowed. When _yes_ is specified,
the application allows tearing regardless of the tearing hints.
When _no_ is specified, tearing will never be allowed on the application,
regardless of the tearing hints.
This setting only has an effect if tearing is allowed on the output through
the per-output *allow_tearing* setting. See *sway-output*(5)
for further details.
*move* left|right|up|down [<px> px]
Moves the focused container in the direction specified. The optional _px_
argument specifies how many pixels to move the container. If unspecified,
@ -353,20 +367,6 @@ set|plus|minus|toggle <amount>
becomes fullscreen on the same workspace as the first container. In either
of those cases, the second container will gain focus.
*tearing_allowed* yes|no
Allows or disallows screen tearing as a result of asynchronous page flips
for a fullscreen application.
When this option is not set, the tearing hints provided by the application
determine whether tearing is allowed. When _yes_ is specified,
the application allows tearing regardless of the tearing hints.
When _no_ is specified, tearing will never be allowed on the application,
regardless of the tearing hints.
This setting only has an effect if tearing is allowed on the output through
the per-output *tearing_allowed* setting. See *sway-output*(5)
for further details.
*title_format* <format>
Sets the format of window titles. The following placeholders may be used: