diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-17 10:14:33 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-17 10:14:33 +1000 |
commit | 75c699db62e63e2a3c2aa652c9ba9482a8f13ec3 (patch) | |
tree | f8b454f2e07f894443cfa76ab48ae0e3fa372829 /sway/tree | |
parent | Merge pull request #2285 from emersion/cleanup-swayidle (diff) | |
download | sway-75c699db62e63e2a3c2aa652c9ba9482a8f13ec3.tar.gz sway-75c699db62e63e2a3c2aa652c9ba9482a8f13ec3.tar.zst sway-75c699db62e63e2a3c2aa652c9ba9482a8f13ec3.zip |
Implement default_floating_border command and adjust CSD behaviour
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/container.c | 11 | ||||
-rw-r--r-- | sway/tree/view.c | 18 |
2 files changed, 20 insertions, 9 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 6d52c38c..3f9d701a 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -967,9 +967,14 @@ void container_set_geometry_from_floating_view(struct sway_container *con) { | |||
967 | return; | 967 | return; |
968 | } | 968 | } |
969 | struct sway_view *view = con->sway_view; | 969 | struct sway_view *view = con->sway_view; |
970 | size_t border_width = view->border_thickness * (view->border != B_NONE); | 970 | size_t border_width = 0; |
971 | size_t top = | 971 | size_t top = 0; |
972 | view->border == B_NORMAL ? container_titlebar_height() : border_width; | 972 | |
973 | if (!view->using_csd) { | ||
974 | border_width = view->border_thickness * (view->border != B_NONE); | ||
975 | top = view->border == B_NORMAL ? | ||
976 | container_titlebar_height() : border_width; | ||
977 | } | ||
973 | 978 | ||
974 | con->x = view->x - border_width; | 979 | con->x = view->x - border_width; |
975 | con->y = view->y - top; | 980 | con->y = view->y - top; |
diff --git a/sway/tree/view.c b/sway/tree/view.c index 76e0f42c..d9938130 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -316,11 +316,15 @@ void view_set_activated(struct sway_view *view, bool activated) { | |||
316 | } | 316 | } |
317 | 317 | ||
318 | void view_set_tiled(struct sway_view *view, bool tiled) { | 318 | void view_set_tiled(struct sway_view *view, bool tiled) { |
319 | bool csd = true; | 319 | if (!tiled) { |
320 | if (view->impl->has_client_side_decorations) { | 320 | view->using_csd = true; |
321 | csd = view->impl->has_client_side_decorations(view); | 321 | if (view->impl->has_client_side_decorations) { |
322 | view->using_csd = view->impl->has_client_side_decorations(view); | ||
323 | } | ||
324 | } else { | ||
325 | view->using_csd = false; | ||
322 | } | 326 | } |
323 | view->border = tiled || !csd ? config->border : B_NONE; | 327 | |
324 | if (view->impl->set_tiled) { | 328 | if (view->impl->set_tiled) { |
325 | view->impl->set_tiled(view, tiled); | 329 | view->impl->set_tiled(view, tiled); |
326 | } | 330 | } |
@@ -573,8 +577,6 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) { | |||
573 | 577 | ||
574 | view->surface = wlr_surface; | 578 | view->surface = wlr_surface; |
575 | view->swayc = cont; | 579 | view->swayc = cont; |
576 | view->border = config->border; | ||
577 | view->border_thickness = config->border_thickness; | ||
578 | 580 | ||
579 | view_init_subsurfaces(view, wlr_surface); | 581 | view_init_subsurfaces(view, wlr_surface); |
580 | wl_signal_add(&wlr_surface->events.new_subsurface, | 582 | wl_signal_add(&wlr_surface->events.new_subsurface, |
@@ -585,8 +587,12 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) { | |||
585 | view->container_reparent.notify = view_handle_container_reparent; | 587 | view->container_reparent.notify = view_handle_container_reparent; |
586 | 588 | ||
587 | if (view->impl->wants_floating && view->impl->wants_floating(view)) { | 589 | if (view->impl->wants_floating && view->impl->wants_floating(view)) { |
590 | view->border = config->floating_border; | ||
591 | view->border_thickness = config->floating_border_thickness; | ||
588 | container_set_floating(view->swayc, true); | 592 | container_set_floating(view->swayc, true); |
589 | } else { | 593 | } else { |
594 | view->border = config->border; | ||
595 | view->border_thickness = config->border_thickness; | ||
590 | view_set_tiled(view, true); | 596 | view_set_tiled(view, true); |
591 | } | 597 | } |
592 | 598 | ||