mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
seat/keyboard: optimize wlr_seat_set_keyboard to send the keymap only if it has changed
This commit is contained in:
parent
9c9bf2efee
commit
1e7baefe96
1 changed files with 8 additions and 1 deletions
|
|
@ -122,6 +122,11 @@ void wlr_seat_set_keyboard(struct wlr_seat *seat,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// send the keymap only if it has changed
|
||||||
|
bool needs_keymap_update =
|
||||||
|
!seat->keyboard_state.keyboard || !keyboard ||
|
||||||
|
seat->keyboard_state.keyboard->keymap != keyboard->keymap;
|
||||||
|
|
||||||
if (seat->keyboard_state.keyboard) {
|
if (seat->keyboard_state.keyboard) {
|
||||||
wl_list_remove(&seat->keyboard_state.keyboard_destroy.link);
|
wl_list_remove(&seat->keyboard_state.keyboard_destroy.link);
|
||||||
wl_list_remove(&seat->keyboard_state.keyboard_keymap.link);
|
wl_list_remove(&seat->keyboard_state.keyboard_keymap.link);
|
||||||
|
|
@ -145,7 +150,9 @@ void wlr_seat_set_keyboard(struct wlr_seat *seat,
|
||||||
|
|
||||||
struct wlr_seat_client *client;
|
struct wlr_seat_client *client;
|
||||||
wl_list_for_each(client, &seat->clients, link) {
|
wl_list_for_each(client, &seat->clients, link) {
|
||||||
seat_client_send_keymap(client, keyboard);
|
if (needs_keymap_update) {
|
||||||
|
seat_client_send_keymap(client, keyboard);
|
||||||
|
}
|
||||||
seat_client_send_repeat_info(client, keyboard);
|
seat_client_send_repeat_info(client, keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue