mirror of
https://github.com/labwc/labwc.git
synced 2025-11-30 06:59:52 -05:00
We were only using it to allow quick bitset comparisons of sets of outputs (such as view->outputs). We can maintain our own bit IDs for this purpose and avoid using the private wlroots field. Note: from my reading of wlr_scene_output_create(), it appears to always take the lowest unused index, resulting in aggressive re-use of index values when outputs are disconnected and reconnected. I've tried to make re-use as infrequent as possible. This could theoretically reduce the chance of a mix-up in view_update_outputs(), although I'm not aware of any practical scenario where it matters. v2: prevent adding more than 64 outputs
93 lines
2.9 KiB
C
93 lines
2.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#ifndef LABWC_OUTPUT_H
|
|
#define LABWC_OUTPUT_H
|
|
|
|
#include <wlr/types/wlr_output.h>
|
|
#include "common/edge.h"
|
|
|
|
#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_list items; /* struct osd_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;
|
|
|
|
/*
|
|
* Unique power-of-two ID used in bitsets such as view->outputs.
|
|
* (This assumes there are never more than 64 outputs connected
|
|
* at once; wlr_scene_output has a similar limitation.)
|
|
*
|
|
* There's currently no attempt to maintain the same ID if the
|
|
* same physical output is disconnected and reconnected.
|
|
* However, IDs do get reused eventually if enough outputs are
|
|
* disconnected and connected again.
|
|
*/
|
|
uint64_t id_bit;
|
|
|
|
bool gamma_lut_changed;
|
|
};
|
|
|
|
#undef LAB_NR_LAYERS
|
|
|
|
void output_init(struct server *server);
|
|
void output_finish(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 lab_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);
|
|
|
|
/**
|
|
* Notifies whether a fullscreen view is displayed on the given output.
|
|
* Depending on user config, this may enable/disable adaptive sync.
|
|
*
|
|
* Does nothing if output is NULL or disabled.
|
|
*/
|
|
void output_set_has_fullscreen_view(struct output *output,
|
|
bool has_fullscreen_view);
|
|
|
|
#endif // LABWC_OUTPUT_H
|