<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/wayland.c, branch 1.1.0</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.1.0</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.1.0'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2020-01-10T20:33:40Z</updated>
<entry>
<title>term/wayland: use MONOTONIC timers</title>
<updated>2020-01-10T20:33:40Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-10T20:33:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5956faac01246521316282c26c875c21787c3add'/>
<id>urn:sha1:5956faac01246521316282c26c875c21787c3add</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wayland; fixup</title>
<updated>2020-01-10T18:23:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-10T18:23:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=4e335422b8317c9ebc58e1d653632b1fd67269af'/>
<id>urn:sha1:4e335422b8317c9ebc58e1d653632b1fd67269af</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wayland: just to be sure, check return value of wl_display_read_events()</title>
<updated>2020-01-10T18:23:08Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-10T18:23:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7ce2cca49af406be379da20df08ff3f35394db2d'/>
<id>urn:sha1:7ce2cca49af406be379da20df08ff3f35394db2d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wayland: make wayland socket non-blocking</title>
<updated>2020-01-10T18:22:59Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-10T18:22:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=832e6f1370ec70ec654aa4c80a253fd0333e5392'/>
<id>urn:sha1:832e6f1370ec70ec654aa4c80a253fd0333e5392</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wayland: wayl_flush: re-initialize fd array before each poll</title>
<updated>2020-01-04T22:36:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-04T22:36:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ae829391586b73c2adf4559390f6803681392a99'/>
<id>urn:sha1:ae829391586b73c2adf4559390f6803681392a99</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wayland: add comment</title>
<updated>2020-01-04T22:33:50Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-04T22:33:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=11d381f0c3b9a76868b979a7ef7fceb27a64f7b1'/>
<id>urn:sha1:11d381f0c3b9a76868b979a7ef7fceb27a64f7b1</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wayland: only call wl_display_prepare_read() if we read any events</title>
<updated>2020-01-04T22:32:00Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-04T22:32:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d243a836ce55dff647f8e744441fbd2c3343cfa1'/>
<id>urn:sha1:d243a836ce55dff647f8e744441fbd2c3343cfa1</id>
<content type='text'>
That is, only call it if we have POLLIN. If not, then we never read
any events and we still hold the read lock and thus we shouldn't try
to acquire it again.
</content>
</entry>
<entry>
<title>wayland: use a low priority FDM hook to flush the wayland socket</title>
<updated>2020-01-04T22:27:59Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-04T22:27:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=4cbd894803f239af3e320aece24521aeb325cbd2'/>
<id>urn:sha1:4cbd894803f239af3e320aece24521aeb325cbd2</id>
<content type='text'>
This way, we don't have to manually insert flushes in code paths that
may execute outside of a wl_display_dispatch_pending().

(Those that execute inside a wl_display_dispatch_pending() are subject
to the flush performed at the end of the normal wayland FDM handler).
</content>
</entry>
<entry>
<title>render: throttle xcursor updates</title>
<updated>2020-01-04T21:58:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-04T21:01:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5ec447697c7548fc7930031077e821fd1e26b2f9'/>
<id>urn:sha1:5ec447697c7548fc7930031077e821fd1e26b2f9</id>
<content type='text'>
With a bad behaving client (e.g. 'less' with mouse support enabled),
we can end up with a *lot* of xcursor updates (so much, that we
flooded the wayland socket before we implemented a blocking
wayl_flush()).

Since there's little point in updating the cursor more than once per
frame interval, use frame callbacks to throttle the updates.

This works more or lesslike normal terminal refreshes:

render_xcursor_set() stores the last terminal (window) that had (and
updated) the cursor.

The renderer's FDM hook checks if we have such a pending terminal set,
and if so, tries to refresh the cursor.

This is done by first checking if we're already waiting for a callback
from a previous cursor update, and if so we do nothing; the callback
will update the cursor for the next frame. If we're *not* already
waiting for a callback, we update the cursor immediately.
</content>
</entry>
<entry>
<title>wayland: wl_display_flush() never blocks</title>
<updated>2020-01-04T20:10:08Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-04T20:10:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=abc36d8f090dbae1b127f74a83b601d3fa3c8bed'/>
<id>urn:sha1:abc36d8f090dbae1b127f74a83b601d3fa3c8bed</id>
<content type='text'>
Since it doesn't block, we need to detect EAGAIN failures and ensure
we actually flush everything.

If we don't, we sooner or later end up in a wayland client library
call that aborts due to the socket buffer being full.

Ideally, we'd simply enable POLLOUT in the FDM. However, we cannot
write *anything* to the wayland socket until we've actually managed to
send everything. This means enabling POLLOUT in the FDM wont work
since we may (*will*) end up trying to write more data to it before
we've flushed it.

So, add a wrapper function, wayl_flush(), that acts as a blocking
variant of wl_display_flush(), by detecting EAGAIN failiures and
calling poll() itself, on the wayland socket only, until all data has
been sent.
</content>
</entry>
<entry>
<title>wayland: window: optimize: set opaque region</title>
<updated>2020-01-03T20:53:38Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-03T20:53:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=1178a7763bb16c6f128174adca6813aea9321f08'/>
<id>urn:sha1:1178a7763bb16c6f128174adca6813aea9321f08</id>
<content type='text'>
When background alpha is 1.0 (0xffff), i.e. completely opaque, tell
the compositor this, via wl_surface_set_opaque_region().

This allows it to optimize drawing of surfaces _behind_ our window.
</content>
</entry>
<entry>
<title>wayland: don't use wl_display_dispatch()</title>
<updated>2020-01-03T20:02:12Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-03T20:02:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0ea0323d0fb3130e5bc1782812e70993e5cdb742'/>
<id>urn:sha1:0ea0323d0fb3130e5bc1782812e70993e5cdb742</id>
<content type='text'>
wl_display_dispatch() calls poll(), which is unnecessary since we
already know the FD is readable.

Use the more lower level wl_display_read_events() +
wl_display_dispatch_pending().

These require wl_display_prepare_read() to have been called.

The idea is to call wl_display_prepare_read() **before** calling
poll().

Thus, we do this more or less last in wayl_init(), and at the **end**
of the FDM handler.

However, having taking this lock also means we no longer can call
wl_display_roundtrip() directly (it will hang).

So, add a wrapper, wayl_roundtrip(), that cancels the read intent,
does the roundtrip, and then re-acquires the read intent.
</content>
</entry>
<entry>
<title>wayland: flush after commit new pointer surface</title>
<updated>2020-01-03T18:04:42Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-03T18:04:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a291999f2c602ef7af050ee167c023dc4830d164'/>
<id>urn:sha1:a291999f2c602ef7af050ee167c023dc4830d164</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wayland: configure: resize before changing visual focus</title>
<updated>2020-01-03T17:58:26Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-03T17:58:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c118ed9252cd182fbab6078e6b22d11d2673d9c4'/>
<id>urn:sha1:c118ed9252cd182fbab6078e6b22d11d2673d9c4</id>
<content type='text'>
This hopefully fixes and issue where the visual focus in/out caused a
render refresh with the *old* size.

This caused the occasional flicker at startup, or when resizing the
window.

By placing the resize call before the visual focus in/out, we ensure
the refresh uses the new size.

This is a temporary workaround. The correct solution is to ensure we
only call refresh() once.
</content>
</entry>
<entry>
<title>render: refresh: ensure window has been configured</title>
<updated>2020-01-03T17:55:13Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-03T17:55:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f7362d381b436718cc26565a09a3a38bf556586d'/>
<id>urn:sha1:f7362d381b436718cc26565a09a3a38bf556586d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: remove 'refresh' from render_resize()</title>
<updated>2020-01-03T12:56:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-03T12:56:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d07fd7de39d588f79da307a9d112e445af86869a'/>
<id>urn:sha1:d07fd7de39d588f79da307a9d112e445af86869a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wayland: window: apply all configure changes after acking the event</title>
<updated>2020-01-03T12:54:44Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-03T12:54:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=46c434d3f10f0312211c2dc1360aed3e2ad0001b'/>
<id>urn:sha1:46c434d3f10f0312211c2dc1360aed3e2ad0001b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wayland: remove wayl_terminal_from_xdg_{surface,toplevel}</title>
<updated>2020-01-03T12:46:37Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-03T12:46:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=765fe13aff4b9e9b3b1f487a6595a421efbd26b3'/>
<id>urn:sha1:765fe13aff4b9e9b3b1f487a6595a421efbd26b3</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wayland: window: pass window pointer to xdg toplevel callbacks</title>
<updated>2020-01-03T12:46:15Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-03T12:46:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b0fbc064ddcd7eac46a6980b56bb8d17958aa3ee'/>
<id>urn:sha1:b0fbc064ddcd7eac46a6980b56bb8d17958aa3ee</id>
<content type='text'>
</content>
</entry>
<entry>
<title>wayland: window: pass window pointer to xdg-surface-listener callbacks</title>
<updated>2020-01-03T12:41:35Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-01-03T12:41:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ea002ad5712f01e085c888cd551d7e03ac4435bf'/>
<id>urn:sha1:ea002ad5712f01e085c888cd551d7e03ac4435bf</id>
<content type='text'>
</content>
</entry>
</feed>
