Skip to content

Commit

Permalink
DisplayServer (Linux): upgrade wayland protocol kde-output-device-v2
Browse files Browse the repository at this point in the history
Ref: #1504
  • Loading branch information
CarterLi committed Jan 12, 2025
1 parent 4e3673a commit 878e516
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* Generated by wayland-scanner 1.22.0 */
/* Generated by wayland-scanner 1.23.1 */

#ifndef KDE_OUTPUT_DEVICE_V2_CLIENT_PROTOCOL_H
#define KDE_OUTPUT_DEVICE_V2_CLIENT_PROTOCOL_H

#include <stdint.h>
#include <stddef.h>
#include <wayland-util.h>
#include "wayland-client.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -53,6 +53,11 @@ struct kde_output_device_v2;
* This object is published as global during start up for every available
* display devices, or when one later becomes available, for example by
* being hotplugged via a physical connector.
*
* Warning! The protocol described in this file is a desktop environment
* implementation detail. Regular clients must not use this protocol.
* Backward incompatible changes may be added without bumping the major
* version of the extension.
* @section page_iface_kde_output_device_v2_api API
* See @ref iface_kde_output_device_v2.
*/
Expand All @@ -75,6 +80,11 @@ struct kde_output_device_v2;
* This object is published as global during start up for every available
* display devices, or when one later becomes available, for example by
* being hotplugged via a physical connector.
*
* Warning! The protocol described in this file is a desktop environment
* implementation detail. Regular clients must not use this protocol.
* Backward incompatible changes may be added without bumping the major
* version of the extension.
*/
extern const struct wl_interface kde_output_device_v2_interface;
#endif
Expand Down Expand Up @@ -199,6 +209,11 @@ enum kde_output_device_v2_capability {
* @since 5
*/
KDE_OUTPUT_DEVICE_V2_CAPABILITY_ICC_PROFILE = 0x40,
/**
* if this outputdevice supports the brightness setting
* @since 9
*/
KDE_OUTPUT_DEVICE_V2_CAPABILITY_BRIGHTNESS = 0x80,
};
/**
* @ingroup iface_kde_output_device_v2
Expand All @@ -216,6 +231,10 @@ enum kde_output_device_v2_capability {
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_CAPABILITY_ICC_PROFILE_SINCE_VERSION 5
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_CAPABILITY_BRIGHTNESS_SINCE_VERSION 9
#endif /* KDE_OUTPUT_DEVICE_V2_CAPABILITY_ENUM */

#ifndef KDE_OUTPUT_DEVICE_V2_VRR_POLICY_ENUM
Expand Down Expand Up @@ -274,6 +293,29 @@ enum kde_output_device_v2_color_profile_source {
};
#endif /* KDE_OUTPUT_DEVICE_V2_COLOR_PROFILE_SOURCE_ENUM */

#ifndef KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_ENUM
#define KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_ENUM
/**
* @ingroup iface_kde_output_device_v2
* tradeoff between power and accuracy
*
* The compositor can do a lot of things that trade between
* performance, power and color accuracy. This setting describes
* a high level preference from the user about in which direction
* that tradeoff should be made.
*/
enum kde_output_device_v2_color_power_tradeoff {
/**
* prefer efficiency and performance
*/
KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_EFFICIENCY = 0,
/**
* prefer accuracy
*/
KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_ACCURACY = 1,
};
#endif /* KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_ENUM */

/**
* @ingroup iface_kde_output_device_v2
* @struct kde_output_device_v2_listener
Expand Down Expand Up @@ -514,7 +556,7 @@ struct kde_output_device_v2_listener {
/**
* describes when auto rotate is used
*
*
*
* @since 4
*/
void (*auto_rotate_policy)(void *data,
Expand All @@ -523,7 +565,7 @@ struct kde_output_device_v2_listener {
/**
* describes when auto rotate is used
*
*
*
* @since 5
*/
void (*icc_profile_path)(void *data,
Expand All @@ -532,7 +574,7 @@ struct kde_output_device_v2_listener {
/**
* metadata about the screen's brightness limits
*
*
*
* @param max_peak_brightness in nits
* @param max_frame_average_brightness in nits
* @param min_brightness in 0.0001 nits
Expand All @@ -546,7 +588,7 @@ struct kde_output_device_v2_listener {
/**
* overrides for the screen's brightness limits
*
*
*
* @param max_peak_brightness -1 for no override, positive values are the brightness in nits
* @param max_average_brightness -1 for no override, positive values are the brightness in nits
* @param min_brightness -1 for no override, positive values are the brightness in 0.0001 nits
Expand All @@ -572,7 +614,7 @@ struct kde_output_device_v2_listener {
/**
* describes which source the compositor uses for the color profile on an output
*
*
*
* @since 7
*/
void (*color_profile_source)(void *data,
Expand All @@ -593,6 +635,29 @@ struct kde_output_device_v2_listener {
void (*brightness)(void *data,
struct kde_output_device_v2 *kde_output_device_v2,
uint32_t brightness);
/**
* the preferred color/power tradeoff
*
*
* @since 10
*/
void (*color_power_tradeoff)(void *data,
struct kde_output_device_v2 *kde_output_device_v2,
uint32_t preference);
/**
* dimming multiplier
*
* This is the dimming multiplier of the output. This is similar
* to the brightness setting, except it's meant to be a temporary
* setting only, not persistent and may be implemented differently
* depending on the display. 0 is the minimum dimming factor (not
* completely dark) and 10000 means the output is not dimmed.
* @param multiplier multiplier in 0-10000
* @since 11
*/
void (*dimming)(void *data,
struct kde_output_device_v2 *kde_output_device_v2,
uint32_t multiplier);
};

/**
Expand Down Expand Up @@ -706,34 +771,42 @@ kde_output_device_v2_add_listener(struct kde_output_device_v2 *kde_output_device
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_BRIGHTNESS_SINCE_VERSION 8
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_SINCE_VERSION 10
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_DIMMING_SINCE_VERSION 11


// /** @ingroup iface_kde_output_device_v2 */
// static inline void
// kde_output_device_v2_set_user_data(struct kde_output_device_v2 *kde_output_device_v2, void *user_data)
// {
// wl_proxy_set_user_data((struct wl_proxy *) kde_output_device_v2, user_data);
// }
/** @ingroup iface_kde_output_device_v2 */
static inline void
kde_output_device_v2_set_user_data(struct kde_output_device_v2 *kde_output_device_v2, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) kde_output_device_v2, user_data);
}

// /** @ingroup iface_kde_output_device_v2 */
// static inline void *
// kde_output_device_v2_get_user_data(struct kde_output_device_v2 *kde_output_device_v2)
// {
// return wl_proxy_get_user_data((struct wl_proxy *) kde_output_device_v2);
// }
/** @ingroup iface_kde_output_device_v2 */
static inline void *
kde_output_device_v2_get_user_data(struct kde_output_device_v2 *kde_output_device_v2)
{
return wl_proxy_get_user_data((struct wl_proxy *) kde_output_device_v2);
}

// static inline uint32_t
// kde_output_device_v2_get_version(struct kde_output_device_v2 *kde_output_device_v2)
// {
// return wl_proxy_get_version((struct wl_proxy *) kde_output_device_v2);
// }
static inline uint32_t
kde_output_device_v2_get_version(struct kde_output_device_v2 *kde_output_device_v2)
{
return wl_proxy_get_version((struct wl_proxy *) kde_output_device_v2);
}

// /** @ingroup iface_kde_output_device_v2 */
// static inline void
// kde_output_device_v2_destroy(struct kde_output_device_v2 *kde_output_device_v2)
// {
// wl_proxy_destroy((struct wl_proxy *) kde_output_device_v2);
// }
/** @ingroup iface_kde_output_device_v2 */
static inline void
kde_output_device_v2_destroy(struct kde_output_device_v2 *kde_output_device_v2)
{
wl_proxy_destroy((struct wl_proxy *) kde_output_device_v2);
}

/**
* @ingroup iface_kde_output_device_mode_v2
Expand Down Expand Up @@ -811,32 +884,32 @@ kde_output_device_mode_v2_add_listener(struct kde_output_device_mode_v2 *kde_out
#define KDE_OUTPUT_DEVICE_MODE_V2_REMOVED_SINCE_VERSION 1


// /** @ingroup iface_kde_output_device_mode_v2 */
// static inline void
// kde_output_device_mode_v2_set_user_data(struct kde_output_device_mode_v2 *kde_output_device_mode_v2, void *user_data)
// {
// wl_proxy_set_user_data((struct wl_proxy *) kde_output_device_mode_v2, user_data);
// }
/** @ingroup iface_kde_output_device_mode_v2 */
static inline void
kde_output_device_mode_v2_set_user_data(struct kde_output_device_mode_v2 *kde_output_device_mode_v2, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) kde_output_device_mode_v2, user_data);
}

// /** @ingroup iface_kde_output_device_mode_v2 */
// static inline void *
// kde_output_device_mode_v2_get_user_data(struct kde_output_device_mode_v2 *kde_output_device_mode_v2)
// {
// return wl_proxy_get_user_data((struct wl_proxy *) kde_output_device_mode_v2);
// }
/** @ingroup iface_kde_output_device_mode_v2 */
static inline void *
kde_output_device_mode_v2_get_user_data(struct kde_output_device_mode_v2 *kde_output_device_mode_v2)
{
return wl_proxy_get_user_data((struct wl_proxy *) kde_output_device_mode_v2);
}

// static inline uint32_t
// kde_output_device_mode_v2_get_version(struct kde_output_device_mode_v2 *kde_output_device_mode_v2)
// {
// return wl_proxy_get_version((struct wl_proxy *) kde_output_device_mode_v2);
// }
static inline uint32_t
kde_output_device_mode_v2_get_version(struct kde_output_device_mode_v2 *kde_output_device_mode_v2)
{
return wl_proxy_get_version((struct wl_proxy *) kde_output_device_mode_v2);
}

// /** @ingroup iface_kde_output_device_mode_v2 */
// static inline void
// kde_output_device_mode_v2_destroy(struct kde_output_device_mode_v2 *kde_output_device_mode_v2)
// {
// wl_proxy_destroy((struct wl_proxy *) kde_output_device_mode_v2);
// }
/** @ingroup iface_kde_output_device_mode_v2 */
static inline void
kde_output_device_mode_v2_destroy(struct kde_output_device_mode_v2 *kde_output_device_mode_v2)
{
wl_proxy_destroy((struct wl_proxy *) kde_output_device_mode_v2);
}

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifdef FF_HAVE_WAYLAND

/* Generated by wayland-scanner 1.22.0 */
/* Generated by wayland-scanner 1.23.1 */

/*
* SPDX-FileCopyrightText: 2008-2011 Kristian Høgsberg
Expand All @@ -12,6 +12,7 @@
* SPDX-License-Identifier: MIT-CMU
*/

#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <wayland-util.h>
Expand Down Expand Up @@ -57,12 +58,14 @@ static const struct wl_message kde_output_device_v2_events[] = {
{ "sdr_gamut_wideness", "6u", kde_output_device_v2_types + 0 },
{ "color_profile_source", "7u", kde_output_device_v2_types + 0 },
{ "brightness", "8u", kde_output_device_v2_types + 0 },
{ "color_power_tradeoff", "10u", kde_output_device_v2_types + 0 },
{ "dimming", "11u", kde_output_device_v2_types + 0 },
};

WL_EXPORT const struct wl_interface kde_output_device_v2_interface = {
"kde_output_device_v2", 8,
"kde_output_device_v2", 11,
0, NULL,
25, kde_output_device_v2_events,
27, kde_output_device_v2_events,
};

static const struct wl_message kde_output_device_mode_v2_events[] = {
Expand Down
2 changes: 2 additions & 0 deletions src/detection/displayserver/linux/wayland/kde-output.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ static struct kde_output_device_v2_listener outputListener = {
.sdr_gamut_wideness = (void*) stubListener,
.color_profile_source = (void*) stubListener,
.brightness = (void*) stubListener,
.color_power_tradeoff = (void*) stubListener,
.dimming = (void*) stubListener,
};

void ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version)
Expand Down

0 comments on commit 878e516

Please sign in to comment.