diff options
Diffstat (limited to 'rootston')
| -rw-r--r-- | rootston/desktop.c | 12 | ||||
| -rw-r--r-- | rootston/output.c | 24 | ||||
| -rw-r--r-- | rootston/xwayland.c | 5 | 
3 files changed, 41 insertions, 0 deletions
| diff --git a/rootston/desktop.c b/rootston/desktop.c index d7da1600..3de1f669 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -31,6 +31,18 @@ void view_get_box(const struct roots_view *view, struct wlr_box *box) {  	}  } +void view_get_deco_box(const struct roots_view *view, struct wlr_box *box) { +	view_get_box(view, box); +	if (!view->decorated) { +		return; +	} + +	box->x -= view->border_width; +	box->y -= (view->border_width + view->titlebar_height); +	box->width += view->border_width * 2; +	box->height += (view->border_width * 2 + view->titlebar_height); +} +  static void view_update_output(const struct roots_view *view,  		const struct wlr_box *before) {  	struct roots_desktop *desktop = view->desktop; diff --git a/rootston/output.c b/rootston/output.c index 42dbd972..502e72d2 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -144,8 +144,32 @@ static void render_xwayland_children(struct wlr_xwayland_surface *surface,  	}  } +static void render_decorations(struct roots_view *view, +		struct roots_desktop *desktop, struct wlr_output *output) { +	if (!view->decorated) { +		return; +	} +	struct wlr_box deco_box; +	view_get_deco_box(view, &deco_box); +	double ox = deco_box.x; +	double oy = deco_box.y; +	wlr_output_layout_output_coords(desktop->layout, output, &ox, &oy); +	ox *= output->scale; +	oy *= output->scale; + +	float matrix[16]; +	wlr_output_get_box_matrix(output, ox, oy, deco_box.width, +		deco_box.height, WL_OUTPUT_TRANSFORM_NORMAL, view->rotation, +		&matrix); + +	float color[4] = { 0.2, 0.2, 0.2, 1 }; +	wlr_render_colored_quad(desktop->server->renderer, &color, &matrix); +} +  static void render_view(struct roots_view *view, struct roots_desktop *desktop,  		struct wlr_output *wlr_output, struct timespec *when) { +	render_decorations(view, desktop, wlr_output); +  	switch (view->type) {  	case ROOTS_XDG_SHELL_V6_VIEW:  		render_surface(view->wlr_surface, desktop, wlr_output, when, diff --git a/rootston/xwayland.c b/rootston/xwayland.c index 3d84dc19..eb84eba0 100644 --- a/rootston/xwayland.c +++ b/rootston/xwayland.c @@ -296,6 +296,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {  	view->type = ROOTS_XWAYLAND_VIEW;  	view->x = (double)surface->x;  	view->y = (double)surface->y; +  	view->xwayland_surface = surface;  	view->roots_xwayland_surface = roots_surface;  	view->wlr_surface = surface->surface; @@ -311,6 +312,10 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {  	wl_list_insert(&desktop->views, &view->link);  	if (!surface->override_redirect) { +		view->decorated = true; +		view->border_width = 4; +		view->titlebar_height = 12; +  		view_setup(view);  	}  } | 
