aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-10-12xwayland: remove stale transfers from the same requestorTudor Brindus
It seems that if we ever try to reply to a selection request after another has been sent by the same requestor (we reply in FIFO order), the requestor never reads from it, and we end up stalling forever on a transfer that will never complete. It appears that `XCB_SELECTION_REQUEST` has some sort of singleton semantics, and new requests for the same selection are meant to replace outstanding older ones. I couldn't find a reference for this, but empirically this does seem to be the case. Real (contrived) case where we don't currently do this, and things break: * run fcitx * run Slack * wl-copy < <(base64 /opt/firefox/libxul.so) # or some other large file * focus Slack (no need to paste) fcitx will send in an `XCB_SELECTION_REQUEST`, and we'll start processing it. Immediately after, Slack sends its own. fcitx hangs for a long, long time. In the meantime, Slack retries and sends another selection request. We now have two pending requests from Slack. Eventually fcitx gives up (or it can be `pkill`'d), and we start processing the first request Slack gave us (FIFO). Slack (Electron?) isn't listening on the other end anymore, and this transfer never completes. The X11 clipboard becomes unusable until Slack is killed. After this patch, the clipboard is immediately usable again after fcitx bails. Also added a bunch of debug-level logging that makes diagnosing this sort of issue easier. Refs swaywm/sway#4007.
2020-10-11xwayland: introduce WLR_XWAYLAND for specifying which Xwayland to useTudor Brindus
When debugging Xwayland-related issues, a common first step in debugging has been to ask the reporter to move their real Xwayland to /usr/bin/Xwayland.bin, and create a shell script starting Xwayland with extra arguments under the original /usr/bin/Xwayland location. Introducing a `WLR_XWAYLAND` environment variable makes this less invasive, by allowing the user to swap out Xwayland without resorting to global system changes (or source patches).
2020-10-11xwayland: fix use-after-free in selection handlingTudor Brindus
Fixes #2425. wlroots can only handle one outgoing transfer at a time, so it keeps a list of pending selections. The head of the list is the currently-active selection, and when that transfer completes and is destroyed, the next one is started. The trouble is when you have a transfer to some app that is misbehaving. fcitx is one such application. With really large transfers, fcitx will hang and never wake up again. So, you can end up with a transfer list that looks like this: | T1: started | T2: pending | T3: pending | T4: pending | The file descriptor for transfer T1 is registered in libwayland's epoll loop. The rest are waiting in wlroots' list. As a user, you want your clipboard back, so you `pkill fcitx`. Now Xwayland sends `XCB_DESTROY_NOTIFY` to let us know to give up. We clean up T4 first. Due to a bug in wlroots code, we register the (fd, transfer data pointer) pair for T1 with libwayland *again*, despite it already being registered. We do this 2 more times as we remove T3 and T2. Finally, we remove T1 and `free` all the memory associated with it, before `close`-ing its transfer file descriptor. However, we still have 3 copies of T1's file descriptor left in the epoll loop, since we erroneously added them as part of removing T2/3/4. When we `close` the file descriptor as part of T1's teardown, we actually cause the epoll loop to wake up the next time around, saying "this file descriptor has activity!" (it was closed, so `read`-ing would normally return 0 to let us know of EOF). But instead of returning 0, it returns -1 with `EBADF`, because the file descriptor has already been closed. And finally, as part of error-handling this, we access the transfer pointer, which was `free`'d. And we crash.
2020-10-11xwayland: using %m in `wlr_log` is broken, use `wlr_log_errno` insteadTudor Brindus
This one was awful to track down, but calls to `wlr_log` with %m have the errno masked by the `isatty` call in `log_stderr`. Switch them to `wlr_log_errno` instead. Cue quality "how can read(2) POSSIBLY be returning ENOTTY?" moments.
2020-10-11examples: use `perror` instead of `fprintf` GNU %m `printf` extensionTudor Brindus
2020-10-10backend/libinput: improve logger callbackSimon Ser
- Add a prefix to make it clear log messages come from libinput - Properly convert libinput log priority to wlroots'
2020-10-09output-management-v1: send complete head state on enable changeRoman Gilg
The data of a head is only sent when it is enabled. While the head was disabled data might have been changed. In this case clients were not informed about this change. A later enable change that does not also update the other data must still lead to the propagation of this data. Since we do not know what other data was changed while the head was disabled just send together with an enable change all current data.
2020-10-09layer-shell: error on 0 dimension without anchorsIsaac Freund
The protocol requires clients to set opposing anchors when requesting a width or height of 0. The goal of this patch is not to break clients that rely on this behavior but to improve the consistency of the layer shell ecosystem through adherence to the protocol.
2020-10-08xwm: add loop detection for read_surface_parentRouven Czerwinski
Implement a simple loop detection while trying to retrieve the parent for a TRANSIENT_FOR window. Fixes swaywm/sway#4624
2020-09-16backend: remove check for _WAYLAND_DISPLAYSimon Ser
I'm not sure what this was used for, but it's not used by libwayland. Setting _WAYLAND_DISPLAY would result in the Wayland backend being picked but would ignore the actual value of the env variable.
2020-09-10layer-shell: add for_each_popupIsaac Freund
This brings the layer-shell api in line with that of xdg-shell and avoids reimplementing this function in every compositor in order to render layer shell popups correctly.
2020-09-04output-management-v1: send head identifying informationRoman Gilg
With version 2 we send make, model and serial number to allow clients the identification of heads.
2020-09-04output-management-v1: add head identifying eventsRoman Gilg
The following information through separate events are added: - make - model - serial_number This should allow clients to identify a display over different sessions and load configuration data back. A note is added that the description should be preferred when representing a display in UI to users but as a short form for example the model could be used in this case of course too.
2020-09-04xwayland: disconnect display destroy listener even if xwayland didn't initializeIlia Bozhinov
2020-09-04Accommodate for CONFIG_VT=0, all TTYs are in seat0, but not allnerdopolis
seat0s have TTYs
2020-09-04session: Don't refuse unprivileged creation of "direct" backendPatrick Steinhardt
When starting a compositor that's using the "direct" session backend, wlroots needs to handle calls to `drmSetMaster()` and `drmDropMaster()`. As both calls used to require `CAP_SYS_ADMIN`, wlroots thus simply refused starting in case the process doesn't enjoy evelated privileges. Permission rules have changed since linux.git commit 45bc3d26c95a (drm: rework SET_MASTER and DROP_MASTER perm handling, 2020-03-19). As a result, starting with Linux v5.8, both ioctls will now also succeed if the process is currently or has been the DRM master. And as the first process to open render nodes will become the DRM master automatically, this effectively means that process elevation is not strictly required in all setups anymore. So let's drop the `geteuid() != 0` permission check to allow those new rules to do their magic.
2020-09-04wayland: emit relative pointer events only for current pointerIlia Bozhinov
2020-09-03Remove xdg-shell v6Drew DeVault
Ding dong the witch is dead Fixes #2381
2020-09-02Quieten failure to set login session typeRyan Walklin
(almost certainly due to systemd version <246)
2020-09-01backend/session/libseat: register log handlerSimon Ser
Route libseat errors through wlroots logging infrastructure. This requires libseat 0.2.0.
2020-09-01Fix undefined behaviorValentin
Without the casts the bytes accesses get converted to int. but int is not guaranteed to be 4 bytes large. Even when it is 4 bytes large `bytes[3] << 24` does not fit because int is signed.
2020-09-01Use fixed size integer typeValentin
This type is meant to be 4 bytes large as seen in _XcursorReadUInt which always reads 4 bytes. An unsigned int is often 4 bytes large but this isnt' guaranteed so it is cleaner to use the exact type we want.
2020-08-31examples/dmabuf-capture: add extra roundtrip for wl_output listenerSimon Ser
This example was relying on wl_display_dispatch being enough to fetch output information. This worked by chance. Add an explicit wl_display_roundtrip. Other examples don't setup wl_output listeners, so they should be fine. Fixes: 297354f84772 ("Remove unnecessary wl_display_dispatch calls") Closes: https://github.com/swaywm/wlroots/issues/2386
2020-08-27output-power-management-v1: listen to output commitSimon Ser
2020-08-27output: introduce wlr_output_event_commitSimon Ser
This event contains a `committed` bitfield, which allows callers to know which output fields changed during the commit. This allows users to setup a single atomic commit listener, instead of setting up one listener for each event (mode, scale, transform, and so on). References: https://github.com/swaywm/wlroots/issues/2098
2020-08-27render: Don't crash on 0 dimensionsGuido Cella
Don't force compositors to check when an empty shape is being renderered. References #2282. This was motivated by dwl crashing when setting window borders to 0 (djpohly/dwl#51).
2020-08-27xdg-shell: split last-acked and current stateIsaac Freund
These states are distinct in the time period between the ack_configure and the next commit on the surface. Splitting these states avoids the following race for example: - client starts at 1000x1000 - wlr_xdg_toplevel_set_size 500x500 - size is different -> configure sent - client acks the configure - wlr_xdg_toplevel_set_size 1000x1000 - compare_xdg_toplevel_state returns true since there is no pending configure and the currently committed size is still 1000x1000 - no new configure is sent - client commits at the size it last acked, 500x500
2020-08-26session: Add missing init to direct-freebsdKenny Levinsen
bad1e9afa8ea ("session: Add libseat backend") introduced a change to to how session backends initialize, but failed to update the FreeBSD specific version of the direct backend accordingly. Closes: https://github.com/swaywm/wlroots/issues/2376
2020-08-24Remove unnecessary wl_display_dispatch callsSimon Ser
wl_display_roundtrip already takes care of dispatching the display.
2020-08-24session: Add libseat backendKenny Levinsen
2020-08-17backend/wayland: destroy relative pointer when output is disconnectedIlia Bozhinov
Fixes #2243 Fixes #2106
2020-08-14examples/simple: use wlr_renderer instead of GLSimon Ser
2020-08-14examples/simple: use wlr_output_preferred_modeSimon Ser
2020-08-09wlr_virtual_keyboard: fix fd leakDaniel De Graaf
2020-08-07Don't set XDG_SESSION_TYPE unless logind SetType succeedsRyan Walklin
2020-08-07Also set XDG_SESSION_TYPERyan Walklin
2020-08-07Implement logind session SetType method to change session type to waylandRyan Walklin
2020-08-05gamma-control-v1: fix use-after-free in gamma_control_handle_set_gammaSimon Ser
gamma_control_send_failed destroys gamma_control.
2020-08-03make sure to fail setting gamma on disabled outputsIlia Bozhinov
2020-07-31drm: fix uninitialized readDevin J. Pohly
get_drm_prop_blob does not set path_len if it returns NULL. Check the return value before path_len to avoid reading uninitialized memory. (Granted, this doesn't change the logic at all, but it does make Valgrind a bit happier.)
2020-07-30xwayland: do not allow apps to change focus after wlroots requestIlia Bozhinov
2020-07-28render/gles2: remove gles2_procsSimon Ser
Move the global into wlr_gles2_renderer. This removes global state and allows us to have multiple renderers with different GL loaders.
2020-07-28render/gles2: make push/pop debug functions take a wlr_rendererSimon Ser
2020-07-28render/gles2: keep ref to wlr_gles2_renderer in wlr_gles2_textureSimon Ser
2020-07-28render/gles2: make wlr_gles2_texture_from_* privateSimon Ser
These functions are unused by compositors (see e.g. [1]) and prevent wlr_gles2_texture from accessing wlr_gles2_renderer state. This is an issue for proper teardown [2] and for accessing GLES2 extensions. [1]: https://github.com/swaywm/wlroots/pull/1962#issuecomment-569511830 [2]: https://github.com/swaywm/wlroots/pull/1962
2020-07-28examples: remove unnecessary gles2.h importsRouven Czerwinski
2020-07-27xwm: Set _NET_WM_STATE_FOCUSED property for the focused surfaceScott Moreau
Certain clients require this property to be set for expected behavior. Most notably, steam client CSD maximize button no longer worked after unmaximizing once, unless the state was changed by another method. The state is unset whenever another surface gains focus.
2020-07-27xwayland: free server in error pathAntonin Décimo
2020-07-27Fix incorrect format parametersAntonin Décimo
2020-07-27virtual_pointer: remember current axis for axis eventsRonan Pigott