mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	output: Schedule mode updates to happen with rest of output events
This commit is contained in:
		
							parent
							
								
									f042de3f51
								
							
						
					
					
						commit
						63351cf81f
					
				
					 1 changed files with 16 additions and 15 deletions
				
			
		| 
						 | 
					@ -314,18 +314,6 @@ static void output_apply_state(struct wlr_output *output,
 | 
				
			||||||
	bool geometry_updated = state->committed &
 | 
						bool geometry_updated = state->committed &
 | 
				
			||||||
		(WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_TRANSFORM |
 | 
							(WLR_OUTPUT_STATE_MODE | WLR_OUTPUT_STATE_TRANSFORM |
 | 
				
			||||||
		WLR_OUTPUT_STATE_SUBPIXEL);
 | 
							WLR_OUTPUT_STATE_SUBPIXEL);
 | 
				
			||||||
	if (geometry_updated || scale_updated) {
 | 
					 | 
				
			||||||
		struct wl_resource *resource;
 | 
					 | 
				
			||||||
		wl_resource_for_each(resource, &output->resources) {
 | 
					 | 
				
			||||||
			if (geometry_updated) {
 | 
					 | 
				
			||||||
				send_geometry(resource);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (scale_updated) {
 | 
					 | 
				
			||||||
				send_scale(resource);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		wlr_output_schedule_done(output);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Destroy the swapchains when an output is disabled
 | 
						// Destroy the swapchains when an output is disabled
 | 
				
			||||||
	if ((state->committed & WLR_OUTPUT_STATE_ENABLED) && !state->enabled) {
 | 
						if ((state->committed & WLR_OUTPUT_STATE_ENABLED) && !state->enabled) {
 | 
				
			||||||
| 
						 | 
					@ -360,6 +348,7 @@ static void output_apply_state(struct wlr_output *output,
 | 
				
			||||||
		wlr_swapchain_set_buffer_submitted(output->swapchain, state->buffer);
 | 
							wlr_swapchain_set_buffer_submitted(output->swapchain, state->buffer);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bool mode_updated = false;
 | 
				
			||||||
	if (state->committed & WLR_OUTPUT_STATE_MODE) {
 | 
						if (state->committed & WLR_OUTPUT_STATE_MODE) {
 | 
				
			||||||
		int width = 0, height = 0, refresh = 0;
 | 
							int width = 0, height = 0, refresh = 0;
 | 
				
			||||||
		switch (state->mode_type) {
 | 
							switch (state->mode_type) {
 | 
				
			||||||
| 
						 | 
					@ -394,12 +383,24 @@ static void output_apply_state(struct wlr_output *output,
 | 
				
			||||||
				output->swapchain = NULL;
 | 
									output->swapchain = NULL;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								mode_updated = true;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (geometry_updated || scale_updated || mode_updated) {
 | 
				
			||||||
		struct wl_resource *resource;
 | 
							struct wl_resource *resource;
 | 
				
			||||||
		wl_resource_for_each(resource, &output->resources) {
 | 
							wl_resource_for_each(resource, &output->resources) {
 | 
				
			||||||
 | 
								if (mode_updated) {
 | 
				
			||||||
				send_current_mode(resource);
 | 
									send_current_mode(resource);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			wlr_output_schedule_done(output);
 | 
								if (geometry_updated) {
 | 
				
			||||||
 | 
									send_geometry(resource);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								if (scale_updated) {
 | 
				
			||||||
 | 
									send_scale(resource);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							wlr_output_schedule_done(output);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue