diff options
Diffstat (limited to 'sway/desktop')
| -rw-r--r-- | sway/desktop/desktop.c | 14 | ||||
| -rw-r--r-- | sway/desktop/layer_shell.c | 44 | ||||
| -rw-r--r-- | sway/desktop/output.c | 8 | ||||
| -rw-r--r-- | sway/desktop/wl_shell.c | 2 | ||||
| -rw-r--r-- | sway/desktop/xdg_shell_v6.c | 2 | ||||
| -rw-r--r-- | sway/desktop/xwayland.c | 18 | 
6 files changed, 45 insertions, 43 deletions
| diff --git a/sway/desktop/desktop.c b/sway/desktop/desktop.c index 3a13191f..66f33151 100644 --- a/sway/desktop/desktop.c +++ b/sway/desktop/desktop.c @@ -2,19 +2,13 @@  #include "sway/desktop.h"  #include "sway/output.h" -void desktop_damage_whole_surface(struct wlr_surface *surface, double lx, -		double ly) { +void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly, +		bool whole) {  	for (int i = 0; i < root_container.children->length; ++i) {  		struct sway_container *cont = root_container.children->items[i];  		if (cont->type == C_OUTPUT) { -			output_damage_whole_surface(cont->sway_output, -				lx - cont->x, ly - cont->y, surface); +			output_damage_surface(cont->sway_output, lx - cont->x, ly - cont->y, +				surface, whole);  		}  	}  } - -void desktop_damage_from_surface(struct wlr_surface *surface, double lx, -		double ly) { -	// TODO -	desktop_damage_whole_surface(surface, lx, ly); -} diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 663ec7ba..f841e5f1 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -229,33 +229,39 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {  		wl_container_of(listener, layer, surface_commit);  	struct wlr_layer_surface *layer_surface = layer->layer_surface;  	struct wlr_output *wlr_output = layer_surface->output; -	if (wlr_output != NULL) { -		struct sway_output *output = wlr_output->data; -		struct wlr_box old_geo = layer->geo; -		arrange_layers(output); -		if (memcmp(&old_geo, &layer->geo, sizeof(struct wlr_box)) != 0) { -			// TODO DAMAGE apply whole surface from previous and new geos -		} else { -			// TODO DAMAGE from surface damage -		} -		wlr_output_damage_add_box(output->damage, &old_geo); -		wlr_output_damage_add_box(output->damage, &layer->geo); +	if (wlr_output == NULL) { +		return; +	} + +	struct sway_output *output = wlr_output->data; +	struct wlr_box old_geo = layer->geo; +	arrange_layers(output); +	if (memcmp(&old_geo, &layer->geo, sizeof(struct wlr_box)) != 0) { +		output_damage_surface(output, old_geo.x, old_geo.y, +			layer_surface->surface, true); +		output_damage_surface(output, layer->geo.x, layer->geo.y, +			layer_surface->surface, true); +	} else { +		output_damage_surface(output, layer->geo.x, layer->geo.y, +			layer_surface->surface, false);  	}  }  static void unmap(struct sway_layer_surface *sway_layer) {  	struct wlr_output *wlr_output = sway_layer->layer_surface->output; -	if (wlr_output != NULL) { -		struct sway_output *output = wlr_output->data; -		wlr_output_damage_add_box(output->damage, &sway_layer->geo); +	if (wlr_output == NULL) { +		return;  	} +	struct sway_output *output = wlr_output->data; +	output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y, +		sway_layer->layer_surface->surface, true);  }  static void handle_destroy(struct wl_listener *listener, void *data) { -	struct sway_layer_surface *sway_layer = wl_container_of(listener, -			sway_layer, destroy); +	struct sway_layer_surface *sway_layer = +		wl_container_of(listener, sway_layer, destroy);  	wlr_log(L_DEBUG, "Layer surface destroyed (%s)", -			sway_layer->layer_surface->namespace); +		sway_layer->layer_surface->namespace);  	if (sway_layer->layer_surface->mapped) {  		unmap(sway_layer);  	} @@ -277,7 +283,9 @@ static void handle_map(struct wl_listener *listener, void *data) {  	struct sway_layer_surface *sway_layer = wl_container_of(listener,  			sway_layer, map);  	struct sway_output *output = sway_layer->layer_surface->output->data; -	wlr_output_damage_add_box(output->damage, &sway_layer->geo); +	output_damage_surface(output, sway_layer->geo.x, sway_layer->geo.y, +		sway_layer->layer_surface->surface, true); +	// TODO: send enter to subsurfaces and popups  	wlr_surface_send_enter(sway_layer->layer_surface->surface,  		sway_layer->layer_surface->output);  } diff --git a/sway/desktop/output.c b/sway/desktop/output.c index aa18f1b8..3bbd0bb2 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -332,14 +332,14 @@ void output_damage_whole(struct sway_output *output) {  	wlr_output_damage_add_whole(output->damage);  } -void output_damage_whole_surface(struct sway_output *output, -		double ox, double oy, struct wlr_surface *surface) { +void output_damage_surface(struct sway_output *output, double ox, double oy, +		struct wlr_surface *surface, bool whole) {  	// TODO  	output_damage_whole(output);  } -void output_damage_whole_view(struct sway_output *output, -		struct sway_view *view) { +void output_damage_view(struct sway_output *output, struct sway_view *view, +		bool whole) {  	// TODO  	output_damage_whole(output);  } diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c index fff31da8..b63c220c 100644 --- a/sway/desktop/wl_shell.c +++ b/sway/desktop/wl_shell.c @@ -79,7 +79,7 @@ static void handle_commit(struct wl_listener *listener, void *data) {  	// TODO: Let floating views do whatever  	view_update_size(view, wl_shell_view->pending_width,  		wl_shell_view->pending_height); -	view_damage_from(view); +	view_damage(view, false);  }  static void handle_destroy(struct wl_listener *listener, void *data) { diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 8361aab3..b82eec8f 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -169,7 +169,7 @@ static void handle_commit(struct wl_listener *listener, void *data) {  	// TODO: Let floating views do whatever  	view_update_size(view, xdg_shell_v6_view->pending_width,  		xdg_shell_v6_view->pending_height); -	view_damage_from(view); +	view_damage(view, false);  }  static void handle_new_popup(struct wl_listener *listener, void *data) { diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 10bfcc89..6de1365d 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -32,15 +32,15 @@ static void unmanaged_handle_commit(struct wl_listener *listener, void *data) {  	if (xsurface->x != surface->lx || xsurface->y != surface->ly) {  		// Surface has moved -		desktop_damage_whole_surface(xsurface->surface, -			surface->lx, surface->ly); +		desktop_damage_surface(xsurface->surface, surface->lx, surface->ly, +			true);  		surface->lx = xsurface->x;  		surface->ly = xsurface->y; -		desktop_damage_whole_surface(xsurface->surface, -			surface->lx, surface->ly); +		desktop_damage_surface(xsurface->surface, surface->lx, surface->ly, +			true);  	} else { -		desktop_damage_from_surface(xsurface->surface, -			xsurface->x, xsurface->y); +		desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y, +			false);  	}  } @@ -57,7 +57,7 @@ static void unmanaged_handle_map(struct wl_listener *listener, void *data) {  	surface->lx = xsurface->x;  	surface->ly = xsurface->y; -	desktop_damage_whole_surface(xsurface->surface, surface->lx, surface->ly); +	desktop_damage_surface(xsurface->surface, surface->lx, surface->ly, true);  	// TODO: we don't send surface enter/leave events to xwayland unmanaged  	// surfaces, but xwayland doesn't support HiDPI anyway @@ -67,7 +67,7 @@ static void unmanaged_handle_unmap(struct wl_listener *listener, void *data) {  	struct sway_xwayland_unmanaged *surface =  		wl_container_of(listener, surface, unmap);  	struct wlr_xwayland_surface *xsurface = surface->wlr_xwayland_surface; -	desktop_damage_whole_surface(xsurface->surface, xsurface->x, xsurface->y); +	desktop_damage_surface(xsurface->surface, xsurface->x, xsurface->y, true);  	wl_list_remove(&surface->link);  	wl_list_remove(&surface->commit.link);  } @@ -209,7 +209,7 @@ static void handle_commit(struct wl_listener *listener, void *data) {  	// TODO: Let floating views do whatever  	view_update_size(view, xwayland_view->pending_width,  		xwayland_view->pending_height); -	view_damage_from(view); +	view_damage(view, false);  }  static void handle_unmap(struct wl_listener *listener, void *data) { | 
