aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-02-21 20:58:17 -0500
committerKirill Primak <vyivel@eclair.cafe>2024-01-18 18:36:54 +0300
commit5f0801b6f245cc789ea93b9449dd0c573ef36e66 (patch)
tree657615d28252b0b3bd01ef240ac6ae49dad15f74 /sway
parent1e018e72b4d57c8f354b9be9686a7a75797cdcab (diff)
container: Don't track outputs
The scene graph abstraction does this for us
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/layer_shell.c1
-rw-r--r--sway/desktop/surface.c31
-rw-r--r--sway/desktop/transaction.c4
-rw-r--r--sway/lock.c1
-rw-r--r--sway/meson.build1
-rw-r--r--sway/tree/container.c72
-rw-r--r--sway/tree/output.c10
-rw-r--r--sway/tree/view.c1
8 files changed, 0 insertions, 121 deletions
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 <wlr/types/wlr_scene.h>
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 <stdlib.h>
-#include <wlr/types/wlr_compositor.h>
-#include <wlr/types/wlr_fractional_scale_v1.h>
-#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"