mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-03-24 09:06:13 -04:00
feat: support gamma controller
optimize format
This commit is contained in:
parent
360e259ca5
commit
2408bbb931
3 changed files with 28 additions and 5 deletions
25
seat.c
25
seat.c
|
|
@ -23,6 +23,7 @@
|
|||
#include <wlr/types/wlr_idle_notify_v1.h>
|
||||
#include <wlr/types/wlr_keyboard_group.h>
|
||||
#include <wlr/types/wlr_primary_selection.h>
|
||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
||||
#include <wlr/types/wlr_relative_pointer_v1.h>
|
||||
#include <wlr/types/wlr_scene.h>
|
||||
#include <wlr/types/wlr_seat.h>
|
||||
|
|
@ -407,6 +408,28 @@ handle_new_keyboard(struct cg_seat *seat, struct wlr_keyboard *keyboard, bool vi
|
|||
wlr_seat_set_keyboard(seat->seat, keyboard);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_gamma(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct cg_server *server = wl_container_of(listener, server, set_gamma);
|
||||
struct wlr_gamma_control_manager_v1_set_gamma_event *event = data;
|
||||
struct wlr_output_state state;
|
||||
wlr_output_state_init(&state);
|
||||
if (!wlr_gamma_control_v1_apply(event->control, &state)) {
|
||||
wlr_output_state_finish(&state);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wlr_output_test_state(event->output, &state)) {
|
||||
wlr_gamma_control_v1_send_failed_and_destroy(event->control);
|
||||
wlr_output_state_finish(&state);
|
||||
return;
|
||||
}
|
||||
|
||||
wlr_output_commit_state(event->output, &state);
|
||||
wlr_output_schedule_frame(event->output);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_virtual_keyboard(struct wl_listener *listener, void *data)
|
||||
{
|
||||
|
|
@ -871,6 +894,8 @@ seat_create(struct cg_server *server, struct wlr_backend *backend)
|
|||
seat->new_input.notify = handle_new_input;
|
||||
wl_signal_add(&backend->events.new_input, &seat->new_input);
|
||||
|
||||
server->set_gamma.notify = handle_set_gamma;
|
||||
|
||||
server->new_virtual_keyboard.notify = handle_virtual_keyboard;
|
||||
server->new_virtual_pointer.notify = handle_virtual_pointer;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue