Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for color-management-v1 #8548

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pcre2 = dependency('libpcre2-8')
wayland_server = dependency('wayland-server', version: '>=1.21.0')
wayland_client = dependency('wayland-client')
wayland_cursor = dependency('wayland-cursor')
wayland_protos = dependency('wayland-protocols', version: '>=1.24', default_options: ['tests=false'])
wayland_protos = dependency('wayland-protocols', version: '>=1.41', default_options: ['tests=false'])
xkbcommon = dependency('xkbcommon', version: '>=1.5.0')
cairo = dependency('cairo')
pango = dependency('pango')
Expand Down
1 change: 1 addition & 0 deletions protocols/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ wayland_scanner = find_program(
protocols = [
wl_protocol_dir / 'stable/tablet/tablet-v2.xml',
wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
wl_protocol_dir / 'staging/color-management/color-management-v1.xml',
wl_protocol_dir / 'staging/content-type/content-type-v1.xml',
wl_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml',
wl_protocol_dir / 'staging/ext-foreign-toplevel-list/ext-foreign-toplevel-list-v1.xml',
Expand Down
25 changes: 25 additions & 0 deletions sway/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_alpha_modifier_v1.h>
#include <wlr/types/wlr_color_management_v1.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_content_type_v1.h>
#include <wlr/types/wlr_cursor_shape_v1.h>
Expand Down Expand Up @@ -411,6 +412,30 @@ bool server_init(struct sway_server *server) {
server->request_set_cursor_shape.notify = handle_request_set_cursor_shape;
wl_signal_add(&cursor_shape_manager->events.request_set_shape, &server->request_set_cursor_shape);

const enum wp_color_manager_v1_render_intent render_intents[] = {
WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL,
};
const enum wp_color_manager_v1_transfer_function transfer_functions[] = {
WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB,
WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ,
};
const enum wp_color_manager_v1_primaries primaries[] = {
WP_COLOR_MANAGER_V1_PRIMARIES_SRGB,
WP_COLOR_MANAGER_V1_PRIMARIES_BT2020,
};
wlr_color_manager_v1_create(server->wl_display, 1, &(struct wlr_color_manager_v1_options){
.features = {
.parametric = true,
.set_mastering_display_primaries = true,
},
.render_intents = render_intents,
.render_intents_len = sizeof(render_intents) / sizeof(render_intents[0]),
.transfer_functions = transfer_functions,
.transfer_functions_len = sizeof(transfer_functions) / sizeof(transfer_functions[0]),
.primaries = primaries,
.primaries_len = sizeof(primaries) / sizeof(primaries[0]),
});

wl_list_init(&server->pending_launcher_ctxs);

// Avoid using "wayland-0" as display socket
Expand Down