mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Merge pull request #2269 from minus7/swaybarbg-crash-on-dpms-resume
swaybar/bg: Fix crash on DPMS off
This commit is contained in:
		
						commit
						4e486a01bb
					
				
					 2 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
					@ -503,6 +503,9 @@ void render_frame(struct swaybar *bar, struct swaybar_output *output) {
 | 
				
			||||||
				output->buffers,
 | 
									output->buffers,
 | 
				
			||||||
				output->width * output->scale,
 | 
									output->width * output->scale,
 | 
				
			||||||
				output->height * output->scale);
 | 
									output->height * output->scale);
 | 
				
			||||||
 | 
							if (!output->current_buffer) {
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		cairo_t *shm = output->current_buffer->cairo;
 | 
							cairo_t *shm = output->current_buffer->cairo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		cairo_save(shm);
 | 
							cairo_save(shm);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -68,6 +68,9 @@ static void render_frame(struct swaybg_state *state) {
 | 
				
			||||||
		buffer_height = state->height * state->scale;
 | 
							buffer_height = state->height * state->scale;
 | 
				
			||||||
	state->current_buffer = get_next_buffer(state->shm,
 | 
						state->current_buffer = get_next_buffer(state->shm,
 | 
				
			||||||
			state->buffers, buffer_width, buffer_height);
 | 
								state->buffers, buffer_width, buffer_height);
 | 
				
			||||||
 | 
						if (!state->current_buffer) {
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	cairo_t *cairo = state->current_buffer->cairo;
 | 
						cairo_t *cairo = state->current_buffer->cairo;
 | 
				
			||||||
	if (state->args->mode == BACKGROUND_MODE_SOLID_COLOR) {
 | 
						if (state->args->mode == BACKGROUND_MODE_SOLID_COLOR) {
 | 
				
			||||||
		cairo_set_source_u32(cairo, state->context.color);
 | 
							cairo_set_source_u32(cairo, state->context.color);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue