mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
gamma-control-v1: introduce set_gamma event
This commit is contained in:
parent
1bf245e0fe
commit
70c1a57248
2 changed files with 23 additions and 0 deletions
|
@ -11,14 +11,21 @@ struct wlr_gamma_control_manager_v1 {
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
|
struct wl_signal set_gamma; // struct wlr_gamma_control_manager_v1_set_gamma_event
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct wlr_gamma_control_manager_v1_set_gamma_event {
|
||||||
|
struct wlr_output *output;
|
||||||
|
struct wlr_gamma_control_v1 *control; // may be NULL
|
||||||
|
};
|
||||||
|
|
||||||
struct wlr_gamma_control_v1 {
|
struct wlr_gamma_control_v1 {
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
struct wlr_output *output;
|
struct wlr_output *output;
|
||||||
|
struct wlr_gamma_control_manager_v1 *manager;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
|
|
||||||
uint16_t *table;
|
uint16_t *table;
|
||||||
|
|
|
@ -22,6 +22,9 @@ static void gamma_control_destroy(struct wlr_gamma_control_v1 *gamma_control) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_gamma_control_manager_v1 *manager = gamma_control->manager;
|
||||||
|
struct wlr_output *output = gamma_control->output;
|
||||||
|
|
||||||
wlr_output_set_gamma(gamma_control->output, 0, NULL, NULL, NULL);
|
wlr_output_set_gamma(gamma_control->output, 0, NULL, NULL, NULL);
|
||||||
// Gamma LUT will be applied on next output commit
|
// Gamma LUT will be applied on next output commit
|
||||||
wlr_output_schedule_frame(gamma_control->output);
|
wlr_output_schedule_frame(gamma_control->output);
|
||||||
|
@ -32,6 +35,11 @@ static void gamma_control_destroy(struct wlr_gamma_control_v1 *gamma_control) {
|
||||||
wl_list_remove(&gamma_control->link);
|
wl_list_remove(&gamma_control->link);
|
||||||
free(gamma_control->table);
|
free(gamma_control->table);
|
||||||
free(gamma_control);
|
free(gamma_control);
|
||||||
|
|
||||||
|
struct wlr_gamma_control_manager_v1_set_gamma_event event = {
|
||||||
|
.output = output,
|
||||||
|
};
|
||||||
|
wl_signal_emit_mutable(&manager->events.set_gamma, &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gamma_control_send_failed(
|
static void gamma_control_send_failed(
|
||||||
|
@ -142,6 +150,12 @@ static void gamma_control_handle_set_gamma(struct wl_client *client,
|
||||||
gamma_control_apply(gamma_control);
|
gamma_control_apply(gamma_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_gamma_control_manager_v1_set_gamma_event event = {
|
||||||
|
.output = gamma_control->output,
|
||||||
|
.control = gamma_control,
|
||||||
|
};
|
||||||
|
wl_signal_emit_mutable(&gamma_control->manager->events.set_gamma, &event);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
error_table:
|
error_table:
|
||||||
|
@ -208,6 +222,7 @@ static void gamma_control_manager_get_gamma_control(struct wl_client *client,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gamma_control->output = output;
|
gamma_control->output = output;
|
||||||
|
gamma_control->manager = manager;
|
||||||
gamma_control->resource = resource;
|
gamma_control->resource = resource;
|
||||||
wl_resource_set_user_data(resource, gamma_control);
|
wl_resource_set_user_data(resource, gamma_control);
|
||||||
|
|
||||||
|
@ -276,6 +291,7 @@ struct wlr_gamma_control_manager_v1 *wlr_gamma_control_manager_v1_create(
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_signal_init(&manager->events.destroy);
|
wl_signal_init(&manager->events.destroy);
|
||||||
|
wl_signal_init(&manager->events.set_gamma);
|
||||||
wl_list_init(&manager->controls);
|
wl_list_init(&manager->controls);
|
||||||
|
|
||||||
manager->display_destroy.notify = handle_display_destroy;
|
manager->display_destroy.notify = handle_display_destroy;
|
||||||
|
|
Loading…
Reference in a new issue