draw window borders
Works with scaled/rotated displays too!
This commit is contained in:
		| @@ -80,7 +80,7 @@ number of ways: | |||||||
| - Features not yet implemented: | - Features not yet implemented: | ||||||
|     - xdg-shell popups |     - xdg-shell popups | ||||||
|     - Urgent/attention/focus-request |     - Urgent/attention/focus-request | ||||||
|     - Borders and selected/normal/urgent colors |     - Normal/selected/urgent border colors | ||||||
|     - layer-shell |     - layer-shell | ||||||
|     - Statusbar support (built-in or external) |     - Statusbar support (built-in or external) | ||||||
|     - Damage tracking |     - Damage tracking | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ | |||||||
| static const int sloppyfocus        = 1;  /* focus follows mouse */ | static const int sloppyfocus        = 1;  /* focus follows mouse */ | ||||||
| static const unsigned int borderpx  = 1;  /* border pixel of windows */ | static const unsigned int borderpx  = 1;  /* border pixel of windows */ | ||||||
| static const float rootcolor[]      = {0.3, 0.3, 0.3, 1.0}; | static const float rootcolor[]      = {0.3, 0.3, 0.3, 1.0}; | ||||||
|  | static const float bordercolor[]    = {0.5, 0.5, 0.5, 1.0}; | ||||||
|  |  | ||||||
| /* tagging */ | /* tagging */ | ||||||
| static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; | static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; | ||||||
|   | |||||||
							
								
								
									
										18
									
								
								dwl.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								dwl.c
									
									
									
									
									
								
							| @@ -847,6 +847,24 @@ renderclients(Monitor *m, struct timespec *now) | |||||||
| 		if (!VISIBLEON(c, m)) | 		if (!VISIBLEON(c, m)) | ||||||
| 			continue; | 			continue; | ||||||
|  |  | ||||||
|  | 		double ox = c->x, oy = c->y; | ||||||
|  | 		wlr_output_layout_output_coords(output_layout, m->wlr_output, | ||||||
|  | 				&ox, &oy); | ||||||
|  | 		int w = c->xdg_surface->surface->current.width; | ||||||
|  | 		int h = c->xdg_surface->surface->current.height; | ||||||
|  | 		struct wlr_box borders[] = { | ||||||
|  | 			{ox, oy, w + 2 * c->bw, c->bw},             /* top */ | ||||||
|  | 			{ox, oy + c->bw, c->bw, h},                 /* left */ | ||||||
|  | 			{ox + c->bw + w, oy + c->bw, c->bw, h},     /* right */ | ||||||
|  | 			{ox, oy + c->bw + h, w + 2 * c->bw, c->bw}, /* bottom */ | ||||||
|  | 		}; | ||||||
|  | 		int i; | ||||||
|  | 		for (i = 0; i < sizeof(borders) / sizeof(borders[0]); i++) { | ||||||
|  | 			scalebox(&borders[i], m->wlr_output->scale); | ||||||
|  | 			wlr_render_rect(drw, &borders[i], bordercolor, | ||||||
|  | 					m->wlr_output->transform_matrix); | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		struct render_data rdata = { | 		struct render_data rdata = { | ||||||
| 			.output = m->wlr_output, | 			.output = m->wlr_output, | ||||||
| 			.when = now, | 			.when = now, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user