mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-22 14:35:57 +01:00
screencast: add linux_dmabuf to registry
This commit is contained in:
parent
e1e0f5e143
commit
b2c5a94e8c
3 changed files with 11 additions and 0 deletions
|
@ -103,6 +103,7 @@ struct xdpw_screencast_context {
|
|||
struct zwlr_screencopy_manager_v1 *screencopy_manager;
|
||||
struct zxdg_output_manager_v1 *xdg_output_manager;
|
||||
struct wl_shm *shm;
|
||||
struct zwp_linux_dmabuf_v1 *linux_dmabuf;
|
||||
|
||||
// gbm
|
||||
struct gbm_device *gbm;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#define XDG_OUTPUT_MANAGER_VERSION 3
|
||||
|
||||
#define LINUX_DMABUF_VERSION 3
|
||||
|
||||
struct xdpw_state;
|
||||
|
||||
int xdpw_wlr_screencopy_init(struct xdpw_state *state);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "wlr_screencast.h"
|
||||
|
||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||
#include "wlr-screencopy-unstable-v1-client-protocol.h"
|
||||
#include "xdg-output-unstable-v1-client-protocol.h"
|
||||
#include <fcntl.h>
|
||||
|
@ -582,6 +583,10 @@ static void wlr_registry_handle_add(void *data, struct wl_registry *reg,
|
|||
ctx->xdg_output_manager =
|
||||
wl_registry_bind(reg, id, &zxdg_output_manager_v1_interface, XDG_OUTPUT_MANAGER_VERSION);
|
||||
}
|
||||
if (strcmp(interface, zwp_linux_dmabuf_v1_interface.name) == 0) {
|
||||
logprint(DEBUG, "wlroots: |-- registered to interface %s (Version %u)", interface, LINUX_DMABUF_VERSION);
|
||||
ctx->linux_dmabuf = wl_registry_bind(reg, id, &zwp_linux_dmabuf_v1_interface, LINUX_DMABUF_VERSION);
|
||||
}
|
||||
}
|
||||
|
||||
static void wlr_registry_handle_remove(void *data, struct wl_registry *reg,
|
||||
|
@ -677,6 +682,9 @@ void xdpw_wlr_screencopy_finish(struct xdpw_screencast_context *ctx) {
|
|||
gbm_device_destroy(ctx->gbm);
|
||||
close(fd);
|
||||
}
|
||||
if (ctx->linux_dmabuf) {
|
||||
zwp_linux_dmabuf_v1_destroy(ctx->linux_dmabuf);
|
||||
}
|
||||
if (ctx->registry) {
|
||||
wl_registry_destroy(ctx->registry);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue