aboutsummaryrefslogtreecommitdiff
path: root/xwayland/xwm.c
AgeCommit message (Collapse)Author
2023-07-09xwayland: pass NULL as event dataSimon Ser
This is more extensible: in the future we can introduce event structs if we need to.
2023-07-09xwayland: use initializer for struct wlr_xwayland_resize_eventSimon Ser
Ensures there are no fields with uninitialized memory. Also remove an outdated TODO: Xwayland only supports a single seat.
2023-07-09xwayland: drop struct wlr_xwayland_move_eventSimon Ser
This only contains the xsurface, which isn't particularly useful.
2023-06-02xwm: check for a buffer before mappingKirill Primak
2023-06-02xwm: use unified map logicKirill Primak
2023-06-02xwm: introduce associate/dissociate eventsKirill Primak
We'll soon introduce a unified wlr_surface map event. Up until now, compositors have been using wlr_xwayland_surface's map event to setup various wlr_surface related listeners (e.g. commit). This will no longer be possible when that event is moved over to wlr_surface. Introduce new events where the compositor can add/remove wlr_surface event listeners.
2023-06-02Revert "xwm: emit new_surface/destroy on associate/dissociate"Kirill Primak
Firing new_surface when a wlr_surface is associated to the X11 window is too late: the X11 client might've sent configure events before that. This reverts commit 039cca8a51ed0783d45fb7a5215e9ae83e4e02e2. Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3606
2023-05-04xwayland: allow compositor to set withdrawn statenovenary
2023-03-09xwm: emit new_surface/destroy on associate/dissociateKirill Primak
2023-03-09xwm: make atom_map staticKirill Primak
2023-03-07xwm: remove misleading commentKirill Primak
The surfaces are stored in the bottom-to-top order, as specified in include/xwayland/xwm.h and expected by wlr_xwayland_surface_restack().
2023-02-21xwayland: Send synthetic ConfigureNotify per ICCCM 4.1.5John Lindgren
X11 clients expect a ConfigureNotify after a ConfigureRequest. If the compositor/window manager chooses not to honor the request (e.g. due to the window being maximized), XWayland will not send a "real" ConfigureNotify event and the window manager is expected to send a synthetic event instead. Otherwise, the X11 client is left waiting and may not repaint its window properly. For comparison, see Openbox's client_configure() or Weston's weston_wm_window_send_configure_notify(). v2: Move logic to wlr_xwayland_surface_configure()
2023-02-13xwayland: Read and publish _NET_WM_STRUT_PARTIAL propertyJohn Lindgren
This is needed for compositors that want to reserve space for XWayland panels. Such a feature can be useful in a "transitional" setup, where only the X11 window manager and compositor is replaced but other components of an X11 desktop environment are still used. This change simply reads the X11 property; the compositor is free to ignore it. Thus, compositors that don't want to support such a "transitional" feature are not impacted. v2: Update xwayland_surface_associate()
2023-02-01xwayland/xwm: reset serial in xwayland_surface_dissociate()Simon Ser
The same X11 window can be used multiple times with a different wl_surface. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3570
2023-02-01xwayland/xwm: introduce wlr_xwayland_surface_try_from_wlr_surface()Kirill Primak
This new function replaces wlr_surface_is_xwayland_surface() and wlr_xwayland_surface_from_wlr_surface().
2022-12-22xwayland/xwm: remove unnecessary surface_id resetSimon Ser
xwayland_surface_associate() already does this.
2022-12-22xwayland/xwm: assert that we're not overwriting when associatingSimon Ser
Make sure xwayland_surface_associate() is not called twice in a row without a xwayland_surface_dissociate() call in-between.
2022-12-22xwayland/xwm: dissociate even if surface is NULLKirill Primak
If a window is unmapped too quickly, we might receive UnmapNotify before we get the corresponding wl_surface, which will later lead to associating the same window twice. To fix this, move the NULL surface check to xwayland_surface_dissociate(), which makes resetting the unpaired link and the wl_surface object ID unconditional. Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3552
2022-12-18xwayland/xwm: constify needlesKirill Primak
2022-12-08xwayland: use HAVE_ prefix for xcb_xfixes_set_client_disconnect_modeSimon Ser
86fc2199f85a ("build: unify naming for HAVE_* defines") has switched over all other feature defines from HAS_* to HAVE_*, but missed this one.
2022-12-06build: unify naming for HAVE_* definesSimon Ser
We sometimes used HAS_, sometimes polluted the LIBINPUT_ namespace, etc.
2022-12-05xwayland/xwm: replace role with addonSimon Ser
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3545
2022-12-05xwayland/xwm: rename xwm_map_shell_surface()Simon Ser
Rename xwm_map_shell_surface() to xwayland_surface_associate(). This function doesn't actually "map" the surface in Wayland parlance, the wl_surface may not have a buffer attached yet.
2022-11-18xwayland/xwm: add support for xwayland-shell-v1Simon Ser
2022-11-06compositor: drop role object NULL checks in handlersKirill Primak
Instead, move the check to the caller.
2022-11-06xwayland/xwm: use role object destroy handlerKirill Primak
2022-10-19xwyland/xwm: simplify unpaired_link handlingSimon Ser
Always keep it initialized, so that we don't have to check for xsurface->surface_id. Will help with WL_SURFACE_SERIAL support, which adds a new way for a surface to be unpaired.
2022-10-18xwayland: Simplify net_wm_edges_to_wlrAlexander Orzechowski
2022-08-18Use wl_signal_emit_mutableAlexander Orzechowski
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.