mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	keyboard: only update LEDs when changed
This commit is contained in:
		
							parent
							
								
									caaea01bf6
								
							
						
					
					
						commit
						7f6d646e0a
					
				
					 2 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
					@ -62,6 +62,7 @@ struct wlr_keyboard {
 | 
				
			||||||
	xkb_led_index_t led_indexes[WLR_LED_COUNT];
 | 
						xkb_led_index_t led_indexes[WLR_LED_COUNT];
 | 
				
			||||||
	xkb_mod_index_t mod_indexes[WLR_MODIFIER_COUNT];
 | 
						xkb_mod_index_t mod_indexes[WLR_MODIFIER_COUNT];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						uint32_t leds;
 | 
				
			||||||
	uint32_t keycodes[WLR_KEYBOARD_KEYS_CAP];
 | 
						uint32_t keycodes[WLR_KEYBOARD_KEYS_CAP];
 | 
				
			||||||
	size_t num_keycodes;
 | 
						size_t num_keycodes;
 | 
				
			||||||
	struct wlr_keyboard_modifiers modifiers;
 | 
						struct wlr_keyboard_modifiers modifiers;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -163,6 +163,12 @@ void wlr_keyboard_finish(struct wlr_keyboard *kb) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_keyboard_led_update(struct wlr_keyboard *kb, uint32_t leds) {
 | 
					void wlr_keyboard_led_update(struct wlr_keyboard *kb, uint32_t leds) {
 | 
				
			||||||
 | 
						if (kb->leds == leds) {
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						kb->leds = leds;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (kb->impl && kb->impl->led_update) {
 | 
						if (kb->impl && kb->impl->led_update) {
 | 
				
			||||||
		kb->impl->led_update(kb, leds);
 | 
							kb->impl->led_update(kb, leds);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue