]> git.mdlowis.com Git - proto/labwc.git/commitdiff
include: split output.h from labwc.h
authorJohn Lindgren <john@jlindgren.net>
Sat, 26 Jul 2025 19:34:45 +0000 (15:34 -0400)
committerJohan Malm <johanmalm@users.noreply.github.com>
Wed, 30 Jul 2025 20:04:31 +0000 (21:04 +0100)
32 files changed:
include/labwc.h
include/output.h [new file with mode: 0644]
src/action.c
src/common/scene-helpers.c
src/debug.c
src/desktop.c
src/edges.c
src/foreign-toplevel/wlr-foreign.c
src/input/cursor.c
src/input/ime.c
src/interactive.c
src/layers.c
src/magnifier.c
src/menu/menu.c
src/osd-field.c
src/osd.c
src/output-state.c
src/output-virtual.c
src/output.c
src/overlay.c
src/placement.c
src/regions.c
src/seat.c
src/server.c
src/session-lock.c
src/snap.c
src/ssd/ssd-extents.c
src/view.c
src/workspaces.c
src/xdg-popup.c
src/xdg.c
src/xwayland.c

index fbeb992b879b072b640b468e55cd7494488568aa..642cf4cb07ba280e829da1aedf86de6260542801 100644 (file)
@@ -403,39 +403,6 @@ struct server {
        pid_t primary_client_pid;
 };
 
-#define LAB_NR_LAYERS (4)
-
-struct output {
-       struct wl_list link; /* server.outputs */
-       struct server *server;
-       struct wlr_output *wlr_output;
-       struct wlr_output_state pending;
-       struct wlr_scene_output *scene_output;
-       struct wlr_scene_tree *layer_tree[LAB_NR_LAYERS];
-       struct wlr_scene_tree *layer_popup_tree;
-       struct wlr_scene_tree *osd_tree;
-       struct wlr_scene_tree *session_lock_tree;
-       struct wlr_scene_buffer *workspace_osd;
-
-       struct osd_scene {
-               struct wl_array items; /* struct osd_scene_item */
-               struct wlr_scene_tree *tree;
-       } osd_scene;
-
-       /* In output-relative scene coordinates */
-       struct wlr_box usable_area;
-
-       struct wl_list regions;  /* struct region.link */
-
-       struct wl_listener destroy;
-       struct wl_listener frame;
-       struct wl_listener request_state;
-
-       bool gamma_lut_changed;
-};
-
-#undef LAB_NR_LAYERS
-
 struct constraint {
        struct seat *seat;
        struct wlr_pointer_constraint_v1 *constraint;
@@ -548,45 +515,6 @@ void interactive_cancel(struct view *view);
 /* Possibly returns VIEW_EDGE_CENTER if <topMaximize> is yes */
 enum view_edge edge_from_cursor(struct seat *seat, struct output **dest_output);
 
-void output_init(struct server *server);
-void output_finish(struct server *server);
-void output_manager_init(struct server *server);
-struct output *output_from_wlr_output(struct server *server,
-       struct wlr_output *wlr_output);
-struct output *output_from_name(struct server *server, const char *name);
-struct output *output_nearest_to(struct server *server, int lx, int ly);
-struct output *output_nearest_to_cursor(struct server *server);
-
-/**
- * output_get_adjacent() - get next output, in a given direction,
- * from a given output
- *
- * @output: reference output
- * @edge: direction in which to look for the nearest output
- * @wrap: if true, wrap around at layout edge
- *
- * Note: if output is NULL, the output nearest the cursor will be used as the
- * reference instead.
- */
-struct output *output_get_adjacent(struct output *output,
-       enum view_edge edge, bool wrap);
-
-bool output_is_usable(struct output *output);
-void output_update_usable_area(struct output *output);
-void output_update_all_usable_areas(struct server *server, bool layout_changed);
-bool output_get_tearing_allowance(struct output *output);
-struct wlr_box output_usable_area_in_layout_coords(struct output *output);
-void handle_output_power_manager_set_mode(struct wl_listener *listener,
-       void *data);
-void output_enable_adaptive_sync(struct output *output, bool enabled);
-
-/**
- * output_max_scale() - get maximum scale factor of all usable outputs.
- * Used when loading/rendering resources (e.g. icons) that may be
- * displayed on any output.
- */
-float output_max_scale(struct server *server);
-
 void handle_tearing_new_object(struct wl_listener *listener, void *data);
 
 void server_init(struct server *server);
diff --git a/include/output.h b/include/output.h
new file mode 100644 (file)
index 0000000..d96a8c2
--- /dev/null
@@ -0,0 +1,81 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef LABWC_OUTPUT_H
+#define LABWC_OUTPUT_H
+
+#include <wlr/types/wlr_output.h>
+
+enum view_edge;
+
+#define LAB_NR_LAYERS (4)
+
+struct output {
+       struct wl_list link; /* server.outputs */
+       struct server *server;
+       struct wlr_output *wlr_output;
+       struct wlr_output_state pending;
+       struct wlr_scene_output *scene_output;
+       struct wlr_scene_tree *layer_tree[LAB_NR_LAYERS];
+       struct wlr_scene_tree *layer_popup_tree;
+       struct wlr_scene_tree *osd_tree;
+       struct wlr_scene_tree *session_lock_tree;
+       struct wlr_scene_buffer *workspace_osd;
+
+       struct osd_scene {
+               struct wl_array items; /* struct osd_scene_item */
+               struct wlr_scene_tree *tree;
+       } osd_scene;
+
+       /* In output-relative scene coordinates */
+       struct wlr_box usable_area;
+
+       struct wl_list regions;  /* struct region.link */
+
+       struct wl_listener destroy;
+       struct wl_listener frame;
+       struct wl_listener request_state;
+
+       bool gamma_lut_changed;
+};
+
+#undef LAB_NR_LAYERS
+
+void output_init(struct server *server);
+void output_finish(struct server *server);
+void output_manager_init(struct server *server);
+struct output *output_from_wlr_output(struct server *server,
+       struct wlr_output *wlr_output);
+struct output *output_from_name(struct server *server, const char *name);
+struct output *output_nearest_to(struct server *server, int lx, int ly);
+struct output *output_nearest_to_cursor(struct server *server);
+
+/**
+ * output_get_adjacent() - get next output, in a given direction,
+ * from a given output
+ *
+ * @output: reference output
+ * @edge: direction in which to look for the nearest output
+ * @wrap: if true, wrap around at layout edge
+ *
+ * Note: if output is NULL, the output nearest the cursor will be used as the
+ * reference instead.
+ */
+struct output *output_get_adjacent(struct output *output,
+       enum view_edge edge, bool wrap);
+
+bool output_is_usable(struct output *output);
+void output_update_usable_area(struct output *output);
+void output_update_all_usable_areas(struct server *server, bool layout_changed);
+bool output_get_tearing_allowance(struct output *output);
+struct wlr_box output_usable_area_in_layout_coords(struct output *output);
+void handle_output_power_manager_set_mode(struct wl_listener *listener,
+       void *data);
+void output_enable_adaptive_sync(struct output *output, bool enabled);
+
+/**
+ * output_max_scale() - get maximum scale factor of all usable outputs.
+ * Used when loading/rendering resources (e.g. icons) that may be
+ * displayed on any output.
+ */
+float output_max_scale(struct server *server);
+
+#endif // LABWC_OUTPUT_H
index adcae7cf0e8ae37ca97c349e00f71a80a0e2c42a..ec1914c4a31a8f5fec51e3e48b777c016b53846a 100644 (file)
@@ -18,6 +18,7 @@
 #include "magnifier.h"
 #include "menu/menu.h"
 #include "osd.h"
+#include "output.h"
 #include "output-virtual.h"
 #include "regions.h"
 #include "ssd.h"
index 9b787b262662b51a9e2b3ace023b0e043d4172ac..5f8a813958a5a29b17e8c2b897765fb1b2a61466 100644 (file)
@@ -9,6 +9,7 @@
 #include <wlr/util/transform.h>
 #include "labwc.h"
 #include "magnifier.h"
+#include "output.h"
 #include "output-state.h"
 
 struct wlr_surface *
index e482a357156d32d72c85992224a3da492ebae151..60b4a82c8ea4fe5cd7729b20702d3e41fa8d232f 100644 (file)
@@ -8,6 +8,7 @@
 #include "input/ime.h"
 #include "labwc.h"
 #include "node.h"
+#include "output.h"
 #include "ssd.h"
 #include "view.h"
 #include "workspaces.h"
index 28af6cc64170700510bea93651bfab18ae0fc33a..739cc3ef367ce76788d4215ffb2641f0ccd33542 100644 (file)
@@ -8,6 +8,7 @@
 #include "layers.h"
 #include "node.h"
 #include "osd.h"
+#include "output.h"
 #include "ssd.h"
 #include "view.h"
 #include "window-rules.h"
index 237991a2d946f0f5e823cbbeb2640a84c6e3cea8..94c541b593ea373fd7639e102d487b090a064ab5 100644 (file)
@@ -10,6 +10,7 @@
 #include "common/macros.h"
 #include "config/rcxml.h"
 #include "labwc.h"
+#include "output.h"
 #include "view.h"
 #include "node.h"
 
index 76eb01e5ad2ae9d2df6e81633c22b96a06649acf..7c915ac416eaec13051fbb59fc6fe0bea071eb41 100644 (file)
@@ -3,6 +3,7 @@
 #include <wlr/types/wlr_foreign_toplevel_management_v1.h>
 #include "common/macros.h"
 #include "labwc.h"
+#include "output.h"
 #include "view.h"
 #include "foreign-toplevel-internal.h"
 
index be2928229c8de6540476b0a4ad48d9cb4d5fce73..d7eabb7595db3eb59ed91b3d02abda85a14de891 100644 (file)
@@ -25,6 +25,7 @@
 #include "labwc.h"
 #include "layers.h"
 #include "menu/menu.h"
+#include "output.h"
 #include "regions.h"
 #include "resistance.h"
 #include "resize-outlines.h"
index 0cb656de0dfd972f8b208c0c772e6c53f829a7e4..1e4cddc4b4938a51c09d9b71c393fa705b81a60b 100644 (file)
@@ -5,6 +5,7 @@
 #include <assert.h>
 #include "common/mem.h"
 #include "node.h"
+#include "output.h"
 #include "view.h"
 
 #define SAME_CLIENT(wlr_obj1, wlr_obj2) \
index bd620edb894d2cc28424050adee5dd83d0faeac8..f6fd5450e26314bcf628a7794098e8d2a4501d7d 100644 (file)
@@ -3,6 +3,7 @@
 #include "edges.h"
 #include "input/keyboard.h"
 #include "labwc.h"
+#include "output.h"
 #include "regions.h"
 #include "resize-indicator.h"
 #include "snap.h"
index 44a2e13162cf37f5dde7152087621da19fce9655..7ed3f84da7efedd8d26970ee1c73ef499c73e963 100644 (file)
@@ -21,6 +21,7 @@
 #include "config/rcxml.h"
 #include "labwc.h"
 #include "node.h"
+#include "output.h"
 
 #define LAB_LAYERSHELL_VERSION 4
 
index 9fb5b264e8d264479e8e8050595f3bc5e1229931..49499211fbb7c43f1b3c9de58b45fb158c40ae8a 100644 (file)
@@ -7,6 +7,7 @@
 #include <wlr/util/transform.h>
 #include "common/box.h"
 #include "labwc.h"
+#include "output.h"
 #include "theme.h"
 
 static bool magnify_on;
index a44790eb1fba7a730e7b8f4259a28ca989615881..f8695a2a0a3f9e4264d59ea3b7422d2924ec7030 100644 (file)
@@ -26,6 +26,7 @@
 #include "common/spawn.h"
 #include "common/string-helpers.h"
 #include "labwc.h"
+#include "output.h"
 #include "workspaces.h"
 #include "view.h"
 #include "node.h"
index 0819e1e66f93594685689e07bb75b607afd54157..c27b9379d5dd85decb8509b7240f93aa6684f900 100644 (file)
@@ -9,6 +9,7 @@
 #include "labwc.h"
 #include "desktop-entry.h"
 #include "osd.h"
+#include "output.h"
 
 /* includes '%', terminating 's' and NULL byte, 8 is enough for %-9999s */
 #define LAB_FIELD_SINGLE_FMT_MAX_LEN 8
index 89ba415dab28ddcee4f49130822db2f95b813362..6ae3381de1f54e9a71c12c2d7717e26253343611 100644 (file)
--- a/src/osd.c
+++ b/src/osd.c
@@ -8,7 +8,6 @@
 #include "common/buf.h"
 #include "common/font.h"
 #include "common/lab-scene-rect.h"
-#include "common/macros.h"
 #include "common/scaled-font-buffer.h"
 #include "common/scaled-icon-buffer.h"
 #include "common/scene-helpers.h"
@@ -16,6 +15,7 @@
 #include "config/rcxml.h"
 #include "labwc.h"
 #include "node.h"
+#include "output.h"
 #include "theme.h"
 #include "view.h"
 #include "window-rules.h"
index 7ebcc19eae1c0227265c76e4ca4a121f80970633..7da1108becab70b070027e35d6a9931f6abe08f6 100644 (file)
@@ -3,7 +3,8 @@
 #include "output-state.h"
 #include <wlr/types/wlr_output.h>
 #include <wlr/types/wlr_output_management_v1.h>
-#include "labwc.h"
+#include <wlr/util/log.h>
+#include "output.h"
 
 void
 output_state_init(struct output *output)
index 888f832bc618eef913a0d0e78407bdb7abe27d0b..164be7b6f6ef63666b2af56e140db3ee6cd54849 100644 (file)
@@ -6,6 +6,7 @@
 #include <wlr/types/wlr_output.h>
 #include "common/string-helpers.h"
 #include "labwc.h"
+#include "output.h"
 
 static struct wlr_output *fallback_output = NULL;
 
index 3b4a26caacf94de84fbe7c24e27eab229654cce4..99c1b847ab1fe859348ca3cdc4fc0446f43c0ba0 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #define _POSIX_C_SOURCE 200809L
+#include "output.h"
 #include <assert.h>
 #include <strings.h>
 #include <wlr/backend/drm.h>
index 78a9c1724a5d0c483aec2a5749fd4c8682c5b2ed..cf7b96b1d3b123be066e80787fe47a828e5b017e 100644 (file)
@@ -3,6 +3,7 @@
 #include <assert.h>
 #include "common/lab-scene-rect.h"
 #include "labwc.h"
+#include "output.h"
 #include "view.h"
 #include "theme.h"
 
index c037703815bc278403030e191fd5f194786482a9..869bede3034ba9d84ec2006ce659fe147e0633a3 100644 (file)
@@ -3,10 +3,9 @@
 #include <assert.h>
 #include <limits.h>
 #include <stdbool.h>
-#include <stdio.h>
-#include "common/macros.h"
 #include "common/mem.h"
 #include "labwc.h"
+#include "output.h"
 #include "ssd.h"
 #include "view.h"
 
index 3463c97fddd23ed72f4c9fa121efad355993e3a3..26c1e6d78be79c45f11a1f74bfc25d261e2b1827 100644 (file)
@@ -13,6 +13,7 @@
 #include "common/mem.h"
 #include "input/keyboard.h"
 #include "labwc.h"
+#include "output.h"
 #include "view.h"
 
 bool
index 0beaf487724ba16273dc673d4c9f1f224c9339ce..1b3b7a3f1014b4989d4f1bef49b733ce9a692aad 100644 (file)
@@ -17,6 +17,7 @@
 #include "input/keyboard.h"
 #include "input/key-state.h"
 #include "labwc.h"
+#include "output.h"
 #include "view.h"
 
 static void
index 214885b1defa29266d6aaeeafeff1d2bc96540f9..ca24392af4c10a00abfddf5a5326533b8ee6cbe4 100644 (file)
@@ -47,6 +47,7 @@
 #include "layers.h"
 #include "magnifier.h"
 #include "menu/menu.h"
+#include "output.h"
 #include "output-state.h"
 #include "output-virtual.h"
 #include "regions.h"
index fe11856672d298977ce857ad06d47c014bf03ffa..1dce3b6a060b9d53d825341e17157b9353b866a5 100644 (file)
@@ -5,6 +5,7 @@
 #include "common/mem.h"
 #include "labwc.h"
 #include "node.h"
+#include "output.h"
 
 struct session_lock_output {
        struct wlr_scene_tree *tree;
index 4e8e1d4421552f6763d4b6a352ad307ab43e950d..7991d48c4dff270d5439288c6cc258f7d3503973 100644 (file)
@@ -1,12 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0-only
 #include "snap.h"
 #include <assert.h>
-#include <limits.h>
 #include <wlr/util/box.h>
 #include "common/border.h"
-#include "common/macros.h"
 #include "edges.h"
 #include "labwc.h"
+#include "output.h"
 #include "snap-constraints.h"
 #include "view.h"
 
index c2ff6d0c4a0cdc080f76d74b2a0d1baa82fd4edf..90f12ce6993d5201fe25ee1fcaa13ab294565894 100644 (file)
@@ -2,10 +2,10 @@
 
 #include <assert.h>
 #include <pixman.h>
-#include "common/mem.h"
 #include "common/scene-helpers.h"
 #include "config/rcxml.h"
 #include "labwc.h"
+#include "output.h"
 #include "ssd-internal.h"
 #include "theme.h"
 #include "view.h"
index 98c61d924323865b36331ccf09f584ff2b2f5a1d..45b87458167826af0ab79674278795fc79d2ce6c 100644 (file)
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 #include "view.h"
 #include <assert.h>
-#include <stdio.h>
 #include <strings.h>
 #include <wlr/types/wlr_output_layout.h>
 #include <wlr/types/wlr_security_context_v1.h>
@@ -9,16 +8,15 @@
 #include "buffer.h"
 #include "common/box.h"
 #include "common/list.h"
-#include "common/macros.h"
 #include "common/match.h"
 #include "common/mem.h"
-#include "common/parse-bool.h"
 #include "common/scene-helpers.h"
 #include "foreign-toplevel.h"
 #include "input/keyboard.h"
 #include "labwc.h"
 #include "menu/menu.h"
 #include "osd.h"
+#include "output.h"
 #include "output-state.h"
 #include "placement.h"
 #include "regions.h"
index fc1cd52468d883bf98dc17a5ced729fbc1db8d94..2057adf05b88431d8b9c3d7a08e22e407b81ec79 100644 (file)
@@ -8,7 +8,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
-#include "config.h"
 #include "buffer.h"
 #include "common/font.h"
 #include "common/graphic-helpers.h"
 #include "common/mem.h"
 #include "input/keyboard.h"
 #include "labwc.h"
+#include "output.h"
 #include "protocols/cosmic-workspaces.h"
 #include "protocols/ext-workspace.h"
 #include "view.h"
-#include "xwayland.h"
 
 #define COSMIC_WORKSPACES_VERSION 1
 #define EXT_WORKSPACES_VERSION 1
index d4daadd6f280e7b9e518dbcc6f6edbdf0df15011..23942b691167fcb1ca3497232cdd91147689e800 100644 (file)
@@ -11,6 +11,7 @@
 #include "common/mem.h"
 #include "labwc.h"
 #include "node.h"
+#include "output.h"
 #include "view.h"
 
 struct xdg_popup {
index be8cfc201790f9b4b2e68992b9fbc7a8abe9d020..f551c20445d5e9913fe2303cd80d2df68554fdf9 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -12,6 +12,7 @@
 #include "labwc.h"
 #include "menu/menu.h"
 #include "node.h"
+#include "output.h"
 #include "snap-constraints.h"
 #include "view.h"
 #include "view-impl-common.h"
index fae5b659ce940b67d028de0066e5cc0641f2464e..097fc73104eeba3e6d3f3e064c0cd4a6537db779 100644 (file)
@@ -13,6 +13,7 @@
 #include "foreign-toplevel.h"
 #include "labwc.h"
 #include "node.h"
+#include "output.h"
 #include "ssd.h"
 #include "view.h"
 #include "view-impl-common.h"