aboutsummaryrefslogtreecommitdiff
path: root/xwayland/xwm.c
AgeCommit message (Collapse)Author
2022-08-06Set mapped before firing map/unmap eventsKenny Levinsen
This allows whatever the user calls from the signal handlers to react to observe the new state rather than the old, e.g. that a surface is no longer mapped in the unmap handler.
2022-05-07xwayland: terminate when no client is connectedSimon Ser
Automatically shutdown Xwayland 10s after all X11 clients have gone away.
2022-04-17Revert "Copy xcb_icccm structs into wlroots"John Lindgren
The original commit introduced a bug by transposing the order of some of the fields in xcb_size_hints_t. Since XCB ICCCM support is required now, we can just eliminate the duplicate structs. With minor changes: - Remove #ifdef HAS_XCB_ICCCM guards - Fix #includes - Fix references to local size_hints struct This reverts commit 12b9b1a4bdf00742cc510c2329c7a66c649b3ab0.
2022-01-13surface: improve role precommit hookKirill Primak
Now the role precommit hook is called before the commit, not on wl_surface.commit request, and takes a state which is to be applied.
2022-01-13surface: deprecate wlr_surface.hKirill Primak
2021-09-11xwayland: Allow to retrieve startup-id via _NET_STARTUP_INFOGuido Günther
A launchee notifies with a "remove"¹ message when done starting up. Catch these and forward to the compositor. This allows the compositor to end the startup sequence that might have been started by another protocol like xdg-activation. We don't handle other messages since we expect the launcher to use a wayland protocol like xdg-activation. While `_NET_STARTUP_ID` helps to associate toplevels with startup-ids this signals the end of the startup sequence. 1) https://specifications.freedesktop.org/startup-notification-spec/startup-notification-latest.txt
2021-09-06surface: drop wlr_surface_state.buffer_resourceSimon Ser
Instead, use wlr_surface_state.buffer only.
2021-08-28xwm: do not restack surfaces on activationTudor Brindus
Currently, upon activating a surface, wlroots restacks it on top of all others. This may not necessarily be correct from the calling compositor's point of view, where having focus may not imply being top-of-stack (e.g., focusing a window under an always-on-top window). In Sway's case, this means that focused tiling windows will always be on top of floating windows, at least in the order communicated to X11 apps. This breaks drag-and-drop from a focused tiling X11 window to a floating X11 window which partially obscures the former. This is a breaking change; to retain the previous behavior, users that were calling wlr_xwayland_surface_activate(xsurface, true); should now be calling wlr_xwayland_surface_activate(xsurface, true); wlr_xwayland_surface_restack(xsurface, NULL, XCB_STACK_MODE_ABOVE);
2021-08-20xwayland: Allow to retrieve _NET_STARTUP_IDGuido Günther
This is use for startup notifications per startup-notifiation spec https://specifications.freedesktop.org/startup-notification-spec/startup-notification-latest.txt
2021-05-31xwm: prevent X11 clients from blowing our stack by opening too many windowsTudor Brindus
Allocate window arrays for list property updates on the heap instead.
2021-05-31xwm: implement _NET_CLIENT_LIST_STACKINGTudor Brindus
This property is present on all modern X11 instances. The nonpresence of it requires applications to fall back to XQueryTree-based logic to determine stacking logic (e.g., to determine what surface should get Xdnd events). These code paths are effectively untested nowadays, so this makes it more likely for wlroots to "break" applications. For instance, the XQueryTree fallback path has been broken in Chromium for the last 10 years. It's easy enough to maintain this property, so let's just do it. Fixes #2889.
2021-05-31xwm: use correct list link when iterating over `unpaired_surfaces`Tudor Brindus
2021-04-23xwayland: remove _NET_WM_PID handlerAleksei Bavshin
We already get the PID from XRes and _NET_WM_PID code can overwrite it with incorrect data.
2021-04-23xwayland: query window PIDs via XResQueryClientIdsAleksei Bavshin
`_NET_WM_PID` is unreliable: it is optional and even if set it may contain PIDs from sandbox namespaces or remote systems. Prefer XRes v1.2 QueryClientIds method which returns PIDs as seen by the Xwayland server.
2021-04-09Remove WLR_HAS_XCB_ERRORSSimon Ser
wlroots' dependency on this library doesn't change the features exposed to compositors. It's purely a wlroots implementation detail. Thus downstream compositors shouldn't really care about it. Introduce an "internal_features" dictionary to store the status of such internal dependencies.
2021-03-29xwayland: use ICCCM state defines from xcb-icccmSimon Ser
2021-03-29xwayland: require xcb-icccmSimon Ser
This dependency is already required by many other widely used X11 programs, such as i3, Qt, and other XWMs. So it should be available on most systems. X11 support can be pretty broken without xcb-icccm, with focus issues for instance. Let's just remove this --please-break-my-desktop footgun option.
2021-03-29xwayland: assume no WM_HINTS means window wants inputSimon Ser
Some X11 clients (e.g. Chromium, sxiv) don't set WM_HINTS. The spec says: > Window managers are free to assume convenient values for all fields of the > WM_HINTS property if a window is mapped without one. Our wlr_xwayland_icccm_input_model function assumes missing WM_HINTS means the window doesn't want input, but this is incorrect. Assume the window wants input unless it explicitly opts-out by setting WM_HINTS. Closes: https://github.com/swaywm/sway/issues/6107
2021-02-05xwayland: free render picture backing cursorIlia Mirkin
Otherwise it gets leaked never to be recovered.
2021-02-05xwayland/xwm: make atom_map constManuel Stoeckl
2021-02-04xwayland/selection: use one target window per selectionTudor Brindus
Previously, the clipboard and primary selections shared the same window. This was racey, and could have led to pasting failures. On xfixes selection owner change notification, the logic for requesting the supported mimetypes of the new owner's selection looks like: xcb_convert_selection( xwm->xcb_conn, selection->window, selection->atom, xwm->atoms[TARGETS], xwm->atoms[WL_SELECTION], selection->timestamp ); This means ask the selection owner to write its TARGETS for the `selection->atom` selection (one of PRIMARY, CLIPBOARD, DND_SELECTION) to `selection->window`'s WL_SELECTION atom. However, `selection->window` is shared for both PRIMARY and CLIPBOARD selections, and WL_SELECTION is used as the target atom in both cases. So, there's a race when both selections change at the same time. The CLIPBOARD selection might support mimetypes {A, B, C}, and the PRIMARY only {A, B}. If the ConvertSelection requests/responses "cross on the wire", so to speak, wlroots can end up believing that the PRIMARY selection also supports C. A Wayland client may then ask for the PRIMARY selection in C format, which will fail with "convert selection failed". This commit fixes this by using a separate window for PRIMARY and CLIPBOARD target requests, so that WL_SELECTION can be used as the target atom in both cases.
2021-01-31xwayland/selection: make xwm_selection_init take a wlr_xwm_selection *Tudor Brindus
This makes it consistent with xwm_selection_finish.
2021-01-31xwayland/selection: make xwm_selection_finish take a wlr_xwm_selection *Tudor Brindus
Previously it took a wlr_xwm *, which was a bit surprising in that it freed members of wlr_xwm *, not just its respective selections.
2021-01-28xwayland: fix extraneous NET_WM_STATE log messagesSimon Ser
wlroots would log "Unhandled NET_WM_STATE property change" log messages for atoms we know about. Simplify the code structure and remove these extra messages.
2021-01-20Expose ICCCM input statusBrassyPanache
In certain situations windows can have their input field set to false but still expect to receive input focus by passively listening to key presses via a parent window. The ICCCM specification outlines how focus should be given to clients. Further reading: https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7 Relates to #2604
2021-01-10xwayland: remove protocol debug messagesSimon Ser
Developers can use x11trace or similar to analyze the protocol messages.
2020-12-15Remove inline keywordSimon Ser
The compiler is smarter at figuring out whether a function should be inlined or not.
2020-11-30xwm: add wlr_xwayland_surface_restack()Ilia Bozhinov
2020-11-03xwayland: log unhandled NET_WM_STATE property changesSimon Ser
2020-11-03xwayland: minor code style fixesSimon Ser
2020-10-14xwayland: add set_geometry eventIlia Bozhinov
This is necessary to react to changes in position of override-redirect views.
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-07-30xwayland: do not allow apps to change focus after wlroots requestIlia Bozhinov
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-27Fix incorrect format parametersAntonin Décimo
2020-07-22xwayland/xwm: use initializer for props in xsurface_set_wm_stateSimon Ser
This avoids uninitialized items and makes it clear where the magic number 2 is coming from.
2020-07-22xwayland/xwm: add prop count assert in xsurface_set_net_wm_stateSimon Ser
This helps mitigate buffer overflows.
2020-07-22xwayland/xwm: don't insert surface in list on errorSimon Ser
In case wl_event_loop_add_timer errors out, don't insert the free'd wlr_xwayland_surface in the list. Closes: https://github.com/swaywm/wlroots/issues/1721
2020-07-21xwm: add support for xwayland minimizeTobias Langendorf
2020-07-03xwm: end transfers when the requestor is destroyedJohn Chadwick
This improves the failure cases when incremental transfers fail to complete successfully for one reason or another.
2020-06-30xwm: Destroy xwm on hangup or errorScott Moreau
If Xwayland is restarted, the ready handler assumes there is no xwm instance. This means all of xwm was leaked on Xwayland restart. This caused compositors to consume all cpu resources, where time is spent dispatching. Now we destroy xwm if we get an event mask containing WL_EVENT_HANGUP or WL_EVENT_ERROR.
2020-05-25xwayland: send focus change event unconditionallyTudor Brindus
This fixes issues with (at least) dialogs in Jetbrains IDEs becoming unclickable if they ever lost focus (ref. swaywm/sway#5373). Prior to this change, since `xwm->focus_surface` would be set prior to `xwm_surface_activate` being called, the latter would short-circuit immediately and not notify the application of the focus change.
2020-05-19xwayland: split serverSimon Ser
Split the server part of wlr_xwayland into wlr_xwayland_server. This allows compositors to implement their own XWM when wlroots' isn't a good fit.
2020-03-06xwayland: remove underscore prefix from atom namesSimon Ser
Previously, some atoms had a leading underscore, others didn't. Be more consistent and never use a leading underscore (symbols with a leading underscore followed by an upper-case letter are reserved).
2020-03-06xwayland: remove duplicate _NET_WM_NAME entrySimon Ser
2020-03-06xwayland: use explicit indexes when initializing atom_mapSimon Ser
It's very easy to break the mapping between the atom_name enum and the atom_map array. Use explicit indexes to prevent issues.
2020-02-19xwayland: ignore pointer focus changesSimon Ser
This reflects what i3 does [1]. [1]: https://github.com/i3/i3/blob/b3faf9fca9254679a4715486a4de80ebaee70410/src/handlers.c#L1076 Fixes: c067fbc010da ("xwm: allow applications to change focus between their own surfaces") Closes: https://github.com/swaywm/sway/issues/4926
2020-01-05xwm: allow applications to change focus between their own surfacesIlia Bozhinov
Although currently this problem is present in only Steam, and it is actually a client bug.
2019-10-08xwayland: Expose configure request maskScott Moreau
Without this information, compositors have no way to tell whether or not to consider the position information valid. Most notably, a compositor needs to know if it should pick a position for the surface or use the position sent in the configure request.
2019-08-12xwayland: prevent possible array overrunAntonin Décimo