diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-12 10:53:22 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-12 10:53:22 +0300 |
| commit | 5206933399775e5ff46baefbbb3a776c2a9bb84c (patch) | |
| tree | e7549216ac626c1f3ac22345f79fbf80cc5a90fb /src/common/native.c | |
| parent | 881fb6cb1d64868132287bd9637f4ae1cbc3504c (diff) | |
feat: add type-safe native platform headers and portable drag support
- Add include/yasl/native/{wayland,cocoa,x11}.h with type-safe handle accessors.
- Unify drag-and-drop and window carry support across Wayland, X11, and Cocoa.
- Preserve full ABI compatibility for capability flags.
- Install native headers conditionally based on enabled backend.
- Include missing tablet example and backend test suites.
Diffstat (limited to 'src/common/native.c')
| -rw-r--r-- | src/common/native.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/common/native.c b/src/common/native.c index 2d9c06f..6e1c69a 100644 --- a/src/common/native.c +++ b/src/common/native.c @@ -1,5 +1,13 @@ #include "backend.h" +#if YASL_HAS_WAYLAND +#include "yasl/native/wayland.h" +#endif + +#if YASL_HAS_X11 +#include "yasl/native/x11.h" +#endif + #include <errno.h> void *yasl_display_get_native_handle(struct yasl_display *d) @@ -14,6 +22,34 @@ void *yasl_surface_get_native_handle(struct yasl_surface *s) s->display->ops->surface_get_native_handle(s) : NULL; } +#if YASL_HAS_WAYLAND +struct wl_display *yasl_wayland_display_get_wl_display(struct yasl_display *d) +{ + return (d && yasl_display_backend(d) == YASL_BACKEND_WAYLAND) ? + (struct wl_display *)yasl_display_get_native_handle(d) : NULL; +} + +struct wl_surface *yasl_wayland_surface_get_wl_surface(struct yasl_surface *s) +{ + return (s && s->display && yasl_display_backend(s->display) == YASL_BACKEND_WAYLAND) ? + (struct wl_surface *)yasl_surface_get_native_handle(s) : NULL; +} +#endif + +#if YASL_HAS_X11 +Display *yasl_x11_display_get_display(struct yasl_display *d) +{ + return (d && yasl_display_backend(d) == YASL_BACKEND_X11) ? + (Display *)yasl_display_get_native_handle(d) : NULL; +} + +uintptr_t yasl_x11_surface_get_window(struct yasl_surface *s) +{ + return (s && s->display && yasl_display_backend(s->display) == YASL_BACKEND_X11) ? + (uintptr_t)yasl_surface_get_native_handle(s) : 0; +} +#endif + struct yasl_surface *yasl_surface_create_native(struct yasl_display *d, const struct yasl_surface_spec *spec, void *graphics_device) { |
