1 module wayland.egl; 2 3 import wayland.client; 4 import wayland.native.egl; 5 import wayland.util; 6 import std.typecons : tuple, Tuple; 7 8 class WlEglWindow : Native!wl_egl_window 9 { 10 mixin nativeImpl!(wl_egl_window); 11 12 this(WlSurface surf, int width, int height) 13 { 14 _native = wl_egl_window_create(surf.proxy, width, height); 15 } 16 17 void destroy() 18 { 19 wl_egl_window_destroy(_native); 20 _native = null; 21 } 22 23 void resize(int width, int height, int dx, int dy) 24 { 25 wl_egl_window_resize(_native, width, height, dx, dy); 26 } 27 28 @property Tuple!(int, int) attachedSize() 29 { 30 int w = -1, h = -1; 31 wl_egl_window_get_attached_size(_native, &w, &h); 32 return tuple(w, h); 33 } 34 } 35 36 version(WlDynamic) 37 { 38 import derelict.util.loader : SharedLibLoader; 39 40 private class WlEglLoader : SharedLibLoader 41 { 42 this() 43 { 44 super("libwayland-egl.so"); 45 } 46 47 protected override void loadSymbols() 48 { 49 bindFunc( cast( void** )&wl_egl_window_create, "wl_egl_window_create" ); 50 bindFunc( cast( void** )&wl_egl_window_destroy, "wl_egl_window_destroy" ); 51 bindFunc( cast( void** )&wl_egl_window_resize, "wl_egl_window_resize" ); 52 bindFunc( cast( void** )&wl_egl_window_get_attached_size, "wl_egl_window_get_attached_size" ); 53 } 54 } 55 56 private __gshared WlEglLoader _loader; 57 58 shared static this() 59 { 60 _loader = new WlEglLoader; 61 } 62 63 public @property SharedLibLoader wlEglDynLib() 64 { 65 return _loader; 66 } 67 }