src/output.c: refactor virtual output related functions

This commit moves the virtual output related functions
into their own file at `src/output-virtual.c` with its
own include file to reduce `include/labwc.h` bit by bit.

Additionally, it removes the need to keep the
`server->headless.pending_output_name` char array around
by temporarily disconnecting the handler when creating a
new virtual output. This allows to set the output name
right in the `output_virtual_add()` call rather than to
store the pending name until the new output event handler
has been called.

It also makes adding a virtual fallback output easier in
a follow-up PR.
This commit is contained in:
Consolatis 2024-03-07 00:22:51 +01:00 committed by Johan Malm
parent 40ce95a68c
commit 95e8573388
6 changed files with 132 additions and 65 deletions

View file

@ -16,6 +16,7 @@
#include "debug.h"
#include "labwc.h"
#include "menu/menu.h"
#include "output-virtual.h"
#include "placement.h"
#include "regions.h"
#include "ssd.h"
@ -996,14 +997,15 @@ actions_run(struct view *activator, struct server *server,
{
const char *output_name = action_get_str(action, "output_name",
NULL);
output_add_virtual(server, output_name);
output_virtual_add(server, output_name,
/*store_wlr_output*/ NULL);
}
break;
case ACTION_TYPE_VIRTUAL_OUTPUT_REMOVE:
{
const char *output_name = action_get_str(action, "output_name",
NULL);
output_remove_virtual(server, output_name);
output_virtual_remove(server, output_name);
}
break;
case ACTION_TYPE_AUTO_PLACE: