mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	interfaces/wlr_input_device: introduce wlr_input_device_finish
This function releases the wlr_input_device allocated memory (it's name and it's output name), and signals its destroy event.
This commit is contained in:
		
							parent
							
								
									71577e351e
								
							
						
					
					
						commit
						fd80329c53
					
				
					 2 changed files with 18 additions and 0 deletions
				
			
		| 
						 | 
					@ -18,6 +18,13 @@ struct wlr_input_device_impl {
 | 
				
			||||||
void wlr_input_device_init(struct wlr_input_device *wlr_device,
 | 
					void wlr_input_device_init(struct wlr_input_device *wlr_device,
 | 
				
			||||||
	enum wlr_input_device_type type, const struct wlr_input_device_impl *impl,
 | 
						enum wlr_input_device_type type, const struct wlr_input_device_impl *impl,
 | 
				
			||||||
	const char *name);
 | 
						const char *name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Cleans up all of the provided wlr_input_device resources and signals the
 | 
				
			||||||
 | 
					 * destroy event.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void wlr_input_device_finish(struct wlr_input_device *wlr_device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_input_device_destroy(struct wlr_input_device *dev);
 | 
					void wlr_input_device_destroy(struct wlr_input_device *dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,6 +25,17 @@ void wlr_input_device_init(struct wlr_input_device *dev,
 | 
				
			||||||
	wl_signal_init(&dev->events.destroy);
 | 
						wl_signal_init(&dev->events.destroy);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void wlr_input_device_finish(struct wlr_input_device *wlr_device) {
 | 
				
			||||||
 | 
						if (!wlr_device) {
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						wlr_signal_emit_safe(&wlr_device->events.destroy, wlr_device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						free(wlr_device->name);
 | 
				
			||||||
 | 
						free(wlr_device->output_name);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_input_device_destroy(struct wlr_input_device *dev) {
 | 
					void wlr_input_device_destroy(struct wlr_input_device *dev) {
 | 
				
			||||||
	if (!dev) {
 | 
						if (!dev) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue