DisplayServer (Linux): updates kde-output-device-v2 again

This commit is contained in:
李通洲
2026-03-07 23:10:38 +08:00
committed by 李通洲
parent 22fa9b51e8
commit 9ba1cd1291
3 changed files with 200 additions and 6 deletions
@@ -14,6 +14,7 @@ extern "C" {
/**
* @page page_kde_output_device_v2 The kde_output_device_v2 protocol
* @section page_ifaces_kde_output_device_v2 Interfaces
* - @subpage page_iface_kde_output_device_registry_v2 - output devices
* - @subpage page_iface_kde_output_device_v2 - output configuration representation
* - @subpage page_iface_kde_output_device_mode_v2 - output mode
* @section page_copyright_kde_output_device_v2 Copyright
@@ -29,8 +30,32 @@ extern "C" {
* </pre>
*/
struct kde_output_device_mode_v2;
struct kde_output_device_registry_v2;
struct kde_output_device_v2;
#ifndef KDE_OUTPUT_DEVICE_REGISTRY_V2_INTERFACE
#define KDE_OUTPUT_DEVICE_REGISTRY_V2_INTERFACE
/**
* @page page_iface_kde_output_device_registry_v2 kde_output_device_registry_v2
* @section page_iface_kde_output_device_registry_v2_desc Description
*
* This interface can be used to list output devices.
*
* If this global is bound with a version less than 21, the unsupported_version
* protocol error will be posted.
* @section page_iface_kde_output_device_registry_v2_api API
* See @ref iface_kde_output_device_registry_v2.
*/
/**
* @defgroup iface_kde_output_device_registry_v2 The kde_output_device_registry_v2 interface
*
* This interface can be used to list output devices.
*
* If this global is bound with a version less than 21, the unsupported_version
* protocol error will be posted.
*/
extern const struct wl_interface kde_output_device_registry_v2_interface;
#endif
#ifndef KDE_OUTPUT_DEVICE_V2_INTERFACE
#define KDE_OUTPUT_DEVICE_V2_INTERFACE
/**
@@ -120,6 +145,119 @@ extern const struct wl_interface kde_output_device_v2_interface;
extern const struct wl_interface kde_output_device_mode_v2_interface;
#endif
#ifndef KDE_OUTPUT_DEVICE_REGISTRY_V2_ERROR_ENUM
#define KDE_OUTPUT_DEVICE_REGISTRY_V2_ERROR_ENUM
/**
* @ingroup iface_kde_output_device_registry_v2
* kde_output_device_registry_v2 error values
*
* These errors can be emitted in response to some requests.
*/
enum kde_output_device_registry_v2_error {
/**
* the registry was bound with an unsupported version
*/
KDE_OUTPUT_DEVICE_REGISTRY_V2_ERROR_UNSUPPORTED_VERSION = 0,
};
#endif /* KDE_OUTPUT_DEVICE_REGISTRY_V2_ERROR_ENUM */
/**
* @ingroup iface_kde_output_device_registry_v2
* @struct kde_output_device_registry_v2_listener
*/
struct kde_output_device_registry_v2_listener {
/**
* no new output announcements
*
* This event is sent in response to the stop request. The
* compositor will immediately destroy the object after sending
* this event.
* @since 21
*/
void (*finished)(void *data,
struct kde_output_device_registry_v2 *kde_output_device_registry_v2);
/**
* new available output
*
* This event is sent when a new output is connected or after
* binding this global to list all available outputs.
* @since 21
*/
void (*output)(void *data,
struct kde_output_device_registry_v2 *kde_output_device_registry_v2,
struct kde_output_device_v2 *output);
};
/**
* @ingroup iface_kde_output_device_registry_v2
*/
static inline int
kde_output_device_registry_v2_add_listener(struct kde_output_device_registry_v2 *kde_output_device_registry_v2,
const struct kde_output_device_registry_v2_listener *listener, void *data)
{
return wl_proxy_add_listener((struct wl_proxy *) kde_output_device_registry_v2,
(void (**)(void)) listener, data);
}
#define KDE_OUTPUT_DEVICE_REGISTRY_V2_STOP 0
/**
* @ingroup iface_kde_output_device_registry_v2
*/
#define KDE_OUTPUT_DEVICE_REGISTRY_V2_FINISHED_SINCE_VERSION 21
/**
* @ingroup iface_kde_output_device_registry_v2
*/
#define KDE_OUTPUT_DEVICE_REGISTRY_V2_OUTPUT_SINCE_VERSION 21
/**
* @ingroup iface_kde_output_device_registry_v2
*/
#define KDE_OUTPUT_DEVICE_REGISTRY_V2_STOP_SINCE_VERSION 21
/** @ingroup iface_kde_output_device_registry_v2 */
static inline void
kde_output_device_registry_v2_set_user_data(struct kde_output_device_registry_v2 *kde_output_device_registry_v2, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) kde_output_device_registry_v2, user_data);
}
/** @ingroup iface_kde_output_device_registry_v2 */
static inline void *
kde_output_device_registry_v2_get_user_data(struct kde_output_device_registry_v2 *kde_output_device_registry_v2)
{
return wl_proxy_get_user_data((struct wl_proxy *) kde_output_device_registry_v2);
}
static inline uint32_t
kde_output_device_registry_v2_get_version(struct kde_output_device_registry_v2 *kde_output_device_registry_v2)
{
return wl_proxy_get_version((struct wl_proxy *) kde_output_device_registry_v2);
}
/** @ingroup iface_kde_output_device_registry_v2 */
static inline void
kde_output_device_registry_v2_destroy(struct kde_output_device_registry_v2 *kde_output_device_registry_v2)
{
wl_proxy_destroy((struct wl_proxy *) kde_output_device_registry_v2);
}
/**
* @ingroup iface_kde_output_device_registry_v2
*
* This request indicates that the client no longer wants to receive new
* output announcements. The compositor will send the
* kde_output_device_registry_v2.finished event in response to this request.
* The compositor may still send new output announcements after calling this
* request until the kde_output_device_registry_v2.finished event is sent.
*/
static inline void
kde_output_device_registry_v2_stop(struct kde_output_device_registry_v2 *kde_output_device_registry_v2)
{
wl_proxy_marshal_flags((struct wl_proxy *) kde_output_device_registry_v2,
KDE_OUTPUT_DEVICE_REGISTRY_V2_STOP, NULL, wl_proxy_get_version((struct wl_proxy *) kde_output_device_registry_v2), 0);
}
#ifndef KDE_OUTPUT_DEVICE_V2_SUBPIXEL_ENUM
#define KDE_OUTPUT_DEVICE_V2_SUBPIXEL_ENUM
/**
@@ -838,6 +976,16 @@ struct kde_output_device_v2_listener {
void (*auto_brightness)(void *data,
struct kde_output_device_v2 *kde_output_device_v2,
uint32_t enabled);
/**
* the output has been removed
*
* This event is sent when the output device is disconnected and
* no new updates will be sent. The client should call the
* kde_output_device_v2.release request after receiving this event.
* @since 21
*/
void (*removed)(void *data,
struct kde_output_device_v2 *kde_output_device_v2);
};
/**
@@ -851,6 +999,8 @@ kde_output_device_v2_add_listener(struct kde_output_device_v2 *kde_output_device
(void (**)(void)) listener, data);
}
#define KDE_OUTPUT_DEVICE_V2_RELEASE 0
/**
* @ingroup iface_kde_output_device_v2
*/
@@ -995,7 +1145,15 @@ 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_AUTO_BRIGHTNESS_SINCE_VERSION 20
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_REMOVED_SINCE_VERSION 21
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_RELEASE_SINCE_VERSION 21
/** @ingroup iface_kde_output_device_v2 */
static inline void
@@ -1024,6 +1182,19 @@ 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
*
* This notifies the compositor that the client no longer wishes to use
* the kde_output_device_v2 object.
*/
static inline void
kde_output_device_v2_release(struct kde_output_device_v2 *kde_output_device_v2)
{
wl_proxy_marshal_flags((struct wl_proxy *) kde_output_device_v2,
KDE_OUTPUT_DEVICE_V2_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) kde_output_device_v2), WL_MARSHAL_FLAG_DESTROY);
}
#ifndef KDE_OUTPUT_DEVICE_MODE_V2_FLAGS_ENUM
#define KDE_OUTPUT_DEVICE_MODE_V2_FLAGS_ENUM
/**
@@ -18,6 +18,7 @@
#include <wayland-util.h>
extern const struct wl_interface kde_output_device_mode_v2_interface;
extern const struct wl_interface kde_output_device_v2_interface;
static const struct wl_interface *kde_output_device_v2_types[] = {
NULL,
@@ -28,14 +29,34 @@ static const struct wl_interface *kde_output_device_v2_types[] = {
NULL,
NULL,
NULL,
&kde_output_device_v2_interface,
&kde_output_device_mode_v2_interface,
&kde_output_device_mode_v2_interface,
};
static const struct wl_message kde_output_device_registry_v2_requests[] = {
{ "stop", "21", kde_output_device_v2_types + 0 },
};
static const struct wl_message kde_output_device_registry_v2_events[] = {
{ "finished", "21", kde_output_device_v2_types + 0 },
{ "output", "21n", kde_output_device_v2_types + 8 },
};
WL_EXPORT const struct wl_interface kde_output_device_registry_v2_interface = {
"kde_output_device_registry_v2", 21,
1, kde_output_device_registry_v2_requests,
2, kde_output_device_registry_v2_events,
};
static const struct wl_message kde_output_device_v2_requests[] = {
{ "release", "21", kde_output_device_v2_types + 0 },
};
static const struct wl_message kde_output_device_v2_events[] = {
{ "geometry", "iiiiissi", kde_output_device_v2_types + 0 },
{ "current_mode", "o", kde_output_device_v2_types + 8 },
{ "mode", "n", kde_output_device_v2_types + 9 },
{ "current_mode", "o", kde_output_device_v2_types + 9 },
{ "mode", "n", kde_output_device_v2_types + 10 },
{ "done", "", kde_output_device_v2_types + 0 },
{ "scale", "f", kde_output_device_v2_types + 0 },
{ "edid", "s", kde_output_device_v2_types + 0 },
@@ -69,12 +90,13 @@ static const struct wl_message kde_output_device_v2_events[] = {
{ "sharpness", "17u", kde_output_device_v2_types + 0 },
{ "priority", "18u", kde_output_device_v2_types + 0 },
{ "auto_brightness", "20u", kde_output_device_v2_types + 0 },
{ "removed", "21", kde_output_device_v2_types + 0 },
};
WL_EXPORT const struct wl_interface kde_output_device_v2_interface = {
"kde_output_device_v2", 20,
0, NULL,
36, kde_output_device_v2_events,
"kde_output_device_v2", 21,
1, kde_output_device_v2_requests,
37, kde_output_device_v2_events,
};
static const struct wl_message kde_output_device_mode_v2_events[] = {
@@ -86,7 +108,7 @@ static const struct wl_message kde_output_device_mode_v2_events[] = {
};
WL_EXPORT const struct wl_interface kde_output_device_mode_v2_interface = {
"kde_output_device_mode_v2", 20,
"kde_output_device_mode_v2", 21,
0, NULL,
5, kde_output_device_mode_v2_events,
};
@@ -181,6 +181,7 @@ static struct kde_output_device_v2_listener outputListener = {
.sharpness = (void*) stubListener,
.priority = (void*) stubListener,
.auto_brightness = (void*) stubListener,
.removed = (void*) stubListener,
};
const char* ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version)