aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/commands/input.c1
-rw-r--r--sway/commands/input/tap_button_map.c33
-rw-r--r--sway/config/input.c4
-rw-r--r--sway/desktop/render.c4
-rw-r--r--sway/desktop/transaction.c16
-rw-r--r--sway/input/input-manager.c6
-rw-r--r--sway/main.c16
-rw-r--r--sway/meson.build1
-rw-r--r--sway/server.c2
-rw-r--r--sway/sway-input.5.scd6
10 files changed, 76 insertions, 13 deletions
diff --git a/sway/commands/input.c b/sway/commands/input.c
index e7906b0e..5b203ea0 100644
--- a/sway/commands/input.c
+++ b/sway/commands/input.c
@@ -23,6 +23,7 @@ static struct cmd_handler input_handlers[] = {
{ "scroll_button", input_cmd_scroll_button },
{ "scroll_method", input_cmd_scroll_method },
{ "tap", input_cmd_tap },
+ { "tap_button_map", input_cmd_tap_button_map },
{ "xkb_layout", input_cmd_xkb_layout },
{ "xkb_model", input_cmd_xkb_model },
{ "xkb_options", input_cmd_xkb_options },
diff --git a/sway/commands/input/tap_button_map.c b/sway/commands/input/tap_button_map.c
new file mode 100644
index 00000000..bdbba472
--- /dev/null
+++ b/sway/commands/input/tap_button_map.c
@@ -0,0 +1,33 @@
+#include <string.h>
+#include <strings.h>
+#include "sway/config.h"
+#include "sway/commands.h"
+#include "sway/input/input-manager.h"
+
+struct cmd_results *input_cmd_tap_button_map(int argc, char **argv) {
+ struct cmd_results *error = NULL;
+ if ((error = checkarg(argc, "tap_button_map", EXPECTED_AT_LEAST, 1))) {
+ return error;
+ }
+ struct input_config *current_input_config =
+ config->handler_context.input_config;
+ if (!current_input_config) {
+ return cmd_results_new(CMD_FAILURE, "tap_button_map",
+ "No input device defined.");
+ }
+ struct input_config *new_config =
+ new_input_config(current_input_config->identifier);
+
+ if (strcasecmp(argv[0], "lrm") == 0) {
+ new_config->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
+ } else if (strcasecmp(argv[0], "lmr") == 0) {
+ new_config->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LMR;
+ } else {
+ free_input_config(new_config);
+ return cmd_results_new(CMD_INVALID, "tap_button_map",
+ "Expected 'tap_button_map <lrm|lmr>'");
+ }
+
+ apply_input_config(new_config);
+ return cmd_results_new(CMD_SUCCESS, NULL, NULL);
+}
diff --git a/sway/config/input.c b/sway/config/input.c
index cbd7d5f0..8d687a6d 100644
--- a/sway/config/input.c
+++ b/sway/config/input.c
@@ -19,6 +19,7 @@ struct input_config *new_input_config(const char* identifier) {
}
input->tap = INT_MIN;
+ input->tap_button_map = INT_MIN;
input->drag_lock = INT_MIN;
input->dwt = INT_MIN;
input->send_events = INT_MIN;
@@ -80,6 +81,9 @@ void merge_input_config(struct input_config *dst, struct input_config *src) {
if (src->tap != INT_MIN) {
dst->tap = src->tap;
}
+ if (src->tap_button_map != INT_MIN) {
+ dst->tap_button_map = src->tap_button_map;
+ }
if (src->xkb_layout) {
free(dst->xkb_layout);
dst->xkb_layout = strdup(src->xkb_layout);
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index b370f8a2..4bfc573b 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -15,6 +15,7 @@
#include <wlr/util/region.h>
#include "log.h"
#include "sway/config.h"
+#include "sway/debug.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
#include "sway/layers.h"
@@ -786,6 +787,8 @@ static void render_floating(struct sway_output *soutput,
}
}
+const char *damage_debug = NULL;
+
void output_render(struct sway_output *output, struct timespec *when,
pixman_region32_t *damage) {
struct wlr_output *wlr_output = output->wlr_output;
@@ -805,7 +808,6 @@ void output_render(struct sway_output *output, struct timespec *when,
goto renderer_end;
}
- const char *damage_debug = getenv("SWAY_DAMAGE_DEBUG");
if (damage_debug != NULL) {
if (strcmp(damage_debug, "highlight") == 0) {
wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1});
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index e8222b32..0ae042db 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -19,14 +19,14 @@
* How long we should wait for views to respond to the configure before giving
* up and applying the transaction anyway.
*/
-#define TIMEOUT_MS 200
+int txn_timeout_ms = 200;
/**
* If enabled, sway will always wait for the transaction timeout before
* applying it, rather than applying it when the views are ready. This allows us
* to observe the rendered state while a transaction is in progress.
*/
-#define TRANSACTION_DEBUG false
+bool txn_debug = false;
struct sway_transaction {
struct wl_event_source *timer;
@@ -315,7 +315,7 @@ static void transaction_commit(struct sway_transaction *transaction) {
// Set up a timer which the views must respond within
transaction->timer = wl_event_loop_add_timer(server.wl_event_loop,
handle_timeout, transaction);
- wl_event_source_timer_update(transaction->timer, TIMEOUT_MS);
+ wl_event_source_timer_update(transaction->timer, txn_timeout_ms);
}
// The debug tree shows the pending/live tree. Here is a good place to
@@ -346,11 +346,11 @@ static void set_instruction_ready(
// If all views are ready, apply the transaction.
// If the transaction has timed out then its num_waiting will be 0 already.
if (transaction->num_waiting > 0 && --transaction->num_waiting == 0) {
-#if !TRANSACTION_DEBUG
- wlr_log(WLR_DEBUG, "Transaction %p is ready", transaction);
- wl_event_source_timer_update(transaction->timer, 0);
- transaction_progress_queue();
-#endif
+ if (!txn_debug) {
+ wlr_log(WLR_DEBUG, "Transaction %p is ready", transaction);
+ wl_event_source_timer_update(transaction->timer, 0);
+ transaction_progress_queue();
+ }
}
}
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index b18989d0..0b7cb766 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -181,6 +181,12 @@ static void input_manager_libinput_config_pointer(
ic->identifier, ic->tap);
libinput_device_config_tap_set_enabled(libinput_device, ic->tap);
}
+ if (ic->tap_button_map != INT_MIN) {
+ wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) tap_set_button_map(%d)",
+ ic->identifier, ic->tap);
+ libinput_device_config_tap_set_button_map(libinput_device,
+ ic->tap_button_map);
+ }
}
static void handle_device_destroy(struct wl_listener *listener, void *data) {
diff --git a/sway/main.c b/sway/main.c
index c6453226..1d772b48 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -251,6 +251,18 @@ static void drop_permissions(bool keep_caps) {
#endif
}
+void enable_debug_flag(const char *flag) {
+ if (strcmp(flag, "render-tree") == 0) {
+ enable_debug_tree = true;
+ } else if (strncmp(flag, "damage=", 7) == 0) {
+ damage_debug = &flag[7];
+ } else if (strcmp(flag, "txn-debug") == 0) {
+ txn_debug = true;
+ } else if (strncmp(flag, "txn-timeout=", 12) == 0) {
+ txn_timeout_ms = atoi(&flag[12]);
+ }
+}
+
int main(int argc, char **argv) {
static int verbose = 0, debug = 0, validate = 0;
@@ -290,7 +302,7 @@ int main(int argc, char **argv) {
int c;
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "hCdDvVc:", long_options, &option_index);
+ c = getopt_long(argc, argv, "hCdD:vVc:", long_options, &option_index);
if (c == -1) {
break;
}
@@ -309,7 +321,7 @@ int main(int argc, char **argv) {
debug = 1;
break;
case 'D': // extended debug options
- enable_debug_tree = true;
+ enable_debug_flag(optarg);
break;
case 'v': // version
fprintf(stdout, "sway version " SWAY_VERSION "\n");
diff --git a/sway/meson.build b/sway/meson.build
index 6fc78db3..f878450d 100644
--- a/sway/meson.build
+++ b/sway/meson.build
@@ -121,6 +121,7 @@ sway_sources = files(
'commands/input/scroll_button.c',
'commands/input/scroll_method.c',
'commands/input/tap.c',
+ 'commands/input/tap_button_map.c',
'commands/input/xkb_layout.c',
'commands/input/xkb_model.c',
'commands/input/xkb_options.c',
diff --git a/sway/server.c b/sway/server.c
index 8566d512..f904b177 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -14,7 +14,6 @@
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_primary_selection.h>
#include <wlr/types/wlr_screencopy_v1.h>
-#include <wlr/types/wlr_screenshooter.h>
#include <wlr/types/wlr_server_decoration.h>
#include <wlr/types/wlr_xcursor_manager.h>
#include <wlr/types/wlr_xdg_output.h>
@@ -53,7 +52,6 @@ bool server_init(struct sway_server *server) {
server->data_device_manager =
wlr_data_device_manager_create(server->wl_display);
- wlr_screenshooter_create(server->wl_display);
wlr_gamma_control_manager_create(server->wl_display);
wlr_primary_selection_device_manager_create(server->wl_display);
diff --git a/sway/sway-input.5.scd b/sway/sway-input.5.scd
index 4bc66394..b6391431 100644
--- a/sway/sway-input.5.scd
+++ b/sway/sway-input.5.scd
@@ -100,6 +100,12 @@ For more information on these xkb configuration options, see
*input* <identifier> tap enabled|disabled
Enables or disables tap for specified input device.
+*input* <identifier> tap_button_map lrm|lmr
+ Specifies which button mapping to use for tapping. _lrm_ treats 1 finger as
+ left click, 2 fingers as right click, and 3 fingers as middle click. _lmr_
+ treats 1 finger as left click, 2 fingers as middle click, and 3 fingers as
+ right click.
+
## SEAT CONFIGURATION
Configure options for multiseat mode. sway-seat commands must be used inside a