diff options
author | 2016-03-29 14:47:30 +0200 | |
---|---|---|
committer | 2016-03-30 00:47:58 +0200 | |
commit | 5a13cb0ed136906a4370235214601b0129548c49 (patch) | |
tree | 51dce6cdcb9bb1ffe27dcdc9a01ca9bda3a7c87a /sway/container.c | |
parent | Add border <none|normal|toggle|pixel> config (diff) | |
download | sway-5a13cb0ed136906a4370235214601b0129548c49.tar.gz sway-5a13cb0ed136906a4370235214601b0129548c49.tar.zst sway-5a13cb0ed136906a4370235214601b0129548c49.zip |
Implement borders
The borders are implemented as a surface/buffer attached to each view
which is sent to and rendered by wlc in the view_pre_render callback.
All the drawing logic is handled in sway/border.c and all the logic for
calculating the geometry of the border/view is handled in
`update_geometry` in sway/layout.c (same place as gaps are calculated).
Diffstat (limited to 'sway/container.c')
-rw-r--r-- | sway/container.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sway/container.c b/sway/container.c index ac0d3231..21a929b9 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -22,8 +22,8 @@ static swayc_t *new_swayc(enum swayc_types type) { | |||
22 | c->gaps = -1; | 22 | c->gaps = -1; |
23 | c->layout = L_NONE; | 23 | c->layout = L_NONE; |
24 | c->type = type; | 24 | c->type = type; |
25 | c->border_type = B_PIXEL; // TODO: Load default from config | 25 | c->border_type = config->border; |
26 | c->border_thickness = 2; | 26 | c->border_thickness = config->border_thickness; |
27 | if (type != C_VIEW) { | 27 | if (type != C_VIEW) { |
28 | c->children = create_list(); | 28 | c->children = create_list(); |
29 | c->border_type = B_NONE; | 29 | c->border_type = B_NONE; |
@@ -269,11 +269,12 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { | |||
269 | view->is_focused = true; | 269 | view->is_focused = true; |
270 | view->sticky = false; | 270 | view->sticky = false; |
271 | // Setup geometry | 271 | // Setup geometry |
272 | const struct wlc_geometry* geometry = wlc_view_get_geometry(handle); | 272 | struct wlc_geometry geometry; |
273 | wlc_view_get_visible_geometry(handle, &geometry); | ||
273 | view->width = 0; | 274 | view->width = 0; |
274 | view->height = 0; | 275 | view->height = 0; |
275 | view->desired_width = geometry->size.w; | 276 | view->desired_width = geometry.size.w; |
276 | view->desired_height = geometry->size.h; | 277 | view->desired_height = geometry.size.h; |
277 | 278 | ||
278 | view->is_floating = false; | 279 | view->is_floating = false; |
279 | 280 | ||
@@ -306,13 +307,14 @@ swayc_t *new_floating_view(wlc_handle handle) { | |||
306 | view->sticky = false; | 307 | view->sticky = false; |
307 | 308 | ||
308 | // Set the geometry of the floating view | 309 | // Set the geometry of the floating view |
309 | const struct wlc_geometry* geometry = wlc_view_get_geometry(handle); | 310 | struct wlc_geometry geometry; |
311 | wlc_view_get_visible_geometry(handle, &geometry); | ||
310 | 312 | ||
311 | // give it requested geometry, but place in center | 313 | // give it requested geometry, but place in center |
312 | view->x = (swayc_active_workspace()->width - geometry->size.w) / 2; | 314 | view->x = (swayc_active_workspace()->width - geometry.size.w) / 2; |
313 | view->y = (swayc_active_workspace()->height- geometry->size.h) / 2; | 315 | view->y = (swayc_active_workspace()->height- geometry.size.h) / 2; |
314 | view->width = geometry->size.w; | 316 | view->width = geometry.size.w; |
315 | view->height = geometry->size.h; | 317 | view->height = geometry.size.h; |
316 | 318 | ||
317 | view->desired_width = view->width; | 319 | view->desired_width = view->width; |
318 | view->desired_height = view->height; | 320 | view->desired_height = view->height; |