fix: bottom layer should be able to blur + uninitialized string warning
This commit is contained in:
		
							parent
							
								
									a7ea20b477
								
							
						
					
					
						commit
						f7c37ddc3d
					
				
					 5 changed files with 21 additions and 30 deletions
				
			
		|  | @ -36,13 +36,6 @@ struct decoration_data { | ||||||
| 	bool shadow; | 	bool shadow; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct fx_render_data { |  | ||||||
| 	pixman_region32_t *damage; |  | ||||||
| 	struct wlr_box *clip_box; |  | ||||||
| 	struct decoration_data deco_data; |  | ||||||
| 	bool is_toplevel_surface; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| struct gles2_tex_shader { | struct gles2_tex_shader { | ||||||
| 	GLuint program; | 	GLuint program; | ||||||
| 	GLint proj; | 	GLint proj; | ||||||
|  |  | ||||||
|  | @ -13,6 +13,12 @@ | ||||||
| struct sway_server; | struct sway_server; | ||||||
| struct sway_container; | struct sway_container; | ||||||
| 
 | 
 | ||||||
|  | struct render_data { | ||||||
|  | 	pixman_region32_t *damage; | ||||||
|  | 	struct wlr_box *clip_box; | ||||||
|  | 	struct decoration_data deco_data; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| struct sway_output_state { | struct sway_output_state { | ||||||
| 	list_t *workspaces; | 	list_t *workspaces; | ||||||
| 	struct sway_workspace *active_workspace; | 	struct sway_workspace *active_workspace; | ||||||
|  |  | ||||||
|  | @ -6,6 +6,7 @@ | ||||||
| #include <wlr/types/wlr_output.h> | #include <wlr/types/wlr_output.h> | ||||||
| #include <wlr/types/wlr_subcompositor.h> | #include <wlr/types/wlr_subcompositor.h> | ||||||
| #include "log.h" | #include "log.h" | ||||||
|  | #include "sway/config.h" | ||||||
| #include "sway/desktop/transaction.h" | #include "sway/desktop/transaction.h" | ||||||
| #include "sway/input/cursor.h" | #include "sway/input/cursor.h" | ||||||
| #include "sway/input/input-manager.h" | #include "sway/input/input-manager.h" | ||||||
|  | @ -15,6 +16,7 @@ | ||||||
| #include "sway/server.h" | #include "sway/server.h" | ||||||
| #include "sway/tree/arrange.h" | #include "sway/tree/arrange.h" | ||||||
| #include "sway/tree/workspace.h" | #include "sway/tree/workspace.h" | ||||||
|  | #include "wlr-layer-shell-unstable-v1-protocol.h" | ||||||
| 
 | 
 | ||||||
| static void apply_exclusive(struct wlr_box *usable_area, | static void apply_exclusive(struct wlr_box *usable_area, | ||||||
| 		uint32_t anchor, int32_t exclusive, | 		uint32_t anchor, int32_t exclusive, | ||||||
|  | @ -686,7 +688,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { | ||||||
| 	layer_surface->data = sway_layer; | 	layer_surface->data = sway_layer; | ||||||
| 
 | 
 | ||||||
| 	enum zwlr_layer_shell_v1_layer layer = layer_surface->current.layer; | 	enum zwlr_layer_shell_v1_layer layer = layer_surface->current.layer; | ||||||
| 	if (layer != ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM && layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) { | 	if (layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) { | ||||||
| 		for (int i = 0; i < config->layer_effects->length; ++i) { | 		for (int i = 0; i < config->layer_effects->length; ++i) { | ||||||
| 			struct layer_effects *effect = config->layer_effects->items[i]; | 			struct layer_effects *effect = config->layer_effects->items[i]; | ||||||
| 			if (strcmp(effect->namespace, layer_surface->namespace) == 0) { | 			if (strcmp(effect->namespace, layer_surface->namespace) == 0) { | ||||||
|  |  | ||||||
|  | @ -199,7 +199,7 @@ void output_layer_for_each_toplevel_surface(struct sway_output *output, | ||||||
| 	wl_list_for_each(layer_surface, layer_surfaces, link) { | 	wl_list_for_each(layer_surface, layer_surfaces, link) { | ||||||
| 		struct wlr_layer_surface_v1 *wlr_layer_surface_v1 = | 		struct wlr_layer_surface_v1 *wlr_layer_surface_v1 = | ||||||
| 			layer_surface->layer_surface; | 			layer_surface->layer_surface; | ||||||
| 		struct fx_render_data *data = user_data; | 		struct render_data *data = user_data; | ||||||
| 		struct layer_effects *effects = layer_surface->effects; | 		struct layer_effects *effects = layer_surface->effects; | ||||||
| 		if (effects) { | 		if (effects) { | ||||||
| 			data->deco_data.blur = effects->blur; | 			data->deco_data.blur = effects->blur; | ||||||
|  |  | ||||||
|  | @ -430,7 +430,7 @@ damage_finish: | ||||||
| static void render_surface_iterator(struct sway_output *output, | static void render_surface_iterator(struct sway_output *output, | ||||||
| 		struct sway_view *view, struct wlr_surface *surface, | 		struct sway_view *view, struct wlr_surface *surface, | ||||||
| 		struct wlr_box *_box, void *_data) { | 		struct wlr_box *_box, void *_data) { | ||||||
| 	struct fx_render_data *data = _data; | 	struct render_data *data = _data; | ||||||
| 	struct wlr_output *wlr_output = output->wlr_output; | 	struct wlr_output *wlr_output = output->wlr_output; | ||||||
| 	pixman_region32_t *output_damage = data->damage; | 	pixman_region32_t *output_damage = data->damage; | ||||||
| 
 | 
 | ||||||
|  | @ -462,12 +462,9 @@ static void render_surface_iterator(struct sway_output *output, | ||||||
| 	deco_data.corner_radius *= wlr_output->scale; | 	deco_data.corner_radius *= wlr_output->scale; | ||||||
| 
 | 
 | ||||||
| 	// render blur (view->surface == surface excludes blurring subsurfaces)
 | 	// render blur (view->surface == surface excludes blurring subsurfaces)
 | ||||||
| 	bool is_subsurface = true; | 	bool is_subsurface = false; // TODO: discussion here, would all cases where view is null be a non subsurface?
 | ||||||
| 	bool should_optimize_blur = false; | 	bool should_optimize_blur = config->blur_xray; // TODO: for layershell bottom layer should be optimized
 | ||||||
| 	if (data->is_toplevel_surface) { | 	if (view) { | ||||||
| 		is_subsurface = false; |  | ||||||
| 		should_optimize_blur = config->blur_xray; |  | ||||||
| 	} else if (view) { |  | ||||||
| 		is_subsurface = view->surface != surface; | 		is_subsurface = view->surface != surface; | ||||||
| 		should_optimize_blur = !container_is_floating(view->container); | 		should_optimize_blur = !container_is_floating(view->container); | ||||||
| 	} | 	} | ||||||
|  | @ -534,9 +531,8 @@ static void render_surface_iterator(struct sway_output *output, | ||||||
| 
 | 
 | ||||||
| static void render_layer_toplevel(struct sway_output *output, | static void render_layer_toplevel(struct sway_output *output, | ||||||
| 		pixman_region32_t *damage, struct wl_list *layer_surfaces) { | 		pixman_region32_t *damage, struct wl_list *layer_surfaces) { | ||||||
| 	struct fx_render_data data = { | 	struct render_data data = { | ||||||
| 		.damage = damage, | 		.damage = damage, | ||||||
| 		.is_toplevel_surface = true, |  | ||||||
| 		.deco_data = get_undecorated_decoration_data(), | 		.deco_data = get_undecorated_decoration_data(), | ||||||
| 	}; | 	}; | ||||||
| 	output_layer_for_each_toplevel_surface(output, layer_surfaces, | 	output_layer_for_each_toplevel_surface(output, layer_surfaces, | ||||||
|  | @ -545,9 +541,8 @@ static void render_layer_toplevel(struct sway_output *output, | ||||||
| 
 | 
 | ||||||
| static void render_layer_popups(struct sway_output *output, | static void render_layer_popups(struct sway_output *output, | ||||||
| 		pixman_region32_t *damage, struct wl_list *layer_surfaces) { | 		pixman_region32_t *damage, struct wl_list *layer_surfaces) { | ||||||
| 	struct fx_render_data data = { | 	struct render_data data = { | ||||||
| 		.damage = damage, | 		.damage = damage, | ||||||
| 		.is_toplevel_surface = false, |  | ||||||
| 		.deco_data = get_undecorated_decoration_data(), | 		.deco_data = get_undecorated_decoration_data(), | ||||||
| 	}; | 	}; | ||||||
| 	output_layer_for_each_popup_surface(output, layer_surfaces, | 	output_layer_for_each_popup_surface(output, layer_surfaces, | ||||||
|  | @ -557,9 +552,8 @@ static void render_layer_popups(struct sway_output *output, | ||||||
| #if HAVE_XWAYLAND | #if HAVE_XWAYLAND | ||||||
| static void render_unmanaged(struct sway_output *output, | static void render_unmanaged(struct sway_output *output, | ||||||
| 		pixman_region32_t *damage, struct wl_list *unmanaged) { | 		pixman_region32_t *damage, struct wl_list *unmanaged) { | ||||||
| 	struct fx_render_data data = { | 	struct render_data data = { | ||||||
| 		.damage = damage, | 		.damage = damage, | ||||||
| 		.is_toplevel_surface = false, |  | ||||||
| 		.deco_data = get_undecorated_decoration_data(), | 		.deco_data = get_undecorated_decoration_data(), | ||||||
| 	}; | 	}; | ||||||
| 	output_unmanaged_for_each_surface(output, unmanaged, | 	output_unmanaged_for_each_surface(output, unmanaged, | ||||||
|  | @ -569,9 +563,8 @@ static void render_unmanaged(struct sway_output *output, | ||||||
| 
 | 
 | ||||||
| static void render_drag_icons(struct sway_output *output, | static void render_drag_icons(struct sway_output *output, | ||||||
| 		pixman_region32_t *damage, struct wl_list *drag_icons) { | 		pixman_region32_t *damage, struct wl_list *drag_icons) { | ||||||
| 	struct fx_render_data data = { | 	struct render_data data = { | ||||||
| 		.damage = damage, | 		.damage = damage, | ||||||
| 		.is_toplevel_surface = false, |  | ||||||
| 		.deco_data = get_undecorated_decoration_data(), | 		.deco_data = get_undecorated_decoration_data(), | ||||||
| 	}; | 	}; | ||||||
| 	output_drag_icons_for_each_surface(output, drag_icons, | 	output_drag_icons_for_each_surface(output, drag_icons, | ||||||
|  | @ -766,9 +759,8 @@ void premultiply_alpha(float color[4], float opacity) { | ||||||
| 
 | 
 | ||||||
| static void render_view_toplevels(struct sway_view *view, struct sway_output *output, | static void render_view_toplevels(struct sway_view *view, struct sway_output *output, | ||||||
| 		pixman_region32_t *damage, struct decoration_data deco_data) { | 		pixman_region32_t *damage, struct decoration_data deco_data) { | ||||||
| 	struct fx_render_data data = { | 	struct render_data data = { | ||||||
| 		.damage = damage, | 		.damage = damage, | ||||||
| 		.is_toplevel_surface = false, |  | ||||||
| 		.deco_data = deco_data, | 		.deco_data = deco_data, | ||||||
| 	}; | 	}; | ||||||
| 	// Clip the window to its view size, ignoring CSD
 | 	// Clip the window to its view size, ignoring CSD
 | ||||||
|  | @ -792,9 +784,8 @@ static void render_view_toplevels(struct sway_view *view, struct sway_output *ou | ||||||
| 
 | 
 | ||||||
| static void render_view_popups(struct sway_view *view, struct sway_output *output, | static void render_view_popups(struct sway_view *view, struct sway_output *output, | ||||||
| 		pixman_region32_t *damage, struct decoration_data deco_data) { | 		pixman_region32_t *damage, struct decoration_data deco_data) { | ||||||
| 	struct fx_render_data data = { | 	struct render_data data = { | ||||||
| 		.damage = damage, | 		.damage = damage, | ||||||
| 		.is_toplevel_surface = false, |  | ||||||
| 		.deco_data = deco_data, | 		.deco_data = deco_data, | ||||||
| 	}; | 	}; | ||||||
| 	output_view_for_each_popup_surface(output, view, | 	output_view_for_each_popup_surface(output, view, | ||||||
|  | @ -1992,9 +1983,8 @@ void output_render(struct sway_output *output, struct timespec *when, | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if (server.session_lock.lock != NULL) { | 		if (server.session_lock.lock != NULL) { | ||||||
| 			struct fx_render_data data = { | 			struct render_data data = { | ||||||
| 				.damage = damage, | 				.damage = damage, | ||||||
| 				.is_toplevel_surface = false, |  | ||||||
| 				.deco_data = get_undecorated_decoration_data(), | 				.deco_data = get_undecorated_decoration_data(), | ||||||
| 			}; | 			}; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue