Merge branch 'swaywm:master' into sensitivity

This commit is contained in:
jlo62 2023-11-21 08:22:19 +01:00 committed by GitHub
commit 92df8b03df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 12 deletions

View file

@ -45,7 +45,7 @@ void input_manager_configure_xcursor(void);
void input_manager_apply_input_config(struct input_config *input_config);
void input_manager_configure_all_inputs(void);
void input_manager_configure_all_input_mappings(void);
void input_manager_reset_input(struct sway_input_device *input_device);

View file

@ -168,6 +168,9 @@ void seat_add_device(struct sway_seat *seat,
void seat_configure_device(struct sway_seat *seat,
struct sway_input_device *device);
void seat_configure_device_mapping(struct sway_seat *seat,
struct sway_input_device *input_device);
void seat_reset_device(struct sway_seat *seat,
struct sway_input_device *input_device);

View file

@ -590,7 +590,7 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
// Reconfigure all devices, since input config may have been applied before
// this output came online, and some config items (like map_to_output) are
// dependent on an output being present.
input_manager_configure_all_inputs();
input_manager_configure_all_input_mappings();
// Reconfigure the cursor images, since the scale may have changed.
input_manager_configure_xcursor();
return true;

View file

@ -564,10 +564,13 @@ static void input_manager_configure_input(
}
}
void input_manager_configure_all_inputs(void) {
struct sway_input_device *input_device = NULL;
void input_manager_configure_all_input_mappings(void) {
struct sway_input_device *input_device;
wl_list_for_each(input_device, &server.input->devices, link) {
input_manager_configure_input(input_device);
struct sway_seat *seat;
wl_list_for_each(seat, &server.input->seats, link) {
seat_configure_device_mapping(seat, input_device);
}
}
}

View file

@ -705,12 +705,21 @@ static bool is_touch_or_tablet_tool(struct sway_seat_device *seat_device) {
}
}
static void seat_apply_input_config(struct sway_seat *seat,
static void seat_apply_input_mapping(struct sway_seat *seat,
struct sway_seat_device *sway_device) {
struct input_config *ic =
input_device_get_config(sway_device->input_device);
sway_log(SWAY_DEBUG, "Applying input config to %s",
switch (sway_device->input_device->wlr_device->type) {
case WLR_INPUT_DEVICE_POINTER:
case WLR_INPUT_DEVICE_TOUCH:
case WLR_INPUT_DEVICE_TABLET_TOOL:
break;
default:
return; // these devices don't support mappings
}
sway_log(SWAY_DEBUG, "Applying input mapping to %s",
sway_device->input_device->identifier);
const char *mapped_to_output = ic == NULL ? NULL : ic->mapped_to_output;
@ -799,7 +808,6 @@ static void seat_configure_pointer(struct sway_seat *seat,
}
wlr_cursor_attach_input_device(seat->cursor->cursor,
sway_device->input_device->wlr_device);
seat_apply_input_config(seat, sway_device);
wl_event_source_timer_update(
seat->cursor->hide_source, cursor_get_timeout(seat->cursor));
}
@ -834,7 +842,6 @@ static void seat_configure_switch(struct sway_seat *seat,
if (!seat_device->switch_device) {
sway_switch_create(seat, seat_device);
}
seat_apply_input_config(seat, seat_device);
sway_switch_configure(seat_device->switch_device);
}
@ -842,7 +849,6 @@ static void seat_configure_touch(struct sway_seat *seat,
struct sway_seat_device *sway_device) {
wlr_cursor_attach_input_device(seat->cursor->cursor,
sway_device->input_device->wlr_device);
seat_apply_input_config(seat, sway_device);
}
static void seat_configure_tablet_tool(struct sway_seat *seat,
@ -853,7 +859,6 @@ static void seat_configure_tablet_tool(struct sway_seat *seat,
sway_configure_tablet(sway_device->tablet);
wlr_cursor_attach_input_device(seat->cursor->cursor,
sway_device->input_device->wlr_device);
seat_apply_input_config(seat, sway_device);
}
static void seat_configure_tablet_pad(struct sway_seat *seat,
@ -910,6 +915,18 @@ void seat_configure_device(struct sway_seat *seat,
seat_configure_tablet_pad(seat, seat_device);
break;
}
seat_apply_input_mapping(seat, seat_device);
}
void seat_configure_device_mapping(struct sway_seat *seat,
struct sway_input_device *input_device) {
struct sway_seat_device *seat_device = seat_get_device(seat, input_device);
if (!seat_device) {
return;
}
seat_apply_input_mapping(seat, seat_device);
}
void seat_reset_device(struct sway_seat *seat,

View file

@ -277,7 +277,7 @@ void output_disable(struct sway_output *output) {
// Reconfigure all devices, since devices with map_to_output directives for
// an output that goes offline should stop sending events as long as the
// output remains offline.
input_manager_configure_all_inputs();
input_manager_configure_all_input_mappings();
}
void output_begin_destroy(struct sway_output *output) {