diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-25 11:15:43 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-01 23:14:58 +1000 |
commit | 13a4b0512e25b8da6e16ca1286f8b62fcc24c5cc (patch) | |
tree | 5e03717e41e4af7282995b15b0938a6f07c4c74d /sway/tree/container.c | |
parent | Respect view's border config for floating containers (diff) | |
download | sway-13a4b0512e25b8da6e16ca1286f8b62fcc24c5cc.tar.gz sway-13a4b0512e25b8da6e16ca1286f8b62fcc24c5cc.tar.zst sway-13a4b0512e25b8da6e16ca1286f8b62fcc24c5cc.zip |
Fix unfullscreening a floating view
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index c16f1748..fd7ee2c3 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -906,23 +906,6 @@ size_t container_titlebar_height() { | |||
906 | return config->font_height + TITLEBAR_V_PADDING * 2; | 906 | return config->font_height + TITLEBAR_V_PADDING * 2; |
907 | } | 907 | } |
908 | 908 | ||
909 | static void configure_floating_view(struct sway_view *view) { | ||
910 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); | ||
911 | int max_width = ws->width * 0.6666; | ||
912 | int max_height = ws->height * 0.6666; | ||
913 | int width = | ||
914 | view->natural_width > max_width ? max_width : view->natural_width; | ||
915 | int height = | ||
916 | view->natural_height > max_height ? max_height : view->natural_height; | ||
917 | struct sway_container *output = ws->parent; | ||
918 | int lx = output->x + (ws->width - width) / 2; | ||
919 | int ly = output->y + (ws->height - height) / 2; | ||
920 | |||
921 | view->border_left = view->border_right = view->border_bottom = true; | ||
922 | view_set_maximized(view, false); | ||
923 | view_configure(view, lx, ly, width, height); | ||
924 | } | ||
925 | |||
926 | void container_set_floating(struct sway_container *container, bool enable) { | 909 | void container_set_floating(struct sway_container *container, bool enable) { |
927 | if (container_is_floating(container) == enable) { | 910 | if (container_is_floating(container) == enable) { |
928 | return; | 911 | return; |
@@ -936,7 +919,7 @@ void container_set_floating(struct sway_container *container, bool enable) { | |||
936 | container_remove_child(container); | 919 | container_remove_child(container); |
937 | container_add_child(workspace->sway_workspace->floating, container); | 920 | container_add_child(workspace->sway_workspace->floating, container); |
938 | if (container->type == C_VIEW) { | 921 | if (container->type == C_VIEW) { |
939 | configure_floating_view(container->sway_view); | 922 | view_autoconfigure(container->sway_view); |
940 | } | 923 | } |
941 | seat_set_focus(seat, seat_get_focus_inactive(seat, container)); | 924 | seat_set_focus(seat, seat_get_focus_inactive(seat, container)); |
942 | container_reap_empty_recursive(workspace); | 925 | container_reap_empty_recursive(workspace); |