aboutsummaryrefslogtreecommitdiff
path: root/wayland.c (follow)
Commit message (Collapse)AuthorAgeLines
...
* wayland: globals: destroy: handle seats being destroyedDaniel Eklöf2020-07-09-2/+39
|
* wayland: log: be clear that these are the XCRUSOR_* environment variablesDaniel Eklöf2020-07-08-2/+1
|
* xcursor: trigger theme reload in pointer-enter eventDaniel Eklöf2020-07-08-9/+11
| | | | | | | | | | | | | | | | Previously, we triggered a theme reload on output changes. This is completely wrong. We may get a new output with a scale different from the output the pointer is actually on. Now, we store the current scale along with the theme. We then trigger a call to reload the xcursor theme *every* time the pointer enters a surface. When it does, we use the current scale factor of the terminal that owns that surface. If the terminal covers multiple outputs, with different scale factors, we'll use the largest scale factor. This may not be 100% correct. But to fix that, we'd need to track which regions of a surface are mapped on which outputs. Too complicated I say.
* wayland: seat: log keyboard/pointer capabilityDaniel Eklöf2020-07-08-1/+4
|
* multi-seat: re-enable selection support (excluding OSC 52)Daniel Eklöf2020-07-08-0/+8
|
* multi-seat: re-enable scrollback search supportDaniel Eklöf2020-07-08-3/+1
|
* multi-seat: enable xcursor theme support againDaniel Eklöf2020-07-08-79/+43
|
* wip: multi-seat supportDaniel Eklöf2020-07-08-102/+166
| | | | | Compiles and runs, but mouse, clipboard and other things have been disabled.
* wayland: use xdg_output's description if there's no 'model'Daniel Eklöf2020-06-25-3/+7
|
* wayland: force-trigger a resize on 'configured' eventDaniel Eklöf2020-05-12-1/+2
| | | | | | | | | This ensures we _always_ commit a **new** buffer in response to a configured event. This fixes an issue in Gnome where e.g. tiling the window (on the left/right side) only worked if that caused the windows size to change.
* util.h: new header file defining commonly used macrosDaniel Eklöf2020-05-01-4/+1
|
* term: don't enable ptmx FDM callback until Wayland window has been configuredDaniel Eklöf2020-04-30-0/+4
| | | | | | | | | | | | | The way things works right now, we cannot enable the ptmx FDM callback right away. We need to wait for the Wayland window to have been configured. Before the window is configured, we don't have a size, and no grid. Thus, if we try to process ptmx data we'll crash since we have no where to write it to. So, registering the ptmx fd with the FDM is now delayed until we've received the first 'configure' event from Wayland.
* wayland: monitor unplug: call surface_leave() to handle terminal unmappingDaniel Eklöf2020-04-28-14/+7
|
* wayland: handle outputs disappearingDaniel Eklöf2020-04-27-11/+50
| | | | | | | | | That is, deal with monitors being unplugged. At least on Sway 1.4, surfaces are not unmapped before the output is removed. Thus, in addition to free:ing the monitor resources, we also need to update all terminals that are mapped on this output - remove the output from their "mapped on" list.
* wayland: group handle_global() together with handle_global_removed()Daniel Eklöf2020-04-27-131/+131
|
* render: use output's subpixel mode when rasterizing glyphsDaniel Eklöf2020-04-20-0/+2
|
* conf: add app-id config option and --app-id command line optionDaniel Eklöf2020-04-01-2/+2
|
* search: replace hard-coded key bindings with "user configurable" onesDaniel Eklöf2020-03-18-2/+2
| | | | | | | | They aren't really user configurable. At least not yet. However, with this, we now handle raw key codes just like the normal key bindings. Meaning, e.g. ctrl+g, ctrl+a, ctrl+e etc now works while searching with e.g. a russian layout.
* input: bind key bindings to raw key codes tooDaniel Eklöf2020-03-18-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | Before, when looking for a matching user key binding, we only matched *symbols*. This means that the physical keys that generate a specific key binding is layout dependent. What's worse, it may not even be possible to generate the key binding at all. Russian is one such layout, where all the "normal" (us) symbols are replaced. By using raw key codes, we can get around this - the key code has a direct mapping to the physical key. However, matching raw key codes **only** doesn't always make sense either. For now, match **both** symbols _and_ key codes. Symbols take precedence. TODO: we might have to make this configurable _per binding_. Note: 'search' mode still uses mostly hardcoded shortcuts that still have this problem (i.e. ctrl+g doesn't work with a russian layout).
* wayland: add FDs to FDM as soon as the FDs are readyDaniel Eklöf2020-03-15-6/+6
|
* wayland: store display FD in wayland structDaniel Eklöf2020-03-15-6/+6
| | | | | | | | This way we: * Don't have to call wl_display_get_fd() all the time * No longer call fdm_del_no_close() even though the FD hasn't been added to the FDM.
* Merge branch 'scale-fonts-using-logical-dpi-plus-scale-factor'Daniel Eklöf2020-03-13-14/+25
|\
| * term: use logical DPI+scale factor when scaling fontsDaniel Eklöf2020-03-11-14/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes an issue where the fonts were rendered too small when the output had fractional scaling. For integral scaling, using the logical (scaled) DPI multiplied with the scaling factor results in the same final DPI value as if we had used the physical DPI. But for fractional scaling, this works around the fact that the compositor downscales the surface after we've rendered it. Closes #5
* | Merge branch 'master' into bindingsDaniel Eklöf2020-03-10-1/+0
|\|
| * wayland: remove empty lineDaniel Eklöf2020-03-10-1/+0
| |
* | Merge branch 'master' into bindingsDaniel Eklöf2020-03-09-8/+9
|\|
| * wayland: make a missing presentation time interface an errorDaniel Eklöf2020-03-09-3/+4
| | | | | | | | | | If the user wanted to do presentation timing, and the interface isn't there, then this is an error.
| * wayland: register FDM hook early, to avoid unregister errors when failingDaniel Eklöf2020-03-09-5/+5
| |
* | wayland: free 'search' key bindings on destroyDaniel Eklöf2020-03-08-0/+1
| |
* | input: convert the rest of the normal key bindings to configurable bindingsDaniel Eklöf2020-03-08-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New actions defined and implemented: * scrollback up/down * font size up/down/reset * spawn terminal Break out key combo parsing to a new function, parse_key_binding_for_action(). This function parses a string containing one or more space separated key combo definitions on the form (mod1+mod2+...+key), where key is a XKB key name (e.g. KP_Add). Convert all hardcoded key bindings to configuration based bindings. These still cannot actually be configured by the user, but at least lives in the conf struct.
* | wip: initial framework for dealing with key/mouse bindings in different modesDaniel Eklöf2020-03-08-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds initial support for defining key and mouse bindings that are applied in different terminal modes/states. For example, there are two arrays dealing with key and mouse bindings in the "normal" mode. Most bindings will go here. There's also an array for "search" mode. These bindings will be used when the user has started a scrollback search. In the future, there may be a model selection mode as well. Or maybe "search" and "modal selection" will be combined into a single "keyboard" mode. We'll see. Since the keyboard bindings depend on the current XKB keymap, translation from the user specified key combination string cannot be done when loading the configuration, but must be done when we've received a keymap from the wayland server. We should explore if it's possible to load some kind of default keymap just to be able to verify the validity of the key combination strings at configuration load time, to be able to reject the configuration at startup. A couple of key bindings have been added as proof of concept. Mouse bindings aren't handled at all yet, and is likely to be re-written. For example, we can probably translate the configuration strings at configuration load time.
* wayland: remove debug logsDaniel Eklöf2020-03-06-4/+0
|
* wayland: log: say 'requesting' instead of 'referring' client/server decorationsDaniel Eklöf2020-03-06-1/+1
|
* wayland: set window geometry to exclude the invisible CSD bordersDaniel Eklöf2020-03-03-53/+8
| | | | | | | | | | | | | But it *does* include the title bar. This simplifies the 'adjustment' needed to be done to the configured window size. It also fixes a number of issues: * the compositor will now properly snap the window to screen edges (before, there was an empty space between the edge and the window - the CSD border). * This also removes the need for the mutter 'commit' workaround. We must be doing something right now.
* wayland: don't destroy keyboard/pointer if they haven't been removedDaniel Eklöf2020-03-03-14/+22
| | | | | | | | | | When the seat capabilities change, we used to destroy all pointers and keyboards, and then re-creating them as necessary. This caused a crash on mutter - probably because we removed a keyboard device the compositor had already sent an event for (or was about to). Now, we only destroy and create devices when it's needed.
* csd: initial implementation of minimize/maximize/close buttonsDaniel Eklöf2020-03-02-1/+5
|
* wayland: log whether CSDs or SSDs are used at info level, not debugDaniel Eklöf2020-03-02-2/+2
|
* config: make CSD user configurableDaniel Eklöf2020-03-02-15/+20
| | | | | | | | | | | | | | The user can now configure the following: * Whether to prefer CSDs or SSDs. But note that this is only a hint to the compositor - it may deny our request. Furthermore, not all compositors implement the decoration manager protocol, meaning CSDs will be used regardless of the user configuration (GNOME/mutter being the most prominent one). * Title bar size and color, including transparency * Border size and color, including transparency Also drop support for rendering the CSDs inside the main surface.
* wayland: always update window->is_fullscreen, not just when using CSDsDaniel Eklöf2020-02-29-1/+1
|
* wayland: don't resize when we're not mapped anywhereDaniel Eklöf2020-02-29-0/+3
| | | | | | | | | | | | | | | | | | | | | Normally, we resize and update the font's DPI whenever our window enters or leaves an output. This is since a change in the outputs we're mapped on means the scale factor to use, or the DPI to use for the fonts may have changed. However, a special case is when we're removed from the last output. This should only happen at shutdown, when we're un-mapping ourselves. In this case, we typically don't have a access to e.g. the PTMX fd (often, the reason we're shutting down is because the client exited). This resulted in (harmless) error messages when emitting the TIOCSWINSZ event. Since we're shutting down anyway, we can simply skip the resize and everything. This gets rid of the error message, and also means we're shutting down faster.
* input: csd: add a small delay before initiating a moveDaniel Eklöf2020-02-29-0/+4
| | | | | This ensures the user has time to double-click to toggle the maximized state.
* wayland: remove all usages of wayl_terminal_from_surface()Daniel Eklöf2020-02-29-13/+0
| | | | Use the 'user data' pointer from the wayland surface instead.
* wayland: store pointer to window instance in all surfacesDaniel Eklöf2020-02-29-0/+1
|
* wayland: configure: work around GNOME/mutter weirdnessDaniel Eklöf2020-02-28-4/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | When resizing the window under mutter, mutter seems to expect a configure ack *and* a surface commit *right* away, or things get out of sync. Unlike kwin, which is requires a commit for each configure ack, but is fine with having the commit arrive later (after we've rendered it), mutter is not. I even tried delaying the configure ack until just before the commit, but still no go. So for now, detect when we're running under mutter and always do a surface commit right away. This can *not* be done on any other compositor as it breaks the CSD and main surface synchronization; we've resized the CSDs, but not the main surface. I.e. this *should* not work, but for some reason is the *only* way to make things work on mutter. Interestingly, doing it any other way on mutter causes visual glitches; window jumping around when resizing, or de-synchronized CSDs/main surface.
* wayland: fix window size adjustment for CSDs placed outside main surfaceDaniel Eklöf2020-02-28-10/+18
| | | | | | | * Do this both in XDG configure, and when the decoration manager switches between CSDs/SSDs at run-time. * Exclude CSD borders when we're maximized
* wayland: warn when compositor doesn't implement the decoration manager interfaceDaniel Eklöf2020-02-28-0/+1
|
* wayland: request server side decorationsDaniel Eklöf2020-02-28-2/+0
|
* wayland: drop required wl_output interface version from 3 -> 2Daniel Eklöf2020-02-28-1/+1
| | | | We don't need version 3, and mutter 3.34 only implements version 2.
* wayland: resize main surface when enabling CSDs runtimeDaniel Eklöf2020-02-26-1/+11
| | | | | | | | | | When we position CSDs inside the main surface, and CSDs are switched on run-time, we need to force a grid resize, since the actual window content will now be smaller. Alternative solution: call resize with width/height increased, to account for the CSDs. This would increase the window size, but would keep the grid size fixed.
* wayland: track window maximized stateDaniel Eklöf2020-02-26-2/+5
|
* wayland: don't adjust size when CSDs are positioned inside main surfaceDaniel Eklöf2020-02-26-0/+5
|
* wayland: disable debug logsDaniel Eklöf2020-02-26-1/+1
|
* csd: don't draw CSDs in fullscreen modeDaniel Eklöf2020-02-26-42/+46
|
* wayland: decoration configure: no need to force a resize - just update the CSDsDaniel Eklöf2020-02-26-6/+2
|
* wayland: configure: adjust configured size when using CSDsDaniel Eklöf2020-02-26-1/+19
| | | | | | | | | | | | The size (width, height) arguments provided by the compositor in the XDG toplevel configure event *include* the surrounding CSDs. Since our code assumes the size is for the main surface only (and then positions the sub-surfaces *outside* the main surface), adjust the provided size when using CSDs. This ensures our actual window size ends up being what the compositor wants it to be, and it fixes resize-glitches when resizing using CSDs.
* wayland: instantiate sub-surfaces on-demandDaniel Eklöf2020-02-26-30/+50
| | | | | | | | | | | | | | | | | | | While most compositors handle instantiated but not-yet-mapped sub-surfaces correctly, e.g. kwin does not. For example, it will incorrectly offset the main surface both horizontally and vertically with a couple of pixels, leaving two transparent areas at the top and left, between the SSDs and the main surface. Note that a workaround is to position the sub-surfaces inside the main surface while they're unmapped. However, since the surfaces may be larger than the main surface (the CSDs, for examples, always are), this doesn't quite work since kwin, at least, resizes the window to include the sub-surfaces, even when unmapped. So, instead we instantiate all sub-surfaces on demand, when we know where to position them, and when they should be mapped.
* csd: position CSD sub-surfaces *outside* the main windowDaniel Eklöf2020-02-26-3/+3
| | | | | | | | | | | | | | | For now, this behavior is controlled with an ifdef. At least kwin seems very buggy when the decorations are positioned like this (but normally you'd use server-side decorations with kwin anyway). This commit also changes 'use_csd' to be a tri-state variable; when instantiating a window it is set to 'unknown'. If there's no decoration manager available (e.g. weston), we immediately set it to 'yes' (use CSDs). Otherwise, we wait for the decoration manager callback to indicate whether we should use CSDs or not.
* wayland: mark the whole search surface as opaqueDaniel Eklöf2020-02-25-0/+5
|
* wayland: synchronize the CSD surfaces to the main surfaceDaniel Eklöf2020-02-25-0/+1
|
* wayland: default to CSDsDaniel Eklöf2020-02-25-0/+1
| | | | | Only when the compositor implements the XDG decoration manager interface, and it tells us to use server side decorations to we do so.
* wayland: weston does not implement the xdg decoration manager interfaceDaniel Eklöf2020-02-25-6/+10
|
* wayland: xdg_surface_configure(): call wl_surface_commit()Daniel Eklöf2020-02-25-2/+11
| | | | | | | | | | | | It seems kwin expects a wl_surface_commit() for each xdg_surface_ack_configure(). We don't want to commit before we've rendered a resized surface. So, if we *did* change the window size, let the normal rendering path do the surface commit. Only when we did *not* change the window size do we need to explicitly commit the surface in xdg_surface_configure().
* wayland: decoration-configure: call render_resize() to add/remove CSDsDaniel Eklöf2020-02-25-0/+7
| | | | | | Call render_resize_force() when the decoration type changes run-time. This ensures the CSDs are drawn when changing from server -> client side decorations, and removed when going the other way.
* wayland: terminal_from_surface(): use term_surface_kind()Daniel Eklöf2020-02-24-4/+1
|
* csd: wip: something to get started...Daniel Eklöf2020-02-23-3/+28
|
* wayland: output_mode: update PPIDaniel Eklöf2020-02-15-0/+1
| | | | | Since we now use the width/height values from output_mode(), we also need to update the PPI here.
* wayland: debug: make sure state_str is properly NULL terminatedDaniel Eklöf2020-02-15-0/+2
|
* wayland: calculate DPI from physical size, not logical sizeDaniel Eklöf2020-02-15-4/+2
| | | | | | | | xdg_output_handle_logical_size() reports _logical_ output size. That is, it is scaled by the output's scale factor. We want the _actual_ DPI. The _real_ output size is reported by output_mode(), so use that instead.
* wayland: break out scale/resize updating to a new functionDaniel Eklöf2020-02-15-19/+29
| | | | | And call this function once from output_done(), rather than from each output_*() callback.
* 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
|