aboutsummaryrefslogtreecommitdiff
path: root/wayland.c (follow)
Commit message (Collapse)AuthorAgeLines
* term/wayland: use MONOTONIC timersDaniel Eklöf2020-01-10-1/+1
|
* wayland; fixupDaniel Eklöf2020-01-10-0/+1
|
* wayland: just to be sure, check return value of wl_display_read_events()Daniel Eklöf2020-01-10-1/+4
|
* wayland: make wayland socket non-blockingDaniel Eklöf2020-01-10-0/+6
|
* wayland: wayl_flush: re-initialize fd array before each pollDaniel Eklöf2020-01-04-5/+13
|
* wayland: add commentDaniel Eklöf2020-01-04-0/+4
|
* wayland: only call wl_display_prepare_read() if we read any eventsDaniel Eklöf2020-01-04-3/+4
| | | | | | 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.
* wayland: use a low priority FDM hook to flush the wayland socketDaniel Eklöf2020-01-04-1/+14
| | | | | | | | 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).
* render: throttle xcursor updatesDaniel Eklöf2020-01-04-51/+6
| | | | | | | | | | | | | | | | | | | | | | | 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.
* wayland: wl_display_flush() never blocksDaniel Eklöf2020-01-04-3/+44
| | | | | | | | | | | | | | | | | | | 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.
* wayland: window: optimize: set opaque regionDaniel Eklöf2020-01-03-0/+11
| | | | | | | 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.
* wayland: don't use wl_display_dispatch()Daniel Eklöf2020-01-03-5/+27
| | | | | | | | | | | | | | | | | | | | | | 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.
* wayland: flush after commit new pointer surfaceDaniel Eklöf2020-01-03-0/+1
|
* wayland: configure: resize before changing visual focusDaniel Eklöf2020-01-03-2/+2
| | | | | | | | | | | | | | 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.
* render: refresh: ensure window has been configuredDaniel Eklöf2020-01-03-0/+2
|
* render: remove 'refresh' from render_resize()Daniel Eklöf2020-01-03-4/+4
|
* wayland: window: apply all configure changes after acking the eventDaniel Eklöf2020-01-03-22/+19
|
* wayland: remove wayl_terminal_from_xdg_{surface,toplevel}Daniel Eklöf2020-01-03-26/+0
|
* wayland: window: pass window pointer to xdg toplevel callbacksDaniel Eklöf2020-01-03-6/+6
|
* wayland: window: pass window pointer to xdg-surface-listener callbacksDaniel Eklöf2020-01-03-3/+4
|
* wayland: window: pass window pointer to wl-surface callbacksDaniel Eklöf2020-01-03-8/+8
|
* wayland: window now keeps pointer to owning terminal, not waylandDaniel Eklöf2020-01-03-5/+7
|
* render: render_resize(): don't do anything if width or height is 0Daniel Eklöf2020-01-03-2/+1
|
* wayland: fix release buildDaniel Eklöf2020-01-03-2/+4
|
* wayland: debug log state changes in xdg-toplevel-configureDaniel Eklöf2020-01-03-3/+45
|
* wayland: xdg-surface-configure: refresh terminalDaniel Eklöf2020-01-03-1/+29
| | | | | | | | | | | | | | | Any changes done in any of the configure events are ignored before we've ack:ed the configure event. In particular, this means the resize done in xdg-toplevel-configure isn't displayed until the next time we call render_refresh(). Unless we do something ourselves, this can take quite some time, since we're basically need the slave to write something. So, in xdg-surface-configure, *after* having ack:ed the configure event, call render_refresh() to make the changes done in xdg-toplevel-configure visible as soon as possible.
* wayland: render_resize() now takes a 'refresh' argumentDaniel Eklöf2020-01-03-4/+8
|
* wayland: term_visual_focus_{in,out} handles already being focused/defocusedDaniel Eklöf2020-01-03-2/+2
|
* wayland: xdg-toplevel-configure: no need to detect early configure eventsDaniel Eklöf2020-01-03-7/+2
| | | | | | | | We can now lookup terminal instances at all times, making it unnecessary to detect "early" configure events. Note that we still need to prevent a resize from happening when width/height is 0.
* term: term_init() calls wl_display_roundtrip()Daniel Eklöf2020-01-03-2/+0
| | | | | | | | | | | | | Instead of having `wayl_win_init()` call `wl_display_roundtrip()` (which it itself doesn't need), call it from `term_init()`. This allows us to add ourselves (the new terminal instance) to the terminal list in the wayland backend, before triggering the wayland events caused by `wayl_win_init()`. This is turn allows the wayland backend to find/lookup the new terminal when those events occur..
* wayland: xdg-top-level-configure: call term_visual_focus_{in,out}Daniel Eklöf2020-01-02-1/+5
|
* wayland: xdg-toplevel-configure: check for stateless configure callsDaniel Eklöf2020-01-02-8/+11
| | | | | Ignore configure calls without state, instead of checking for width/height == 0.
* wayland: ignore early configure callsDaniel Eklöf2020-01-02-3/+4
| | | | | At this point, not everything has been setup and we crash when trying to convert the surface pointer to a terminal pointer.
* term: add visually focused attribute to terminal structDaniel Eklöf2020-01-02-4/+13
|
* wayland: rename focused/moused to kbd_focus/mouse_focusDaniel Eklöf2020-01-02-2/+2
|
* wayland: warn when presentation timings have been requested but is not supportedDaniel Eklöf2020-01-01-0/+4
|
* wayland: only bind to 'presentation' interface if -p,--presentation-timingsDaniel Eklöf2019-12-31-8/+12
|
* wayland: remove empty lineDaniel Eklöf2019-12-31-1/+0
|
* wayland: make zxdg_output_v1_listener struct constDaniel Eklöf2019-12-31-1/+1
|
* wayland: optionally use the presentation time protocol to measure input lagDaniel Eklöf2019-12-31-0/+28
| | | | | | | | | | | | | | | | | | | This adds a flag, -p,--presentation-timings, that enables input lag measuring using the presentation time Wayland protocol. When enabled, we store a timestamp when we *send* a key to the slave. Then, when we commit a frame for rendering to the compositor, we request presentation feedback. We also store a timestamp for when the frame was committed. The 'presented' callback then looks at the input and commit timestamps, and compares it with the presented timestamp. The delay is logged at INFO when the delay was less than one frame interval, at WARN when it was one frame interval, and at ERR when it was two or more frame intervals. We also update statistic counters that we log when foot is shut down.
* wayland: include more output (monitor) details in the log outputDaniel Eklöf2019-12-05-10/+22
|
* Add missing includesDaniel Eklöf2019-12-01-0/+1
|
* wayland: track current xcursor, and don't update if sameDaniel Eklöf2019-11-30-0/+10
| | | | | | | | | | | | | | | We may have many windows open, which tries to update/change the xcursor at various points. Track which cursor is currently loaded, regardless of which window it was set by. If someone tries to load that very same xcursor again, simply skip it. One example is when we've moused over a window that does *not* have keyboard focus, and then the user clicks, or by some other mean gives that window keyboard focus. In many cases it will then try to set the same cursor again (most of the times, the cursor is the same regardless of keyboard focus, but not always).
* wayland: terminal_from_surface: recognize scrollback search surfacesDaniel Eklöf2019-11-29-1/+5
| | | | | This fixes an assertion when hovering over the input field for scrollback searches.
* wayland: always flush after dispatching messagesDaniel Eklöf2019-11-29-1/+1
| | | | This means we don't have to e.g. roundtrip when setting the cursor.
* terminal: use the 'text' xcursor pointer whenever selection is possibleDaniel Eklöf2019-11-28-30/+41
|
* wayland: calculate output PPI (pixels-per-inch)Daniel Eklöf2019-11-26-3/+9
|
* wayland: change disconnected log type from err -> warnDaniel Eklöf2019-11-23-1/+1
|
* tllist: is now an external "library", so use <> includesDaniel Eklöf2019-11-17-1/+1
|
* wayland: verify xdg-output-manager interface versionDaniel Eklöf2019-11-03-1/+6
|
* wayland: verify server implements the required interface versionsDaniel Eklöf2019-11-03-18/+77
|
* Remove unneeded includeDaniel Eklöf2019-11-03-1/+0
|
* misc: fdm already logs failuresDaniel Eklöf2019-11-02-8/+3
|
* timerfd: read() returns -1 with errno == EAGAIN, not 0Daniel Eklöf2019-11-02-5/+3
| | | | | | When there hasn't been a timeout (or in our case, there was a timeout, but we reset the timer before we got to the read()), read() returns, not 0, but -1 with errno == EAGAIN.
* timerfd: use non-blocking mode, fixes dead lockDaniel Eklöf2019-11-02-1/+6
| | | | | | | | | | | Since we cancel the timers every now and then, there's a (small) chance that one handler cancels a timer that has triggered in the same epoll() iteration. When this happens, read() blocks. Fix by making the timer FDs non-blocking, and simply returning when we read 0 bytes.
* wayland: wayl_win_destroy(): looks like we need another roundtripDaniel Eklöf2019-11-01-0/+2
|
* wayland: wayl_destroy(): destroy any remaining terminalsDaniel Eklöf2019-11-01-0/+9
|
* Don't use non-blocking FDsDaniel Eklöf2019-11-01-14/+1
| | | | | We use epoll() to determine when we can read/write FDs so there's absolutely no need for non-blocking.
* wayland: wayl_win_destroy(): unmap windows before destroyingDaniel Eklöf2019-11-01-0/+21
| | | | | | | | | This will trigger e.d. keyboard_leave() and wl_pointer_leave() events, which ensures there aren't any references to the destroyed window from the global wayland struct. Call wl_display_roundtrip() to trigger those events *before* we destroy the window.
* wayland: wayl_init(): call wl_display_roundtrip() when doneDaniel Eklöf2019-11-01-2/+3
|
* wayland: fdm_del() now closes the FDDaniel Eklöf2019-11-01-4/+3
|
* wayland: wayl_win_destroy(): return early if win == NULLDaniel Eklöf2019-10-30-0/+3
|
* wayland: xdg_toplevel_close(): call term_shutdown()Daniel Eklöf2019-10-30-3/+1
|
* wayland: track multiple terminalsDaniel Eklöf2019-10-30-7/+17
| | | | | The wayland 'term' member is gone and replaced by a list, 'terms'. This list contains all currently running terminal (windows).
* wayland: move reload_cursor_theme() and update_cursor_surface() to waylandDaniel Eklöf2019-10-27-3/+59
|
* wayland: backend now configures FD as non-blocking, not mainDaniel Eklöf2019-10-27-1/+15
|
* wayland: free wayland/wl_window instancesDaniel Eklöf2019-10-27-0/+3
|
* wayl_destroy: early return on NULLDaniel Eklöf2019-10-27-0/+3
|
* wayland: move keyboard repeat handling into waylandDaniel Eklöf2019-10-27-0/+39
|
* wayland: integrate directly with the FDMDaniel Eklöf2019-10-27-1/+23
|
* wayland: implement wayl_init()Daniel Eklöf2019-10-27-4/+514
| | | | Wayland instantiation is now done by the wayland backend, not in main.
* wayland: change all wayland callbacks to take a wayland pointerDaniel Eklöf2019-10-27-4/+21
| | | | | Instead of passing the terminal to the wayland callbacks, pass a 'struct wayland' pointer.
* kbd: move into waylandDaniel Eklöf2019-10-27-0/+11
|
* wayland: move clipboard/primary structs into the wayland structDaniel Eklöf2019-10-27-0/+11
| | | | These are application global and very wayland specific
* wayland: implement wayl_win_destroy()Daniel Eklöf2019-10-27-0/+24
|
* wayland: implement wayl_destroy()Daniel Eklöf2019-10-27-0/+66