mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	backend/headless: remove useless destructor
This commit is contained in:
		
							parent
							
								
									57c36ddcb3
								
							
						
					
					
						commit
						79da4c175e
					
				
					 4 changed files with 11 additions and 22 deletions
				
			
		| 
						 | 
					@ -9,15 +9,7 @@
 | 
				
			||||||
#include "backend/headless.h"
 | 
					#include "backend/headless.h"
 | 
				
			||||||
#include "util/signal.h"
 | 
					#include "util/signal.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void input_device_destroy(struct wlr_input_device *wlr_dev) {
 | 
					static const struct wlr_input_device_impl input_device_impl = { 0 };
 | 
				
			||||||
	struct wlr_headless_input_device *device =
 | 
					 | 
				
			||||||
		(struct wlr_headless_input_device *)wlr_dev;
 | 
					 | 
				
			||||||
	free(device);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static const struct wlr_input_device_impl input_device_impl = {
 | 
					 | 
				
			||||||
	.destroy = input_device_destroy,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_input_device_is_headless(struct wlr_input_device *wlr_dev) {
 | 
					bool wlr_input_device_is_headless(struct wlr_input_device *wlr_dev) {
 | 
				
			||||||
	return wlr_dev->impl == &input_device_impl;
 | 
						return wlr_dev->impl == &input_device_impl;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,7 +13,8 @@ struct wlr_libinput_keyboard {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void keyboard_set_leds(struct wlr_keyboard *wlr_kb, uint32_t leds) {
 | 
					static void keyboard_set_leds(struct wlr_keyboard *wlr_kb, uint32_t leds) {
 | 
				
			||||||
	struct wlr_libinput_keyboard *wlr_libinput_kb = (struct wlr_libinput_keyboard *)wlr_kb;
 | 
						struct wlr_libinput_keyboard *wlr_libinput_kb =
 | 
				
			||||||
 | 
							(struct wlr_libinput_keyboard *)wlr_kb;
 | 
				
			||||||
	libinput_device_led_update(wlr_libinput_kb->libinput_dev, leds);
 | 
						libinput_device_led_update(wlr_libinput_kb->libinput_dev, leds);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,6 +22,7 @@ static void keyboard_destroy(struct wlr_keyboard *wlr_kb) {
 | 
				
			||||||
	struct wlr_libinput_keyboard *wlr_libinput_kb =
 | 
						struct wlr_libinput_keyboard *wlr_libinput_kb =
 | 
				
			||||||
		(struct wlr_libinput_keyboard *)wlr_kb;
 | 
							(struct wlr_libinput_keyboard *)wlr_kb;
 | 
				
			||||||
	libinput_device_unref(wlr_libinput_kb->libinput_dev);
 | 
						libinput_device_unref(wlr_libinput_kb->libinput_dev);
 | 
				
			||||||
 | 
						free(wlr_libinput_kb);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_keyboard_impl impl = {
 | 
					struct wlr_keyboard_impl impl = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -223,14 +223,9 @@ static void backend_destroy(struct wlr_backend *backend) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_signal_emit_safe(&x11->pointer_dev.events.destroy, &x11->pointer_dev);
 | 
						wlr_signal_emit_safe(&x11->pointer_dev.events.destroy, &x11->pointer_dev);
 | 
				
			||||||
	wlr_signal_emit_safe(&x11->keyboard_dev.events.destroy, &x11->keyboard_dev);
 | 
						wlr_signal_emit_safe(&x11->keyboard_dev.events.destroy, &x11->keyboard_dev);
 | 
				
			||||||
	// TODO probably need to use wlr_keyboard_destroy, but the devices need to
 | 
					
 | 
				
			||||||
	// be malloced for that to work
 | 
						wlr_input_device_destroy(&x11->keyboard_dev);
 | 
				
			||||||
	if (x11->keyboard_dev.keyboard->keymap) {
 | 
						wlr_input_device_destroy(&x11->pointer_dev);
 | 
				
			||||||
		xkb_keymap_unref(x11->keyboard_dev.keyboard->keymap);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if (x11->keyboard_dev.keyboard->xkb_state) {
 | 
					 | 
				
			||||||
		xkb_state_unref(x11->keyboard_dev.keyboard->xkb_state);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wlr_signal_emit_safe(&backend->events.destroy, backend);
 | 
						wlr_signal_emit_safe(&backend->events.destroy, backend);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -154,15 +154,15 @@ void wlr_keyboard_destroy(struct wlr_keyboard *kb) {
 | 
				
			||||||
	if (kb == NULL) {
 | 
						if (kb == NULL) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						xkb_state_unref(kb->xkb_state);
 | 
				
			||||||
 | 
						xkb_keymap_unref(kb->keymap);
 | 
				
			||||||
 | 
						close(kb->keymap_fd);
 | 
				
			||||||
	if (kb->impl && kb->impl->destroy) {
 | 
						if (kb->impl && kb->impl->destroy) {
 | 
				
			||||||
		kb->impl->destroy(kb);
 | 
							kb->impl->destroy(kb);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		wl_list_remove(&kb->events.key.listener_list);
 | 
							wl_list_remove(&kb->events.key.listener_list);
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	xkb_state_unref(kb->xkb_state);
 | 
					 | 
				
			||||||
	xkb_keymap_unref(kb->keymap);
 | 
					 | 
				
			||||||
	close(kb->keymap_fd);
 | 
					 | 
				
			||||||
		free(kb);
 | 
							free(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) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue