aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 47687744..788300cc 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -67,12 +67,10 @@ void container_destroy(struct sway_container *con) {
67 list_free(con->outputs); 67 list_free(con->outputs);
68 68
69 if (con->view) { 69 if (con->view) {
70 struct sway_view *view = con->view; 70 if (con->view->container == con) {
71 view->container = NULL; 71 con->view->container = NULL;
72 free(view->title_format); 72 }
73 view->title_format = NULL; 73 if (con->view->destroying) {
74
75 if (view->destroying) {
76 view_destroy(con->view); 74 view_destroy(con->view);
77 } 75 }
78 } 76 }
@@ -215,8 +213,7 @@ static struct sway_container *container_at_tabbed(struct sway_node *parent,
215 child_index = children->length - 1; 213 child_index = children->length - 1;
216 } 214 }
217 struct sway_container *child = children->items[child_index]; 215 struct sway_container *child = children->items[child_index];
218 struct sway_node *node = seat_get_focus_inactive(seat, &child->node); 216 return child;
219 return node->sway_container;
220 } 217 }
221 218
222 // Surfaces 219 // Surfaces
@@ -243,8 +240,7 @@ static struct sway_container *container_at_stacked(struct sway_node *parent,
243 int child_index = (ly - box.y) / title_height; 240 int child_index = (ly - box.y) / title_height;
244 if (child_index < children->length) { 241 if (child_index < children->length) {
245 struct sway_container *child = children->items[child_index]; 242 struct sway_container *child = children->items[child_index];
246 struct sway_node *node = seat_get_focus_inactive(seat, &child->node); 243 return child;
247 return node->sway_container;
248 } 244 }
249 245
250 // Surfaces 246 // Surfaces
@@ -465,11 +461,17 @@ static void update_title_texture(struct sway_container *con,
465 cairo_surface_t *surface = cairo_image_surface_create( 461 cairo_surface_t *surface = cairo_image_surface_create(
466 CAIRO_FORMAT_ARGB32, width, height); 462 CAIRO_FORMAT_ARGB32, width, height);
467 cairo_t *cairo = cairo_create(surface); 463 cairo_t *cairo = cairo_create(surface);
464 cairo_set_antialias(cairo, CAIRO_ANTIALIAS_BEST);
465 cairo_font_options_t *fo = cairo_font_options_create();
466 cairo_font_options_set_hint_style(fo, CAIRO_HINT_STYLE_FULL);
467 cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_SUBPIXEL);
468 cairo_font_options_set_subpixel_order(fo, to_cairo_subpixel_order(output->wlr_output->subpixel));
469 cairo_set_font_options(cairo, fo);
470 cairo_font_options_destroy(fo);
468 cairo_set_source_rgba(cairo, class->background[0], class->background[1], 471 cairo_set_source_rgba(cairo, class->background[0], class->background[1],
469 class->background[2], class->background[3]); 472 class->background[2], class->background[3]);
470 cairo_paint(cairo); 473 cairo_paint(cairo);
471 PangoContext *pango = pango_cairo_create_context(cairo); 474 PangoContext *pango = pango_cairo_create_context(cairo);
472 cairo_set_antialias(cairo, CAIRO_ANTIALIAS_BEST);
473 cairo_set_source_rgba(cairo, class->text[0], class->text[1], 475 cairo_set_source_rgba(cairo, class->text[0], class->text[1],
474 class->text[2], class->text[3]); 476 class->text[2], class->text[3]);
475 cairo_move_to(cairo, 0, 0); 477 cairo_move_to(cairo, 0, 0);
@@ -591,7 +593,7 @@ void container_update_representation(struct sway_container *con) {
591 } 593 }
592} 594}
593 595
594size_t container_titlebar_height() { 596size_t container_titlebar_height(void) {
595 return config->font_height + TITLEBAR_V_PADDING * 2; 597 return config->font_height + TITLEBAR_V_PADDING * 2;
596} 598}
597 599
@@ -821,9 +823,16 @@ void container_floating_move_to_center(struct sway_container *con) {
821 return; 823 return;
822 } 824 }
823 struct sway_workspace *ws = con->workspace; 825 struct sway_workspace *ws = con->workspace;
826 bool full = con->is_fullscreen;
827 if (full) {
828 container_set_fullscreen(con, false);
829 }
824 double new_lx = ws->x + (ws->width - con->width) / 2; 830 double new_lx = ws->x + (ws->width - con->width) / 2;
825 double new_ly = ws->y + (ws->height - con->height) / 2; 831 double new_ly = ws->y + (ws->height - con->height) / 2;
826 container_floating_translate(con, new_lx - con->x, new_ly - con->y); 832 container_floating_translate(con, new_lx - con->x, new_ly - con->y);
833 if (full) {
834 container_set_fullscreen(con, true);
835 }
827} 836}
828 837
829static bool find_urgent_iterator(struct sway_container *con, void *data) { 838static bool find_urgent_iterator(struct sway_container *con, void *data) {
@@ -981,7 +990,8 @@ void container_discover_outputs(struct sway_container *con) {
981 } 990 }
982 } 991 }
983 struct sway_output *new_output = container_get_effective_output(con); 992 struct sway_output *new_output = container_get_effective_output(con);
984 double old_scale = old_output ? old_output->wlr_output->scale : -1; 993 double old_scale = old_output && old_output->enabled ?
994 old_output->wlr_output->scale : -1;
985 double new_scale = new_output ? new_output->wlr_output->scale : -1; 995 double new_scale = new_output ? new_output->wlr_output->scale : -1;
986 if (old_scale != new_scale) { 996 if (old_scale != new_scale) {
987 container_update_title_textures(con); 997 container_update_title_textures(con);
@@ -1019,7 +1029,7 @@ void container_add_gaps(struct sway_container *c) {
1019 1029
1020 struct sway_workspace *ws = c->workspace; 1030 struct sway_workspace *ws = c->workspace;
1021 1031
1022 c->current_gaps = ws->has_gaps ? ws->gaps_inner : config->gaps_inner; 1032 c->current_gaps = ws->gaps_inner;
1023 c->x += c->current_gaps; 1033 c->x += c->current_gaps;
1024 c->y += c->current_gaps; 1034 c->y += c->current_gaps;
1025 c->width -= 2 * c->current_gaps; 1035 c->width -= 2 * c->current_gaps;