diff --git a/include/sway/surface.h b/include/sway/surface.h deleted file mode 100644 index 81eb80d5..00000000 --- a/include/sway/surface.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _SWAY_SURFACE_H -#define _SWAY_SURFACE_H -#include - -void surface_enter_output(struct wlr_surface *surface, - struct sway_output *output); -void surface_leave_output(struct wlr_surface *surface, - struct sway_output *output); - -#endif diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 4cd4c847..37a6b2b3 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -125,9 +125,6 @@ struct sway_container { double child_total_width; double child_total_height; - // Outputs currently being intersected - list_t *outputs; // struct sway_output - // Indicates that the container is a scratchpad container. // Both hidden and visible scratchpad containers have scratchpad=true. // Hidden scratchpad containers have a NULL parent. @@ -280,15 +277,6 @@ bool container_is_floating_or_child(struct sway_container *container); */ bool container_is_fullscreen_or_child(struct sway_container *container); -/** - * Return the output which will be used for scale purposes. - * This is the most recently entered output. - * If the container is not on any output, return NULL. - */ -struct sway_output *container_get_effective_output(struct sway_container *con); - -void container_discover_outputs(struct sway_container *con); - enum sway_container_layout container_parent_layout(struct sway_container *con); list_t *container_get_siblings(struct sway_container *container); diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index a52d27fa..aca99c97 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -14,7 +14,6 @@ #include "sway/layers.h" #include "sway/output.h" #include "sway/server.h" -#include "sway/surface.h" #include "sway/tree/arrange.h" #include "sway/tree/workspace.h" #include diff --git a/sway/desktop/surface.c b/sway/desktop/surface.c deleted file mode 100644 index af17a8bb..00000000 --- a/sway/desktop/surface.c +++ /dev/null @@ -1,31 +0,0 @@ -#define _POSIX_C_SOURCE 200112L -#include -#include -#include -#include "sway/server.h" -#include "sway/surface.h" -#include "sway/output.h" - -static void surface_update_outputs(struct wlr_surface *surface) { - float scale = 1; - struct wlr_surface_output *surface_output; - wl_list_for_each(surface_output, &surface->current_outputs, link) { - if (surface_output->output->scale > scale) { - scale = surface_output->output->scale; - } - } - wlr_fractional_scale_v1_notify_scale(surface, scale); - wlr_surface_set_preferred_buffer_scale(surface, ceil(scale)); -} - -void surface_enter_output(struct wlr_surface *surface, - struct sway_output *output) { - wlr_surface_send_enter(surface, output->wlr_output); - surface_update_outputs(surface); -} - -void surface_leave_output(struct wlr_surface *surface, - struct sway_output *output) { - wlr_surface_send_leave(surface, output->wlr_output); - surface_update_outputs(surface); -} diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 5f104aa3..ba9d0648 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -250,10 +250,6 @@ static void apply_container_state(struct sway_container *container, view_center_surface(view); } } - - if (!container->node.destroying) { - container_discover_outputs(container); - } } /** diff --git a/sway/lock.c b/sway/lock.c index 2856ae67..8ad9c3f6 100644 --- a/sway/lock.c +++ b/sway/lock.c @@ -8,7 +8,6 @@ #include "sway/layers.h" #include "sway/output.h" #include "sway/server.h" -#include "sway/surface.h" struct sway_session_lock_output { struct wlr_scene_tree *tree; diff --git a/sway/meson.build b/sway/meson.build index 1079c749..d937e425 100644 --- a/sway/meson.build +++ b/sway/meson.build @@ -18,7 +18,6 @@ sway_sources = files( 'desktop/idle_inhibit_v1.c', 'desktop/layer_shell.c', 'desktop/output.c', - 'desktop/surface.c', 'desktop/transaction.c', 'desktop/xdg_shell.c', 'desktop/launcher.c', diff --git a/sway/tree/container.c b/sway/tree/container.c index cde9dff5..b19081fc 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -17,7 +17,6 @@ #include "sway/sway_text_node.h" #include "sway/output.h" #include "sway/server.h" -#include "sway/surface.h" #include "sway/tree/arrange.h" #include "sway/tree/view.h" #include "sway/tree/workspace.h" @@ -113,7 +112,6 @@ struct sway_container *container_create(struct sway_view *view) { c->view = view; c->alpha = 1.0f; c->marks = create_list(); - c->outputs = create_list(); wl_signal_init(&c->events.destroy); wl_signal_emit_mutable(&root->events.new_node, &c->node); @@ -453,7 +451,6 @@ void container_destroy(struct sway_container *con) { free(con->formatted_title); list_free(con->pending.children); list_free(con->current.children); - list_free(con->outputs); list_free_items_and_destroy(con->marks); @@ -597,18 +594,6 @@ bool container_has_ancestor(struct sway_container *descendant, return false; } - -/** - * Return the output which will be used for scale purposes. - * This is the most recently entered output. - */ -struct sway_output *container_get_effective_output(struct sway_container *con) { - if (con->outputs->length == 0) { - return NULL; - } - return con->outputs->items[con->outputs->length - 1]; -} - /** * Calculate and return the length of the tree representation. * An example tree representation is: V[Terminal, Firefox] @@ -1267,63 +1252,6 @@ bool container_is_fullscreen_or_child(struct sway_container *container) { return false; } -static void surface_send_enter_iterator(struct wlr_surface *surface, - int x, int y, void *data) { - struct sway_output *output = data; - surface_enter_output(surface, output); -} - -static void surface_send_leave_iterator(struct wlr_surface *surface, - int x, int y, void *data) { - struct sway_output *output = data; - surface_leave_output(surface, output); -} - -void container_discover_outputs(struct sway_container *con) { - struct wlr_box con_box = { - .x = con->current.x, - .y = con->current.y, - .width = con->current.width, - .height = con->current.height, - }; - - for (int i = 0; i < root->outputs->length; ++i) { - struct sway_output *output = root->outputs->items[i]; - struct wlr_box output_box; - output_get_box(output, &output_box); - struct wlr_box intersection; - bool intersects = - wlr_box_intersection(&intersection, &con_box, &output_box); - int index = list_find(con->outputs, output); - - if (intersects && index == -1) { - // Send enter - sway_log(SWAY_DEBUG, "Container %p entered output %p", con, output); - if (con->view) { - view_for_each_surface(con->view, - surface_send_enter_iterator, output); - if (con->view->foreign_toplevel) { - wlr_foreign_toplevel_handle_v1_output_enter( - con->view->foreign_toplevel, output->wlr_output); - } - } - list_add(con->outputs, output); - } else if (!intersects && index != -1) { - // Send leave - sway_log(SWAY_DEBUG, "Container %p left output %p", con, output); - if (con->view) { - view_for_each_surface(con->view, - surface_send_leave_iterator, output); - if (con->view->foreign_toplevel) { - wlr_foreign_toplevel_handle_v1_output_leave( - con->view->foreign_toplevel, output->wlr_output); - } - } - list_del(con->outputs, index); - } - } -} - enum sway_container_layout container_parent_layout(struct sway_container *con) { if (con->pending.parent) { return con->pending.parent->pending.layout; diff --git a/sway/tree/output.c b/sway/tree/output.c index 3c8823dc..cd7bf0c2 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -283,14 +283,6 @@ void output_destroy(struct sway_output *output) { free(output); } -static void untrack_output(struct sway_container *con, void *data) { - struct sway_output *output = data; - int index = list_find(con->outputs, output); - if (index != -1) { - list_del(con->outputs, index); - } -} - void output_disable(struct sway_output *output) { if (!sway_assert(output->enabled, "Expected an enabled output")) { return; @@ -305,8 +297,6 @@ void output_disable(struct sway_output *output) { output_evacuate(output); - root_for_each_container(untrack_output, output); - list_del(root->outputs, index); output->enabled = false; diff --git a/sway/tree/view.c b/sway/tree/view.c index 2874e88b..3bc0855b 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -25,7 +25,6 @@ #include "sway/input/seat.h" #include "sway/scene_descriptor.h" #include "sway/server.h" -#include "sway/surface.h" #include "sway/sway_text_node.h" #include "sway/tree/arrange.h" #include "sway/tree/container.h"