mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-22 14:35:57 +01:00
screenshot: Announce version property
This commit is contained in:
parent
94c45603b9
commit
c83b3cc514
4 changed files with 19 additions and 2 deletions
6
include/screenshot_common.h
Normal file
6
include/screenshot_common.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef SCREENSHOT_COMMON_H
|
||||||
|
#define SCREENSHOT_COMMON_H
|
||||||
|
|
||||||
|
#define XDP_SHOT_PROTO_VER 2
|
||||||
|
|
||||||
|
#endif
|
|
@ -11,6 +11,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "screencast_common.h"
|
#include "screencast_common.h"
|
||||||
|
#include "screenshot_common.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
struct xdpw_state {
|
struct xdpw_state {
|
||||||
|
@ -22,6 +23,7 @@ struct xdpw_state {
|
||||||
uint32_t screencast_source_types; // bitfield of enum source_types
|
uint32_t screencast_source_types; // bitfield of enum source_types
|
||||||
uint32_t screencast_cursor_modes; // bitfield of enum cursor_modes
|
uint32_t screencast_cursor_modes; // bitfield of enum cursor_modes
|
||||||
uint32_t screencast_version;
|
uint32_t screencast_version;
|
||||||
|
uint32_t screenshot_version;
|
||||||
struct xdpw_config *config;
|
struct xdpw_config *config;
|
||||||
int timer_poll_fd;
|
int timer_poll_fd;
|
||||||
struct wl_list timers;
|
struct wl_list timers;
|
||||||
|
|
|
@ -119,12 +119,18 @@ int main(int argc, char *argv[]) {
|
||||||
.screencast_source_types = MONITOR,
|
.screencast_source_types = MONITOR,
|
||||||
.screencast_cursor_modes = HIDDEN | EMBEDDED,
|
.screencast_cursor_modes = HIDDEN | EMBEDDED,
|
||||||
.screencast_version = XDP_CAST_PROTO_VER,
|
.screencast_version = XDP_CAST_PROTO_VER,
|
||||||
|
.screenshot_version = XDP_SHOT_PROTO_VER,
|
||||||
.config = &config,
|
.config = &config,
|
||||||
};
|
};
|
||||||
|
|
||||||
wl_list_init(&state.xdpw_sessions);
|
wl_list_init(&state.xdpw_sessions);
|
||||||
|
|
||||||
xdpw_screenshot_init(&state);
|
ret = xdpw_screenshot_init(&state);
|
||||||
|
if (ret < 0) {
|
||||||
|
logprint(ERROR, "xdpw: failed to initialize screenshot");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
ret = xdpw_screencast_init(&state);
|
ret = xdpw_screencast_init(&state);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
logprint(ERROR, "xdpw: failed to initialize screencast");
|
logprint(ERROR, "xdpw: failed to initialize screencast");
|
||||||
|
|
|
@ -286,6 +286,9 @@ static const sd_bus_vtable screenshot_vtable[] = {
|
||||||
SD_BUS_VTABLE_START(0),
|
SD_BUS_VTABLE_START(0),
|
||||||
SD_BUS_METHOD("Screenshot", "ossa{sv}", "ua{sv}", method_screenshot, SD_BUS_VTABLE_UNPRIVILEGED),
|
SD_BUS_METHOD("Screenshot", "ossa{sv}", "ua{sv}", method_screenshot, SD_BUS_VTABLE_UNPRIVILEGED),
|
||||||
SD_BUS_METHOD("PickColor", "ossa{sv}", "ua{sv}", method_pick_color, SD_BUS_VTABLE_UNPRIVILEGED),
|
SD_BUS_METHOD("PickColor", "ossa{sv}", "ua{sv}", method_pick_color, SD_BUS_VTABLE_UNPRIVILEGED),
|
||||||
|
SD_BUS_PROPERTY("version", "u", NULL,
|
||||||
|
offsetof(struct xdpw_state, screenshot_version),
|
||||||
|
SD_BUS_VTABLE_PROPERTY_CONST),
|
||||||
SD_BUS_VTABLE_END
|
SD_BUS_VTABLE_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -293,5 +296,5 @@ int xdpw_screenshot_init(struct xdpw_state *state) {
|
||||||
// TODO: cleanup
|
// TODO: cleanup
|
||||||
sd_bus_slot *slot = NULL;
|
sd_bus_slot *slot = NULL;
|
||||||
return sd_bus_add_object_vtable(state->bus, &slot, object_path, interface_name,
|
return sd_bus_add_object_vtable(state->bus, &slot, object_path, interface_name,
|
||||||
screenshot_vtable, NULL);
|
screenshot_vtable, state);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue