mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 16:36:26 +01:00
Merge branch 'master' into fullscreen
This commit is contained in:
commit
21eb63cc9e
10 changed files with 94 additions and 1 deletions
|
@ -196,6 +196,8 @@ sway_cmd input_cmd_map_to_output;
|
|||
sway_cmd input_cmd_middle_emulation;
|
||||
sway_cmd input_cmd_natural_scroll;
|
||||
sway_cmd input_cmd_pointer_accel;
|
||||
sway_cmd input_cmd_repeat_delay;
|
||||
sway_cmd input_cmd_repeat_rate;
|
||||
sway_cmd input_cmd_scroll_method;
|
||||
sway_cmd input_cmd_tap;
|
||||
sway_cmd input_cmd_xkb_layout;
|
||||
|
|
|
@ -65,6 +65,8 @@ struct input_config {
|
|||
int middle_emulation;
|
||||
int natural_scroll;
|
||||
float pointer_accel;
|
||||
int repeat_delay;
|
||||
int repeat_rate;
|
||||
int scroll_method;
|
||||
int send_events;
|
||||
int tap;
|
||||
|
|
|
@ -192,6 +192,8 @@ static struct cmd_handler input_handlers[] = {
|
|||
{ "middle_emulation", input_cmd_middle_emulation },
|
||||
{ "natural_scroll", input_cmd_natural_scroll },
|
||||
{ "pointer_accel", input_cmd_pointer_accel },
|
||||
{ "repeat_delay", input_cmd_repeat_delay },
|
||||
{ "repeat_rate", input_cmd_repeat_rate },
|
||||
{ "scroll_method", input_cmd_scroll_method },
|
||||
{ "tap", input_cmd_tap },
|
||||
{ "xkb_layout", input_cmd_xkb_layout },
|
||||
|
|
|
@ -55,6 +55,10 @@ struct cmd_results *cmd_input(int argc, char **argv) {
|
|||
res = input_cmd_natural_scroll(argc_new, argv_new);
|
||||
} else if (strcasecmp("pointer_accel", argv[1]) == 0) {
|
||||
res = input_cmd_pointer_accel(argc_new, argv_new);
|
||||
} else if (strcasecmp("repeat_delay", argv[1]) == 0) {
|
||||
res = input_cmd_repeat_delay(argc_new, argv_new);
|
||||
} else if (strcasecmp("repeat_rate", argv[1]) == 0) {
|
||||
res = input_cmd_repeat_rate(argc_new, argv_new);
|
||||
} else if (strcasecmp("scroll_method", argv[1]) == 0) {
|
||||
res = input_cmd_scroll_method(argc_new, argv_new);
|
||||
} else if (strcasecmp("tap", argv[1]) == 0) {
|
||||
|
|
30
sway/commands/input/repeat_delay.c
Normal file
30
sway/commands/input/repeat_delay.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "sway/config.h"
|
||||
#include "sway/commands.h"
|
||||
#include "sway/input/input-manager.h"
|
||||
|
||||
struct cmd_results *input_cmd_repeat_delay(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "repeat_delay", EXPECTED_EQUAL_TO, 1))) {
|
||||
return error;
|
||||
}
|
||||
struct input_config *current_input_config =
|
||||
config->handler_context.input_config;
|
||||
if (!current_input_config) {
|
||||
return cmd_results_new(CMD_FAILURE,
|
||||
"repeat_delay", "No input device defined.");
|
||||
}
|
||||
struct input_config *new_config =
|
||||
new_input_config(current_input_config->identifier);
|
||||
|
||||
int repeat_delay = atoi(argv[0]);
|
||||
if (repeat_delay < 0) {
|
||||
return cmd_results_new(CMD_INVALID, "repeat_delay",
|
||||
"Repeat delay cannot be negative");
|
||||
}
|
||||
new_config->repeat_delay = repeat_delay;
|
||||
|
||||
apply_input_config(new_config);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
30
sway/commands/input/repeat_rate.c
Normal file
30
sway/commands/input/repeat_rate.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "sway/config.h"
|
||||
#include "sway/commands.h"
|
||||
#include "sway/input/input-manager.h"
|
||||
|
||||
struct cmd_results *input_cmd_repeat_rate(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "repeat_rate", EXPECTED_EQUAL_TO, 1))) {
|
||||
return error;
|
||||
}
|
||||
struct input_config *current_input_config =
|
||||
config->handler_context.input_config;
|
||||
if (!current_input_config) {
|
||||
return cmd_results_new(CMD_FAILURE,
|
||||
"repeat_rate", "No input device defined.");
|
||||
}
|
||||
struct input_config *new_config =
|
||||
new_input_config(current_input_config->identifier);
|
||||
|
||||
int repeat_rate = atoi(argv[0]);
|
||||
if (repeat_rate < 0) {
|
||||
return cmd_results_new(CMD_INVALID, "repeat_rate",
|
||||
"Repeat rate cannot be negative");
|
||||
}
|
||||
new_config->repeat_rate = repeat_rate;
|
||||
|
||||
apply_input_config(new_config);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
|
@ -29,6 +29,8 @@ struct input_config *new_input_config(const char* identifier) {
|
|||
input->pointer_accel = FLT_MIN;
|
||||
input->scroll_method = INT_MIN;
|
||||
input->left_handed = INT_MIN;
|
||||
input->repeat_delay = INT_MIN;
|
||||
input->repeat_rate = INT_MIN;
|
||||
|
||||
return input;
|
||||
}
|
||||
|
@ -59,6 +61,12 @@ void merge_input_config(struct input_config *dst, struct input_config *src) {
|
|||
if (src->pointer_accel != FLT_MIN) {
|
||||
dst->pointer_accel = src->pointer_accel;
|
||||
}
|
||||
if (src->repeat_delay != INT_MIN) {
|
||||
dst->repeat_delay = src->repeat_delay;
|
||||
}
|
||||
if (src->repeat_rate != INT_MIN) {
|
||||
dst->repeat_rate = src->repeat_rate;
|
||||
}
|
||||
if (src->scroll_method != INT_MIN) {
|
||||
dst->scroll_method = src->scroll_method;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <wlr/backend/multi.h>
|
||||
#include <wlr/backend/session.h>
|
||||
#include "sway/input/seat.h"
|
||||
|
@ -479,7 +480,13 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) {
|
|||
keyboard->keymap = keymap;
|
||||
wlr_keyboard_set_keymap(wlr_device->keyboard, keyboard->keymap);
|
||||
|
||||
wlr_keyboard_set_repeat_info(wlr_device->keyboard, 25, 600);
|
||||
if (input_config && input_config->repeat_delay != INT_MIN
|
||||
&& input_config->repeat_rate != INT_MIN) {
|
||||
wlr_keyboard_set_repeat_info(wlr_device->keyboard,
|
||||
input_config->repeat_rate, input_config->repeat_delay);
|
||||
} else {
|
||||
wlr_keyboard_set_repeat_info(wlr_device->keyboard, 25, 600);
|
||||
}
|
||||
xkb_context_unref(context);
|
||||
struct wlr_seat *seat = keyboard->seat_device->sway_seat->wlr_seat;
|
||||
wlr_seat_set_keyboard(seat, wlr_device);
|
||||
|
|
|
@ -91,6 +91,8 @@ sway_sources = files(
|
|||
'commands/input/middle_emulation.c',
|
||||
'commands/input/natural_scroll.c',
|
||||
'commands/input/pointer_accel.c',
|
||||
'commands/input/repeat_delay.c',
|
||||
'commands/input/repeat_rate.c',
|
||||
'commands/input/scroll_method.c',
|
||||
'commands/input/tap.c',
|
||||
'commands/input/xkb_layout.c',
|
||||
|
|
|
@ -92,6 +92,12 @@ Libinput Configuration
|
|||
**input** <identifier> pointer_accel <[-1,1]>::
|
||||
Changes the pointer acceleration for the specified input device.
|
||||
|
||||
**input** <identifier> repeat_delay <milliseconds>::
|
||||
Sets the amount of time a key must be held before it starts repeating.
|
||||
|
||||
**input** <identifier> repeat_rate <characters per second>::
|
||||
Sets the frequency of key repeats once the repeat_delay has passed.
|
||||
|
||||
**input** <identifier> scroll_method <none|two_finger|edge|on_button_down>::
|
||||
Changes the scroll method for the specified input device.
|
||||
|
||||
|
|
Loading…
Reference in a new issue