mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
Add fallback output
This commit is contained in:
parent
551feaca0a
commit
97906cb6a2
2 changed files with 38 additions and 0 deletions
|
|
@ -337,6 +337,9 @@ struct server {
|
||||||
|
|
||||||
struct menu *menu_current;
|
struct menu *menu_current;
|
||||||
struct wl_list menus;
|
struct wl_list menus;
|
||||||
|
|
||||||
|
struct wl_event_source *destroy_timeout;
|
||||||
|
bool fallback_output;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LAB_NR_LAYERS (4)
|
#define LAB_NR_LAYERS (4)
|
||||||
|
|
|
||||||
35
src/output.c
35
src/output.c
|
|
@ -141,6 +141,10 @@ output_destroy_notify(struct wl_listener *listener, void *data)
|
||||||
* destroyed automatically when the wlr_output is destroyed
|
* destroyed automatically when the wlr_output is destroyed
|
||||||
*/
|
*/
|
||||||
free(output);
|
free(output);
|
||||||
|
|
||||||
|
if (server->fallback_output && wl_list_length(&server->outputs) == 0) {
|
||||||
|
output_add_virtual(server, "HEADLESS");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -191,6 +195,16 @@ add_output_to_layout(struct server *server, struct output *output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
handle_virtual_output_destroy_timeout(void *data)
|
||||||
|
{
|
||||||
|
struct server *server = data;
|
||||||
|
output_remove_virtual(server, "HEADLESS");
|
||||||
|
wl_event_source_remove(server->destroy_timeout);
|
||||||
|
server->destroy_timeout = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
new_output_notify(struct wl_listener *listener, void *data)
|
new_output_notify(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
|
@ -354,6 +368,19 @@ new_output_notify(struct wl_listener *listener, void *data)
|
||||||
server->pending_output_layout_change--;
|
server->pending_output_layout_change--;
|
||||||
do_output_layout_change(server);
|
do_output_layout_change(server);
|
||||||
seat_output_layout_changed(&output->server->seat);
|
seat_output_layout_changed(&output->server->seat);
|
||||||
|
|
||||||
|
if (server->fallback_output && wl_list_length(&server->outputs) > 1) {
|
||||||
|
/* libwayland has a bug when a global is created and
|
||||||
|
* immediately destroyed, as clients don't have enough time
|
||||||
|
* to bind it, so the virtual output is destroyed on a timer.
|
||||||
|
*/
|
||||||
|
if (!server->destroy_timeout) {
|
||||||
|
server->destroy_timeout =
|
||||||
|
wl_event_loop_add_timer(server->wl_event_loop,
|
||||||
|
handle_virtual_output_destroy_timeout, server);
|
||||||
|
}
|
||||||
|
wl_event_source_timer_update(server->destroy_timeout, 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -388,6 +415,14 @@ output_init(struct server *server)
|
||||||
wl_list_init(&server->outputs);
|
wl_list_init(&server->outputs);
|
||||||
|
|
||||||
output_manager_init(server);
|
output_manager_init(server);
|
||||||
|
|
||||||
|
if (getenv("LABWC_FALLBACK_OUTPUT")) {
|
||||||
|
output_add_virtual(server, "HEADLESS");
|
||||||
|
server->destroy_timeout = NULL;
|
||||||
|
server->fallback_output = true;
|
||||||
|
} else {
|
||||||
|
server->fallback_output = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue