decompose wl_backend.c: extract wl_output_mgmt.c

This commit is contained in:
Window Maker 2026-06-02 16:09:42 +02:00
parent e3a8c5d74b
commit 84a2be36c3
3 changed files with 64 additions and 53 deletions

View File

@ -190,6 +190,7 @@ wmaker_SOURCES += \
backend/wayland/wl_grab.c \
backend/wayland/wl_keyboard.c \
backend/wayland/wl_popup.c \
backend/wayland/wl_output_mgmt.c \
backend/wayland/wl_output.c \
backend/wayland/wl_xdg.c \
backend/wayland/wl_xwayland.c \

View File

@ -327,9 +327,9 @@ static void handle_new_pointer_constraint(struct wl_listener *listener, void *da
/* Phase 31: new keyboard shortcuts inhibitor handler. */
static void handle_new_shortcuts_inhibitor(struct wl_listener *listener, void *data);
/* Phase 33: output management apply/test + output power set_mode handlers. */
static void handle_output_mgr_apply(struct wl_listener *listener, void *data);
static void handle_output_mgr_test(struct wl_listener *listener, void *data);
static void handle_output_power_set_mode(struct wl_listener *listener, void *data);
extern void handle_output_mgr_apply(struct wl_listener *listener, void *data);
extern void handle_output_mgr_test(struct wl_listener *listener, void *data);
extern void handle_output_power_set_mode(struct wl_listener *listener, void *data);
/* Phase 34: text input, input method, virtual keyboard new-instance handlers. */
static void handle_text_input_new(struct wl_listener *listener, void *data);
static void handle_input_method_new(struct wl_listener *listener, void *data);
@ -1702,56 +1702,6 @@ handle_new_shortcuts_inhibitor(struct wl_listener *listener, void *data)
}
/* ------------------------------------------------------------------ */
/* Phase 33: output management, output power, gamma control */
/* ------------------------------------------------------------------ */
/*
* handle_output_mgr_apply — client requests a randr-like output reconfiguration.
* For a single-output headless compositor there is nothing to reconfigure; just
* acknowledge success so the client does not hang waiting for feedback.
* The configuration object is compositor-owned and must be destroyed here.
*/
static void
handle_output_mgr_apply(struct wl_listener *listener, void *data)
{
(void)listener;
struct wlr_output_configuration_v1 *config = data;
wlr_output_configuration_v1_send_succeeded(config);
wlr_output_configuration_v1_destroy(config);
wwarning("wl_backend: output manager apply request — acknowledged (no-op)");
}
/*
* handle_output_mgr_test — client tests a configuration without applying it.
* Always report success (any single-output config is trivially valid).
*/
static void
handle_output_mgr_test(struct wl_listener *listener, void *data)
{
(void)listener;
struct wlr_output_configuration_v1 *config = data;
wlr_output_configuration_v1_send_succeeded(config);
wlr_output_configuration_v1_destroy(config);
}
/*
* handle_output_power_set_mode — client requests DPMS on/off.
* Apply the requested power state via wlr_output_enable + wlr_output_commit.
*/
static void
handle_output_power_set_mode(struct wl_listener *listener, void *data)
{
(void)listener;
struct wlr_output_power_v1_set_mode_event *ev = data;
bool enable = (ev->mode == ZWLR_OUTPUT_POWER_V1_MODE_ON);
struct wlr_output_state state;
wlr_output_state_init(&state);
wlr_output_state_set_enabled(&state, enable);
wlr_output_commit_state(ev->output, &state);
wlr_output_state_finish(&state);
wwarning("wl_backend: output power set_mode %s", enable ? "ON" : "OFF");
}
/* ------------------------------------------------------------------ */
/* Phase 34: text input v3, input method v2, virtual keyboard v1 */
/* ------------------------------------------------------------------ */

View File

@ -0,0 +1,60 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <wayland-server-core.h>
#include <wlr/types/wlr_output_management_v1.h>
#include <wlr/types/wlr_output_power_management_v1.h>
#include <wlr/types/wlr_output.h>
#include <wlr/util/log.h>
#include "wl_types.h"
/* Phase 33: output management, output power, gamma control */
/* ------------------------------------------------------------------ */
/*
* handle_output_mgr_apply — client requests a randr-like output reconfiguration.
* For a single-output headless compositor there is nothing to reconfigure; just
* acknowledge success so the client does not hang waiting for feedback.
* The configuration object is compositor-owned and must be destroyed here.
*/
void
handle_output_mgr_apply(struct wl_listener *listener, void *data)
{
(void)listener;
struct wlr_output_configuration_v1 *config = data;
wlr_output_configuration_v1_send_succeeded(config);
wlr_output_configuration_v1_destroy(config);
wwarning("wl_backend: output manager apply request — acknowledged (no-op)");
}
/*
* handle_output_mgr_test — client tests a configuration without applying it.
* Always report success (any single-output config is trivially valid).
*/
void
handle_output_mgr_test(struct wl_listener *listener, void *data)
{
(void)listener;
struct wlr_output_configuration_v1 *config = data;
wlr_output_configuration_v1_send_succeeded(config);
wlr_output_configuration_v1_destroy(config);
}
/*
* handle_output_power_set_mode — client requests DPMS on/off.
* Apply the requested power state via wlr_output_enable + wlr_output_commit.
*/
void
handle_output_power_set_mode(struct wl_listener *listener, void *data)
{
(void)listener;
struct wlr_output_power_v1_set_mode_event *ev = data;
bool enable = (ev->mode == ZWLR_OUTPUT_POWER_V1_MODE_ON);
struct wlr_output_state state;
wlr_output_state_init(&state);
wlr_output_state_set_enabled(&state, enable);
wlr_output_commit_state(ev->output, &state);
wlr_output_state_finish(&state);
wwarning("wl_backend: output power set_mode %s", enable ? "ON" : "OFF");
}