mirror of
https://github.com/gwenhael-le-moine/sway-patched-tray-menu.git
synced 2025-01-13 08:01:20 +01:00
9a1c411abd
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3871 Adds option to allow tearing per output, as well as an option to force enable or disable tearing for a specific application using a window rule. Only works with fullscreen applications.
24 lines
713 B
C
24 lines
713 B
C
#include <sway/commands.h>
|
|
#include "sway/config.h"
|
|
#include "sway/tree/view.h"
|
|
#include "util.h"
|
|
|
|
struct cmd_results *cmd_allow_tearing(int argc, char **argv) {
|
|
struct cmd_results *error = NULL;
|
|
if ((error = checkarg(argc, "allow_tearing", EXPECTED_AT_LEAST, 1))) {
|
|
return error;
|
|
}
|
|
|
|
struct sway_container *container = config->handler_context.container;
|
|
if (!container || !container->view) {
|
|
return cmd_results_new(CMD_INVALID, "Tearing can only be allowed on views");
|
|
}
|
|
|
|
bool wants_tearing = parse_boolean(argv[0], true);
|
|
|
|
struct sway_view *view = container->view;
|
|
view->tearing_mode = wants_tearing ? TEARING_OVERRIDE_TRUE :
|
|
TEARING_OVERRIDE_FALSE;
|
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
|
}
|