add new-output handler

This commit is contained in:
Leon Henrik Plickat
2024-03-21 03:40:46 +01:00
parent a5b129d637
commit 744ce4b1eb
8 changed files with 116 additions and 2 deletions

View File

@@ -9,6 +9,7 @@
#include "seat.h"
#include "river-control-unstable-v1.h"
#include "call-new-output-handler.h"
/**
* ISO C forbids casting a function pointer to a void pointer because on some
@@ -77,7 +78,29 @@ static SCM install_handler (SCM key, SCM proc)
return SCM_UNSPECIFIED;
}
if ( scm_is_eq(scm_from_utf8_symbol("layout-demand"), key) == 1 )
if ( scm_is_eq(scm_from_utf8_symbol("new-output"), key) == 1 )
{
context.mode = CONTINOUS;
context.new_output_handler = proc;
/* Call handler for all already existing outputs. */
struct Output *output;
wl_list_for_each(output, &context.outputs, link)
{
struct Call_new_output_handler_parameters params = {
.output = output,
};
void *res = scm_with_guile(call_new_output_handler, (void *)&params);
if ( res != NULL )
{
fputs(res, stderr);
fputs("INFO: This error is not fatal.\n", stderr);
continue;
}
}
}
else if ( scm_is_eq(scm_from_utf8_symbol("layout-demand"), key) == 1 )
{
if ( context.layout_manager == NULL )
{