Commit Graph

427 Commits

Author SHA1 Message Date
Simon Ser 2827ec6b7b xwayland: enable use of a xserver subproject
Makes it easier to work on Xwayland and wlroots features in
parallel.

References: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1048
2023-05-04 18:02:32 +00:00
Kirill Primak 039cca8a51 xwm: emit new_surface/destroy on associate/dissociate 2023-03-09 18:51:47 +00:00
Kirill Primak ad51983b23 xwm: make atom_map static 2023-03-09 18:51:47 +00:00
Kirill Primak 774d2c82f0 xwm: remove misleading comment
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-03-07 17:51:27 +00:00
John Lindgren 7d90cd055d xwayland: Send synthetic ConfigureNotify per ICCCM 4.1.5
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-21 09:32:06 +00:00
John Lindgren 068280201a xwayland: Read and publish _NET_WM_STRUT_PARTIAL property
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-13 12:57:20 -05:00
Kirill Primak b355a12751 xwayland/shell: actually use wlr_xwayland_surface_v1.link
Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3575
2023-02-03 16:38:12 +03:00
Simon Ser 03412e9aab xwayland/xwm: reset serial in xwayland_surface_dissociate()
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-01 16:33:15 +00:00
Kirill Primak fbf5982e38 xwayland/xwm: introduce wlr_xwayland_surface_try_from_wlr_surface()
This new function replaces wlr_surface_is_xwayland_surface() and
wlr_xwayland_surface_from_wlr_surface().
2023-02-01 16:13:21 +00:00
Simon Ser cef1811547 xwayland/xwm: remove unnecessary surface_id reset
xwayland_surface_associate() already does this.
2022-12-22 15:45:18 +01:00
Simon Ser 445ce7eac6 xwayland/xwm: assert that we're not overwriting when associating
Make sure xwayland_surface_associate() is not called twice in a
row without a xwayland_surface_dissociate() call in-between.
2022-12-22 15:44:15 +01:00
Kirill Primak a922428c41 xwayland/xwm: dissociate even if surface is NULL
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-22 14:40:58 +00:00
Kirill Primak 1cd53f54b7 xwayland/xwm: constify needles 2022-12-18 13:55:39 +03:00
Simon Ser 9b7ee63774 xwayland: use HAVE_ prefix for xcb_xfixes_set_client_disconnect_mode
86fc2199f8 ("build: unify naming for HAVE_* defines") has
switched over all other feature defines from HAS_* to HAVE_*, but
missed this one.
2022-12-08 02:06:40 +01:00
Simon Ser 1ed5137720 xwayland: remove find_program() fallback when dep is not found
The dep allows us to check dep variables to discover supported
features. With the binary we assume none of the features are
supported. If a user forgets to install the pkg-config file (e.g.
because it's in a split package) we end up incorrectly disabling
all features. Instead let's error out.
2022-12-08 01:58:34 +01:00
Simon Ser 86fc2199f8 build: unify naming for HAVE_* defines
We sometimes used HAS_, sometimes polluted the LIBINPUT_ namespace,
etc.
2022-12-06 22:39:45 +00:00
Simon Ser 4da9b32a15 xwayland: use internal_config
Avoids the need to have a separate config.h, and removes C compiler
arguments.
2022-12-06 22:39:45 +00:00
Simon Ser 532f3d3c20 xwayland/xwm: replace role with addon
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3545
2022-12-05 18:48:15 +01:00
Simon Ser d962918128 xwayland/xwm: rename xwm_map_shell_surface()
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-12-05 10:51:46 +01:00
Simon Ser 4ff46e6cf9 xwayland/xwm: add support for xwayland-shell-v1 2022-11-18 15:35:20 +00:00
Simon Ser 85b37127a6 xwayland/shell: add wlr_xwayland_shell_v1_surface_from_serial() 2022-11-18 15:35:20 +00:00
Simon Ser d19191ff6b xwayland/server: delay non-lazy startup
This allows users to setup event listeners before the server is
actually started.
2022-11-18 15:35:20 +00:00
Simon Ser 3f40b0031f xwayland/server: add start signal
This can be used to know when wlr_xwayland_server decides to start
a new Xwayland process. At that point the wl_client has already
been created but the Xwayland process hasn't been started yet.
2022-11-18 15:35:20 +00:00
Simon Ser d3b84463f8 xwayland: add wlr_xwayland_shell_v1_destroy() 2022-11-18 15:35:20 +00:00
Simon Ser 44c7e233ff xwayland: add wlr_xwayland_shell_v1_set_client() 2022-11-18 15:35:20 +00:00
Simon Ser 69b0b296a2 xwayland-shell-v1: new protocol implementation
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/163
2022-11-18 15:35:20 +00:00
Kirill Primak 099b9de752 compositor: drop role object NULL checks in handlers
Instead, move the check to the caller.
2022-11-06 17:00:00 +03:00
Kirill Primak 32daa43a45 xwayland/xwm: use role object destroy handler 2022-11-06 17:00:00 +03:00
Simon Ser 05454618cd xwayland: split headers
We're about to get one more Xwayland-related thing, and this header
already contains two things.
2022-11-02 19:00:23 +01:00
Simon Ser 2ee59e1a08 xwyland/xwm: simplify unpaired_link handling
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-19 09:26:03 +00:00
Alexander Orzechowski 4f920a206c xwayland: Simplify net_wm_edges_to_wlr 2022-10-18 16:57:59 -04:00
Alexander Orzechowski ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
Kenny Levinsen 668b2740ff Set mapped before firing map/unmap events
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-08-06 00:19:38 +02:00
Joshua Ashton 02e648c1b2 xwayland: Add support for -force-xrandr-emulation 2022-05-23 07:30:28 +00:00
Simon Ser f575e445ec xwayland: terminate when no client is connected
Automatically shutdown Xwayland 10s after all X11 clients have
gone away.
2022-05-07 19:25:44 +00:00
Simon Ser 352064d76d xwayland: add wlr_xwayland_server_options.terminate_delay
This allows users to specify a delay after which the Xwayland process
terminates itself when there are no more X11 clients connected.
2022-05-07 19:25:44 +00:00
Simon Ser 6c350799b2 Zero-initialize structs in init functions
Ensures there is no field left to its previous undefined value after
calling an init function.
2022-04-28 10:09:50 +02:00
zsugabubus 91da4c557b xwayland: do not double free server on destroy 2022-04-23 08:08:33 +00:00
John Lindgren 640f3b9f21 Revert "Copy xcb_icccm structs into wlroots"
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 12b9b1a4bd.
2022-04-17 14:44:52 +00:00
Dominique Martinet 4741e9d841 Xwayland: use -displayfd instead of USR1
Using Xwayland -displayfd means we don't need to worry about handling
SIGUSR1 to second guess when Xwayland is ready and write to the pipe:
just let it do that write when it would be sending SIGUSR1 otherwise.

Closes: #3356
2022-03-02 14:25:21 +00:00
Dominique Martinet 1666e377e2 Xwayland: rename notify pipe 'p' to notify_fd 2022-03-02 14:25:21 +00:00
Kirill Primak 50827ed7f5 surface: improve role precommit hook
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-13 15:15:54 +03:00
Kirill Primak 617eb4fb93 surface: deprecate wlr_surface.h 2022-01-13 10:06:41 +00:00
Simon Ser 3e801d68f2 xwayland: add support for -noTouchPointerEmulation
This allows compositors to handle touch pointer emulation manually,
instead of having Xwayland do it [1].

[1]: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/691
2021-11-02 12:02:51 +01:00
Guido Günther e479dc1ef0 xwayland: Allow to retrieve startup-id via _NET_STARTUP_INFO
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-11 09:53:23 +02:00
Simon Ser ba0525c5c0 surface: drop wlr_surface_state.buffer_resource
Instead, use wlr_surface_state.buffer only.
2021-09-06 14:21:23 -04:00
Tudor Brindus bfc69decdd xwm: do not restack surfaces on activation
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-28 22:04:01 +02:00
Guido Günther de1522aeee xwayland: Allow to retrieve _NET_STARTUP_ID
This is use for startup notifications per startup-notifiation spec

https://specifications.freedesktop.org/startup-notification-spec/startup-notification-latest.txt
2021-08-20 10:44:22 +02:00
Michele Sorcinelli cae7b98136 xwayland: do not free cursor in handle_server_ready()
If XWayland terminates for any reason, xwm_set_cursor() has to
to be called again, so the cursor has to stick around.
2021-08-17 09:17:59 +02:00
Simon Ser 770a561bce xwayland: embed wlr_xwayland_server_options in server struct
As more options are added, more fields will be duplicated. Let's
just embed the struct in wlr_xwayland_server so that we don't need
to keep both in sync.
2021-07-27 00:18:11 +02:00