mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Merge pull request #853 from guiniol/indicator-color
Implement indicator color
This commit is contained in:
		
						commit
						420fa20ae6
					
				
					 3 changed files with 24 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -102,6 +102,8 @@ static void render_borders(swayc_t *view, cairo_t *cr, struct border_colors *col
 | 
			
		|||
	struct wlc_geometry *g = &view->border->geometry;
 | 
			
		||||
	struct wlc_geometry *b = &view->border_geometry;
 | 
			
		||||
	struct wlc_geometry *v = &view->actual_geometry;
 | 
			
		||||
	enum swayc_layouts layout = view->parent->layout;
 | 
			
		||||
	uint32_t color;
 | 
			
		||||
 | 
			
		||||
	int x = b->origin.x - g->origin.x;
 | 
			
		||||
	int y = b->origin.y - g->origin.y;
 | 
			
		||||
| 
						 | 
				
			
			@ -119,8 +121,13 @@ static void render_borders(swayc_t *view, cairo_t *cr, struct border_colors *col
 | 
			
		|||
	// right border
 | 
			
		||||
	int right_border = b->size.w - v->size.w - left_border;
 | 
			
		||||
	if (right_border > 0) {
 | 
			
		||||
		if (layout == L_HORIZ) {
 | 
			
		||||
			color = colors->indicator;
 | 
			
		||||
		} else {
 | 
			
		||||
			color = colors->child_border;
 | 
			
		||||
		}
 | 
			
		||||
		render_sharp_line(cr,
 | 
			
		||||
				colors->child_border,
 | 
			
		||||
				color,
 | 
			
		||||
				x + b->size.w - right_border,
 | 
			
		||||
				y,
 | 
			
		||||
				right_border,
 | 
			
		||||
| 
						 | 
				
			
			@ -140,8 +147,13 @@ static void render_borders(swayc_t *view, cairo_t *cr, struct border_colors *col
 | 
			
		|||
	// bottom border
 | 
			
		||||
	int bottom_border = b->size.h - (top_border + v->size.h);
 | 
			
		||||
	if (bottom_border > 0) {
 | 
			
		||||
		if (layout == L_VERT) {
 | 
			
		||||
			color = colors->indicator;
 | 
			
		||||
		} else {
 | 
			
		||||
			color = colors->child_border;
 | 
			
		||||
		}
 | 
			
		||||
		render_sharp_line(cr,
 | 
			
		||||
				colors->child_border,
 | 
			
		||||
				color,
 | 
			
		||||
				x,
 | 
			
		||||
				y + b->size.h - bottom_border,
 | 
			
		||||
				b->size.w,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2342,15 +2342,15 @@ static struct cmd_results *_do_split(int argc, char **argv, int layout) {
 | 
			
		|||
		arrange_windows(parent, -1, -1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// update container title if tabbed/stacked
 | 
			
		||||
	if (swayc_tabbed_stacked_ancestor(focused)) {
 | 
			
		||||
		update_container_border(focused);
 | 
			
		||||
		swayc_t *output = swayc_parent_by_type(focused, C_OUTPUT);
 | 
			
		||||
		// schedule render to make changes take effect right away,
 | 
			
		||||
		// otherwise we would have to wait for the view to render,
 | 
			
		||||
		// which is unpredictable.
 | 
			
		||||
		wlc_output_schedule_render(output->handle);
 | 
			
		||||
	}
 | 
			
		||||
	// update container every time
 | 
			
		||||
	// if it is tabbed/stacked then the title must change
 | 
			
		||||
	// if the indicator color is different then the border must change
 | 
			
		||||
	update_container_border(focused);
 | 
			
		||||
	swayc_t *output = swayc_parent_by_type(focused, C_OUTPUT);
 | 
			
		||||
	// schedule render to make changes take effect right away,
 | 
			
		||||
	// otherwise we would have to wait for the view to render,
 | 
			
		||||
	// which is unpredictable.
 | 
			
		||||
	wlc_output_schedule_render(output->handle);
 | 
			
		||||
 | 
			
		||||
	return cmd_results_new(CMD_SUCCESS, NULL, NULL);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -177,8 +177,7 @@ or triggered at runtime.
 | 
			
		|||
		**text**::: The text color of the title bar.
 | 
			
		||||
		**indicator**::: The color used to indicate where a new view will open. In a
 | 
			
		||||
		tiled container, this would paint the right border of the current view if
 | 
			
		||||
		a new view would be opened to the right. _Note_: This is not currently
 | 
			
		||||
		implemented.
 | 
			
		||||
		a new view would be opened to the right.
 | 
			
		||||
		**child_border**::: The border around the view itself.
 | 
			
		||||
 | 
			
		||||
+
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue