<div dir="ltr">Ah, yes, opaque types are indeed unsupported: <a href="https://github.com/openjdk/jextract/blob/master/doc/GUIDE.md#unsupported-features" target="_blank">https://github.com/openjdk/jextract/blob/master/doc/GUIDE.md#unsupported-features</a>. As Jorn said there, if the API exposes methods that use opaque types, then you wouldn't have a problem. Also, if you have the .c file where they are defined, jextract can handle them. It could be a bit of a hack though.<div><br></div><div>I wrote a jextract GUI wrapper with JavaFX, which I tested only on Windows for now. I will try to get the Linux and Mac versions up soon as well. I find it very helpful compared to the command line and I think it could help you with the complex headers there.</div><div><br></div><div>Note that jextract generates Java 22 compatible code, which is unusable in JavaFX for now (we comply with Java 21).</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 22, 2024 at 1:36 AM Thiago Milczarek Sayão <<a href="mailto:thiago.sayao@gmail.com" target="_blank">thiago.sayao@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>I mailed the jextract list and Jorn Vernee explained that wayland use opaque types, which are just defined as such:<br></div><div><br></div><div>struct wl_registry;</div><div><br></div><div>I guess you just pass it around and it's defined in the internal .c file.</div><div>Those are not supported by jextract.</div><div><br></div><div>I'll find a way to get around it.</div><div><br></div><div>But I've been playing with it all day, it seems very good. I was able to generate bindings for:</div><div><br></div><div>GMain - for the main loop;</div><div>GSettings - for reading settings;</div><div>XDG Portal - for screen capture, screenshot, file dialogs</div><div><br><div>It looks like this:</div></div><div><br></div><div>1) To get a setting</div><div><br></div><div><div style="background-color:rgb(30,31,34);color:rgb(188,190,196)"><pre style="font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(207,142,109)">try</span>(<span style="color:rgb(207,142,109)">var </span>a = Arena.<span style="font-style:italic">ofConfined</span>()) {<br>    <span style="color:rgb(207,142,109)">var </span>mouseSettings = <span style="font-style:italic">g_settings_new</span>(a.allocateUtf8String(<span style="color:rgb(106,171,115)">"org.gnome.desktop.interface"</span>));<br>    <span style="color:rgb(207,142,109)">int </span>size = <span style="font-style:italic">g_settings_get_int</span>(mouseSettings, a.allocateUtf8String(<span style="color:rgb(106,171,115)">"cursor-size"</span>));<br>    <span style="font-style:italic">g_object_unref</span>(mouseSettings);<br>    <span style="color:rgb(207,142,109)">return new </span>Size(size, size);<br>}</pre></div></div><div><br></div><div>2) Callbacks</div><div><br></div><div><div style="background-color:rgb(30,31,34);color:rgb(188,190,196)"><pre style="font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(179,174,96)">@Override<br></span><span style="color:rgb(207,142,109)">protected void </span><span style="color:rgb(86,168,245)">_invokeLater</span>(Runnable runnable) {<br>    MemorySegment call = GSourceFunc.<span style="font-style:italic">allocate</span>(p -> {<br>        <span style="color:rgb(199,125,187)">runnable</span>.run();<br>        <span style="color:rgb(207,142,109)">return </span><span style="color:rgb(42,172,184)">0</span>;<br>    }, Arena.<span style="font-style:italic">ofAuto</span>());<br><br>    <span style="font-style:italic">g_idle_add</span>(call, MemorySegment.<span style="color:rgb(199,125,187);font-style:italic">NULL</span>);<br>}</pre></div></div></div><div><br></div><div>It looks correct to me, but untested.</div><div><br></div><div>-- Thiago.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em dom., 21 de abr. de 2024 às 18:15, Nir Lisker <<a href="mailto:nlisker@gmail.com" target="_blank">nlisker@gmail.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Can you link to where all the headers are? I found some in <a href="https://gitlab.freedesktop.org/wayland/wayland/-/tree/main/src" target="_blank">https://gitlab.freedesktop.org/wayland/wayland/-/tree/main/src</a>, but I couldn't see where wl_registry is defined. From what I see, wl_XYZ types are structs, which are supported.<div><br></div><div>By the way, there's a new guide for jextract at <a href="https://github.com/openjdk/jextract/blob/master/doc/GUIDE.md" target="_blank">https://github.com/openjdk/jextract/blob/master/doc/GUIDE.md</a>. When working with complex headers (includes upon includes), it's important to specify the correct target header.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 21, 2024 at 11:35 PM Thiago Milczarek Sayão <<a href="mailto:thiago.sayao@gmail.com" target="_blank">thiago.sayao@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>jextract --output src -t org.freedesktop.wayland.client --header-class-name WlClient `pkg-config --cflags-only-I wayland-client` `pkg-config --libs wayland-client`  /usr/include/wayland-client.h<br></div><div><div><br></div><div>WARNING: Skipping wl_registry (type Declared(wl_registry) is not supported)<br></div><div><br></div><div>I would need this to hook the events with wl_registry_add_listener, but currently the code generation for this is not working.</div><div><br></div><div><br></div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em dom., 21 de abr. de 2024 às 16:39, Nir Lisker <<a href="mailto:nlisker@gmail.com" target="_blank">nlisker@gmail.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">What are wl_ types? jextract only supports c headers.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 21, 2024 at 10:31 PM Thiago Milczarek Sayão <<a href="mailto:thiago.sayao@gmail.com" target="_blank">thiago.sayao@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<br><div><br></div><div>I did a small test app to explore Wayland client and portals (for Robot and dialogs such as file open/save).</div><div><br></div><div><a href="https://github.com/tsayao/wayland-test/blob/main/wayland-test.c" target="_blank">https://github.com/tsayao/wayland-test/blob/main/wayland-test.c</a><br></div><div><br></div><div>It seems it will work as a glass backend, but some walls will be hit on the way :)</div><div><br></div><div>I have tried to use jextract (from project Panama) to work directly with java, but it seems it does not support wl_ types.<br></div><div><br></div><div>-- Thiago.</div></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</div>
</blockquote></div>