mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	fix crash when changing TTY
also add an assertion to clarify the contract of `output_by_name`
This commit is contained in:
		
							parent
							
								
									4c3bae0794
								
							
						
					
					
						commit
						401b282772
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -128,6 +128,7 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
 | 
				
			||||||
static struct wlr_output *
 | 
					static struct wlr_output *
 | 
				
			||||||
output_by_name(struct server *server, const char *name)
 | 
					output_by_name(struct server *server, const char *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						assert(name != NULL);
 | 
				
			||||||
	struct output *output;
 | 
						struct output *output;
 | 
				
			||||||
	wl_list_for_each(output, &server->outputs, link) {
 | 
						wl_list_for_each(output, &server->outputs, link) {
 | 
				
			||||||
		if (!strcasecmp(output->wlr_output->name, name)) {
 | 
							if (!strcasecmp(output->wlr_output->name, name)) {
 | 
				
			||||||
| 
						 | 
					@ -150,8 +151,10 @@ new_pointer(struct seat *seat, struct input *input)
 | 
				
			||||||
	if (dev->type == WLR_INPUT_DEVICE_POINTER) {
 | 
						if (dev->type == WLR_INPUT_DEVICE_POINTER) {
 | 
				
			||||||
		wlr_log(WLR_INFO, "map pointer to output %s\n",
 | 
							wlr_log(WLR_INFO, "map pointer to output %s\n",
 | 
				
			||||||
			dev->pointer->output_name);
 | 
								dev->pointer->output_name);
 | 
				
			||||||
		struct wlr_output *output =
 | 
							struct wlr_output *output = NULL;
 | 
				
			||||||
			output_by_name(seat->server, dev->pointer->output_name);
 | 
							if (dev->pointer->output_name != NULL) {
 | 
				
			||||||
 | 
								output = output_by_name(seat->server, dev->pointer->output_name);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		wlr_cursor_map_input_to_output(seat->cursor, dev, output);
 | 
							wlr_cursor_map_input_to_output(seat->cursor, dev, output);
 | 
				
			||||||
		wlr_cursor_map_input_to_region(seat->cursor, dev, NULL);
 | 
							wlr_cursor_map_input_to_region(seat->cursor, dev, NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue