summaryrefslogtreecommitdiff
path: root/sway/tree/view.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c72
1 files changed, 15 insertions, 57 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index b77a9bb2..2870d4f5 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -18,7 +18,6 @@
#include "sway/input/seat.h"
#include "sway/tree/arrange.h"
#include "sway/tree/container.h"
-#include "sway/tree/layout.h"
#include "sway/tree/view.h"
#include "sway/tree/workspace.h"
#include "sway/config.h"
@@ -35,7 +34,7 @@ void view_init(struct sway_view *view, enum sway_view_type type,
wl_signal_init(&view->events.unmap);
}
-void view_free(struct sway_view *view) {
+void view_destroy(struct sway_view *view) {
if (!sway_assert(view->surface == NULL, "Tried to free mapped view")) {
return;
}
@@ -75,14 +74,14 @@ void view_free(struct sway_view *view) {
* destroying flag will make the view get freed when the transaction is
* finished.
*/
-void view_destroy(struct sway_view *view) {
+void view_begin_destroy(struct sway_view *view) {
if (!sway_assert(view->surface == NULL, "Tried to destroy a mapped view")) {
return;
}
view->destroying = true;
if (!view->swayc) {
- view_free(view);
+ view_destroy(view);
}
}
@@ -236,7 +235,12 @@ void view_autoconfigure(struct sway_view *view) {
view->border_top = false;
}
- switch (view->border) {
+ enum sway_container_border border = view->border;
+ if (view->using_csd) {
+ border = B_NONE;
+ }
+
+ switch (border) {
case B_NONE:
x = con->x;
y = con->y + y_offset;
@@ -364,48 +368,6 @@ static void view_handle_surface_new_subsurface(struct wl_listener *listener,
view_subsurface_create(view, subsurface);
}
-static void surface_send_enter_iterator(struct wlr_surface *surface,
- int x, int y, void *data) {
- struct wlr_output *wlr_output = data;
- wlr_surface_send_enter(surface, wlr_output);
-}
-
-static void surface_send_leave_iterator(struct wlr_surface *surface,
- int x, int y, void *data) {
- struct wlr_output *wlr_output = data;
- wlr_surface_send_leave(surface, wlr_output);
-}
-
-static void view_handle_container_reparent(struct wl_listener *listener,
- void *data) {
- struct sway_view *view =
- wl_container_of(listener, view, container_reparent);
- struct sway_container *old_parent = data;
-
- struct sway_container *old_output = old_parent;
- if (old_output != NULL && old_output->type != C_OUTPUT) {
- old_output = container_parent(old_output, C_OUTPUT);
- }
-
- struct sway_container *new_output = view->swayc->parent;
- if (new_output != NULL && new_output->type != C_OUTPUT) {
- new_output = container_parent(new_output, C_OUTPUT);
- }
-
- if (old_output == new_output) {
- return;
- }
-
- if (old_output != NULL) {
- view_for_each_surface(view, surface_send_leave_iterator,
- old_output->sway_output->wlr_output);
- }
- if (new_output != NULL) {
- view_for_each_surface(view, surface_send_enter_iterator,
- new_output->sway_output->wlr_output);
- }
-}
-
static bool view_has_executed_criteria(struct sway_view *view,
struct criteria *criteria) {
for (int i = 0; i < view->executed_criteria->length; ++i) {
@@ -567,9 +529,6 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
&view->surface_new_subsurface);
view->surface_new_subsurface.notify = view_handle_surface_new_subsurface;
- wl_signal_add(&view->swayc->events.reparent, &view->container_reparent);
- view->container_reparent.notify = view_handle_container_reparent;
-
if (view->impl->wants_floating && view->impl->wants_floating(view)) {
view->border = config->floating_border;
view->border_thickness = config->floating_border_thickness;
@@ -587,15 +546,12 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface) {
view_update_title(view, false);
container_notify_subtree_changed(view->swayc->parent);
view_execute_criteria(view);
-
- view_handle_container_reparent(&view->container_reparent, NULL);
}
void view_unmap(struct sway_view *view) {
wl_signal_emit(&view->events.unmap, view);
wl_list_remove(&view->surface_new_subsurface.link);
- wl_list_remove(&view->container_reparent.link);
if (view->urgent_timer) {
wl_event_source_remove(view->urgent_timer);
@@ -603,7 +559,9 @@ void view_unmap(struct sway_view *view) {
}
bool was_fullscreen = view->swayc->is_fullscreen;
- struct sway_container *surviving_ancestor = container_destroy(view->swayc);
+ struct sway_container *parent = view->swayc->parent;
+ container_begin_destroy(view->swayc);
+ struct sway_container *surviving_ancestor = container_reap_empty(parent);
// If the workspace wasn't reaped
if (surviving_ancestor && surviving_ancestor->type >= C_WORKSPACE) {
@@ -937,7 +895,7 @@ void view_add_mark(struct sway_view *view, char *mark) {
static void update_marks_texture(struct sway_view *view,
struct wlr_texture **texture, struct border_colors *class) {
- struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
+ struct sway_output *output = container_get_effective_output(view->swayc);
if (!output) {
return;
}
@@ -973,7 +931,7 @@ static void update_marks_texture(struct sway_view *view,
}
free(part);
- double scale = output->sway_output->wlr_output->scale;
+ double scale = output->wlr_output->scale;
int width = 0;
int height = view->swayc->title_height * scale;
@@ -999,7 +957,7 @@ static void update_marks_texture(struct sway_view *view,
unsigned char *data = cairo_image_surface_get_data(surface);
int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width);
struct wlr_renderer *renderer = wlr_backend_get_renderer(
- output->sway_output->wlr_output->backend);
+ output->wlr_output->backend);
*texture = wlr_texture_from_pixels(
renderer, WL_SHM_FORMAT_ARGB8888, stride, width, height, data);
cairo_surface_destroy(surface);