Skip to content

Commit

Permalink
Merge pull request #88 from Shinyzenith/main
Browse files Browse the repository at this point in the history
[protocol] wlr_export_dmabuf_v1 bindings added.
  • Loading branch information
flacjacket authored Jun 5, 2022
2 parents 99de401 + 810e842 commit 54d3c4c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
36 changes: 34 additions & 2 deletions wlroots/ffi_build.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) 2018 Sean Vig

from pathlib import Path
import importlib.util
import os
import sys
from pathlib import Path

from cffi import FFI, VerificationError
from pywayland.ffi_build import ffi_builder as pywayland_ffi
Expand Down Expand Up @@ -384,6 +384,37 @@ def has_xwayland() -> bool:
void wlr_data_source_destroy(struct wlr_data_source *source);
"""

# types/wlr_export_dmabuf_v1.h
CDEF += """
struct wlr_export_dmabuf_manager_v1 {
struct wl_global *global;
struct wl_list frames; // wlr_export_dmabuf_frame_v1::link
struct wl_listener display_destroy;
struct {
struct wl_signal destroy;
} events;
...;
};
struct wlr_export_dmabuf_frame_v1 {
struct wl_resource *resource;
struct wlr_export_dmabuf_manager_v1 *manager;
struct wl_list link; // wlr_export_dmabuf_manager_v1::frames
struct wlr_output *output;
bool cursor_locked;
struct wl_listener output_commit;
...;
};
struct wlr_export_dmabuf_manager_v1 *wlr_export_dmabuf_manager_v1_create(
struct wl_display *display);
"""

# types/wlr_foreign_toplevel_management_v1.h
CDEF += """
struct wlr_foreign_toplevel_manager_v1 {
Expand Down Expand Up @@ -2352,10 +2383,11 @@ def has_xwayland() -> bool:
#include <wlr/backend/libinput.h>
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_data_control_v1.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
#include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_idle.h>
Expand Down
16 changes: 16 additions & 0 deletions wlroots/wlr_types/export_dmabuf_v1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2022 Aakash Sen Sharma

from pywayland.server import Display, Signal
from wlroots import Ptr, ffi, lib


class ExportDmabufManagerV1(Ptr):
def __init__(self, display: Display) -> None:
"""A `struct wlr_export_dmabuf_manager_v1`
:param display:
The wayland display
"""

self._ptr = lib.wlr_export_dmabuf_manager_v1_create(display._ptr)
self.destroy_event = Signal(ptr=ffi.addressof(self._ptr.events.destroy))

0 comments on commit 54d3c4c

Please sign in to comment.