diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-08-02 18:48:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-02 18:48:09 -0400 |
commit | 1654fc80ebdc4c69d86cbb700ceeb49b8f090c62 (patch) | |
tree | 9973c182ff78d3758e9487166ca55dc58d006e86 /include | |
parent | 0780d7856a1ec2b6f3bcf2837cd5f697556c531e (diff) | |
parent | c3afe4f42e3ddfbd51500d99416b51aee552b689 (diff) |
Merge pull request #1157 from emersion/wlr-gamma-control
Implement wlr-gamma-control-unstable-v1
Diffstat (limited to 'include')
-rw-r--r-- | include/rootston/desktop.h | 2 | ||||
-rw-r--r-- | include/wlr/interfaces/wlr_output.h | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_gamma_control_v1.h | 31 | ||||
-rw-r--r-- | include/wlr/types/wlr_output.h | 14 |
4 files changed, 46 insertions, 3 deletions
diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index 51cf68db..363a16f0 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -4,6 +4,7 @@ #include <wayland-server.h> #include <wlr/config.h> #include <wlr/types/wlr_compositor.h> +#include <wlr/types/wlr_gamma_control_v1.h> #include <wlr/types/wlr_gamma_control.h> #include <wlr/types/wlr_idle_inhibit_v1.h> #include <wlr/types/wlr_idle.h> @@ -43,6 +44,7 @@ struct roots_desktop { struct wlr_xdg_shell_v6 *xdg_shell_v6; struct wlr_xdg_shell *xdg_shell; struct wlr_gamma_control_manager *gamma_control_manager; + struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1; struct wlr_screenshooter *screenshooter; struct wlr_export_dmabuf_manager_v1 *export_dmabuf_manager_v1; struct wlr_server_decoration_manager *server_decoration_manager; diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index 2224932f..4860a5b6 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -28,7 +28,7 @@ struct wlr_output_impl { void (*destroy)(struct wlr_output *output); bool (*make_current)(struct wlr_output *output, int *buffer_age); bool (*swap_buffers)(struct wlr_output *output, pixman_region32_t *damage); - void (*set_gamma)(struct wlr_output *output, + bool (*set_gamma)(struct wlr_output *output, uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b); uint32_t (*get_gamma_size)(struct wlr_output *output); bool (*export_dmabuf)(struct wlr_output *output, diff --git a/include/wlr/types/wlr_gamma_control_v1.h b/include/wlr/types/wlr_gamma_control_v1.h new file mode 100644 index 00000000..5a173323 --- /dev/null +++ b/include/wlr/types/wlr_gamma_control_v1.h @@ -0,0 +1,31 @@ +#ifndef WLR_TYPES_WLR_GAMMA_CONTROL_V1_H +#define WLR_TYPES_WLR_GAMMA_CONTROL_V1_H + +#include <wayland-server.h> + +struct wlr_gamma_control_manager_v1 { + struct wl_global *global; + struct wl_list resources; + struct wl_list controls; // wlr_gamma_control_v1::link + + struct wl_listener display_destroy; + + void *data; +}; + +struct wlr_gamma_control_v1 { + struct wl_resource *resource; + struct wlr_output *output; + struct wl_list link; + + struct wl_listener output_destroy_listener; + + void *data; +}; + +struct wlr_gamma_control_manager_v1 *wlr_gamma_control_manager_v1_create( + struct wl_display *display); +void wlr_gamma_control_manager_v1_destroy( + struct wlr_gamma_control_manager_v1 *manager); + +#endif diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index f8452d12..3a9f3c41 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -174,9 +174,19 @@ bool wlr_output_swap_buffers(struct wlr_output *output, struct timespec *when, * it is a no-op. */ void wlr_output_schedule_frame(struct wlr_output *output); -void wlr_output_set_gamma(struct wlr_output *output, - uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b); +/** + * Returns the maximum length of each gamma ramp, or 0 if unsupported. + */ uint32_t wlr_output_get_gamma_size(struct wlr_output *output); +/** + * Sets the gamma table for this output. `r`, `g` and `b` are gamma ramps for + * red, green and blue. `size` is the length of the ramps and must not exceed + * the value returned by `wlr_output_get_gamma_size`. + * + * Providing zero-sized ramps resets the gamma table. + */ +bool wlr_output_set_gamma(struct wlr_output *output, + uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b); bool wlr_output_export_dmabuf(struct wlr_output *output, struct wlr_dmabuf_attributes *attribs); void wlr_output_set_fullscreen_surface(struct wlr_output *output, |