<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 30 May 2014 11:27, Philip Rushik <span dir="ltr"><<a href="mailto:prushik@gmail.com" target="_blank">prushik@gmail.com</a>></span> wrote:<br>
<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"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div>On Fri, May 30, 2014 at 3:57 PM, Marek Chalupa <span dir="ltr"><<a href="mailto:mchqwerty@gmail.com" target="_blank">mchqwerty@gmail.com</a>></span> 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"><br><div><div><div class="gmail_extra"><div class="gmail_quote"><div>
<div>These protocols are not a part of libwayland, but Weston. You can find their specification in weston/protocol directory (those xml files) and you can generate sources from them using wayland-scanner. Then you can link against these sources (namely xdg-shell-protocol.c for xdg_* stuff and fullscreen-shell-procotol.c for the another). But as far as I know, the common wl_surface should be enough for creating a window without borders and buttons in Weston (that's how the weston/tests/weston-test-client-helpers.c works). So if you want to use only libwayland-client, as you wrote before, you should not use xdg_shell and fullscreen_shell. What you need to do is:<br>
<br></div><div>(connect to display and get registry)<br></div><div>1. bind to compositor<br></div><div>2. create surface from compositor<br></div><div>3. create shm buffer<br></div><div>4. set buffer's contents<br></div>
<div>5. attach the buffer to surface<br></div><div>6. commit the surface<br></div><div></div><div><br></div><div>Hmm, I hope I didn't forget something xD<br></div><div><br></div></div><span><font color="#888888"><div>
Marek <br></div></font></span></div><br>
</div></div></div></div>
</blockquote></div><br></div><div class="gmail_extra">This looks like exactly what I am doing. <br>I open a connection like so: display = wl_display_connect(NULL);<br></div><div class="gmail_extra">get registry: registry = wl_display_get_registry(display);<br>
wl_registry_add_listener(registry, ®istry_listener, NULL);<br><br></div><div class="gmail_extra">bind to compositor? Not sure about this, do you mean this:<br> if (strcmp(interface, "wl_compositor") == 0) {<br>
compositor =<br> wl_registry_bind(registry,<br> id, &wl_compositor_interface, 1);<br>...<br><br></div><div class="gmail_extra">in the registry listener function?<br></div></div>
</blockquote><div><br></div><div>Yes, that's what I meant.<br> <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 class="gmail_extra">
<br></div><div class="gmail_extra">
then I create the surface: <br> surface = wl_compositor_create_surface(compositor);<br><br>create the buffer:<br> stride = WIDTH * 4;<br> size = stride * HEIGHT;<br><br> fd = shm_open("/wl_example",O_CREAT | O_RDWR, 0777);<br>
if (fd==-1)<br> printf("SHM Failed to open\n");<br> data = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0x0);<br> if (data==0)<br> printf("MMAP failed\n");<br><br>Tell wayland about the buffer:<br>
pool = wl_shm_create_pool(shm, fd, size);<br> buffer = wl_shm_pool_create_buffer(pool, 0, WIDTH, HEIGHT, stride, 0);<br> wl_buffer_add_listener(buffer, &buffer_listener, NULL);<br> wl_shm_pool_destroy(pool);<br>
<br>Attach it to the surface:<br> wl_surface_attach(surface, buffer, 0, 0);<br><br></div><div class="gmail_extra">Commit the surface:<br><br> wl_surface_commit(surface);<br><br><br></div><div class="gmail_extra">Then I go into a loop of display dispatches cause I think thats what should happen, right?<br>
<br> int r;<br></div></div></blockquote><div> </div><div>Just a note: here you should initialize the variable r, or the loop can break without calling wl_display_dispatch...<br><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 class="gmail_extra"> while (r!=-1)<br> r = wl_display_dispatch(display);<br><br><br><br></div><div class="gmail_extra">Nothing appears in Weston. No errors, but nothing happens.<br></div></div>
</blockquote><div> </div><div>And what is the content of the buffer? Since you are creating the buffer with ARGB888 format (or at least on my system 0 is this format), then if it's mapped on zeroed page the surface will be transparent. Try to set all bytes to 255, then the surface should be white.<br>
<br></div><div>Regards,<br></div><div>Marek<br></div></div></div></div>