include: split output.h from labwc.h

This commit is contained in:
John Lindgren 2025-07-26 15:34:45 -04:00 committed by Johan Malm
parent 2f414a438b
commit e21fc065c4
32 changed files with 112 additions and 84 deletions

View 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);

81
include/output.h Normal file
View file

@ -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

View 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"

View 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 *

View 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"

View 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"

View 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"

View 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"

View 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"

View 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) \

View 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"

View file

@ -21,6 +21,7 @@
#include "config/rcxml.h"
#include "labwc.h"
#include "node.h"
#include "output.h"
#define LAB_LAYERSHELL_VERSION 4

View 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;

View 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"

View 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

View file

@ -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"

View 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)

View 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;

View file

@ -7,6 +7,7 @@
*/
#define _POSIX_C_SOURCE 200809L
#include "output.h"
#include <assert.h>
#include <strings.h>
#include <wlr/backend/drm.h>

View 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"

View 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"

View file

@ -13,6 +13,7 @@
#include "common/mem.h"
#include "input/keyboard.h"
#include "labwc.h"
#include "output.h"
#include "view.h"
bool

View 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

View 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"

View 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;

View 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"

View 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"

View 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"

View 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"
@ -16,10 +15,10 @@
#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

View file

@ -11,6 +11,7 @@
#include "common/mem.h"
#include "labwc.h"
#include "node.h"
#include "output.h"
#include "view.h"
struct xdg_popup {

View file

@ -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"

View 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"