Commit Graph

433 Commits

Author SHA1 Message Date
Kirill Primak 3dc646ea88 Add some missing includes/declarations 2023-06-05 21:06:19 +00:00
Kirill Primak 17230d33c1 xwm: check for a buffer before mapping 2023-06-02 22:44:21 +03:00
Kirill Primak 26676c8c07 xwm: use unified map logic 2023-06-02 17:26:18 +00:00
Kirill Primak 75d03f2b68 xwm: introduce associate/dissociate events
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-02 15:54:25 +00:00
Kirill Primak 2d6a09d9f0 Revert "xwm: emit new_surface/destroy on associate/dissociate"
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 039cca8a51.

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3606
2023-06-02 15:54:25 +00:00
novenary d7917d2076 xwayland: allow compositor to set withdrawn state 2023-05-04 18:05:00 +00:00
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