mirror of
https://github.com/swaywm/sway.git
synced 2026-04-03 07:15:39 -04:00
sway: Add non-desktop-output type
Currently, when encountering a non-desktop display, sway offers the output for leasing and returns without storing it in a sway specific output type like `struct sway_output`. Additionally, running `swaymsg -t get_outputs` doesn't show non-desktop outputs. This commit stores the non-desktop outputs into a struct called `sway_output_non_desktop`, and adds them to a list on `sway_root`
This commit is contained in:
parent
1c368fbb5f
commit
c015db4a9f
5 changed files with 40 additions and 0 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#include "sway/output.h"
|
||||
#include "sway/tree/arrange.h"
|
||||
#include "sway/tree/workspace.h"
|
||||
#include "sway/server.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
|
|
@ -390,6 +391,33 @@ void output_get_box(struct sway_output *output, struct wlr_box *box) {
|
|||
box->height = output->height;
|
||||
}
|
||||
|
||||
static void handle_destroy_non_desktop(struct wl_listener *listener, void *data) {
|
||||
struct sway_output_non_desktop *output =
|
||||
wl_container_of(listener, output, destroy);
|
||||
|
||||
sway_log(SWAY_DEBUG, "Destroying non-desktop output '%s'", output->wlr_output->name);
|
||||
|
||||
int index = list_find(root->non_desktop_outputs, output);
|
||||
list_del(root->non_desktop_outputs, index);
|
||||
|
||||
wl_list_remove(&output->destroy.link);
|
||||
|
||||
free(output);
|
||||
}
|
||||
|
||||
struct sway_output_non_desktop *output_non_desktop_create(
|
||||
struct wlr_output *wlr_output) {
|
||||
struct sway_output_non_desktop *output =
|
||||
calloc(1, sizeof(struct sway_output_non_desktop));
|
||||
|
||||
output->wlr_output = wlr_output;
|
||||
|
||||
wl_signal_add(&wlr_output->events.destroy, &output->destroy);
|
||||
output->destroy.notify = handle_destroy_non_desktop;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
enum sway_container_layout output_get_default_layout(
|
||||
struct sway_output *output) {
|
||||
if (config->default_orientation != L_NONE) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue