From 16fa2cad95d129e0b366f38e95ae6353f6234ce8 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Thu, 13 Mar 2025 08:47:20 +0800 Subject: [PATCH] opt: new impl for gamma controller --- maomao.c | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/maomao.c b/maomao.c index dc88fafe..a674bc99 100644 --- a/maomao.c +++ b/maomao.c @@ -348,7 +348,6 @@ struct Monitor { Client *sel, *prevsel; int isoverview; int is_in_hotarea; - int gamma_lut_changed; }; typedef struct { @@ -522,7 +521,6 @@ static void setup(void); static void sigchld(int unused); static void startdrag(struct wl_listener *listener, void *data); -static void setgamma(struct wl_listener *listener, void *data); static void tile(Monitor *m, unsigned int gappo, unsigned int uappi); static void overview(Monitor *m, unsigned int gappo, unsigned int gappi); static void grid(Monitor *m, unsigned int gappo, unsigned int uappi); @@ -620,7 +618,6 @@ static struct wlr_renderer *drw; static struct wlr_allocator *alloc; static struct wlr_compositor *compositor; -static struct wlr_gamma_control_manager_v1 *gamma_control_mgr; static struct wlr_xdg_shell *xdg_shell; static struct wlr_xdg_activation_v1 *activation; static struct wlr_xdg_decoration_manager_v1 *xdg_decoration_mgr; @@ -1182,26 +1179,6 @@ void clear_fullscreen_flag(Client *c) { } } -void // 升级忽略 -setgamma(struct wl_listener *listener, void *data) { - 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); -} - void minized(const Arg *arg) { if (selmon->sel && !selmon->sel->isminied) { set_minized(selmon->sel); @@ -5044,8 +5021,7 @@ void setup(void) { activation = wlr_xdg_activation_v1_create(dpy); wl_signal_add(&activation->events.request_activate, &request_activate); - gamma_control_mgr = wlr_gamma_control_manager_v1_create(dpy); - LISTEN_STATIC(&gamma_control_mgr->events.set_gamma, setgamma); + wlr_scene_set_gamma_control_manager_v1(scene, wlr_gamma_control_manager_v1_create(dpy)); /* Creates an output layout, which a wlroots utility for working with an * arrangement of screens in a physical layout. */ @@ -6157,10 +6133,6 @@ updatemons(struct wl_listener *listener, void *data) { if ((c = focustop(m)) && c->isfullscreen) resize(c, m->m, 0); - /* Try to re-set the gamma LUT when updating monitors, - * it's only really needed when enabling a disabled output, but meh. */ - m->gamma_lut_changed = 1; - config_head->state.x = m->m.x; config_head->state.y = m->m.y; if (!selmon) {