Commit Graph

49 Commits

Author SHA1 Message Date
Grigory Kirillov 0867dd4e6b xwayland: add support for _NET_WM_WINDOW_TYPE_DESKTOP atom 2024-01-25 19:27:37 +03:00
John Lindgren af165acb42 xwayland: add wlr_xwayland_set_workareas()
This function allows compositors to set the _NET_WORKAREA property on
the root window. XWayland clients use _NET_WORKAREA to determine how
much of the screen is not covered by panels/docks. The property is used
for example by Qt to determine areas of the screen that popup menus
should not overlap (see QScreen::availableVirtualGeometry).
2023-10-26 15:05:08 -04:00
Kirill Primak a09d649439 docs: replace the less commonly used "::" with "." 2023-10-02 22:10:16 +03:00
Kirill Primak ad51983b23 xwm: make atom_map static 2023-03-09 18:51:47 +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
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 6c897756b6 build: use a configuration file for internal features
This avoids re-building the whole project when switching one
Meson option. This shrinks down the compiler invocation command
line, making it more readable and making it easier to inspect
which flags are passed in (the generated file can be opened).
Additionally this is more consistent with our external feature
handling, which uses <wlr/config.h> already.
2022-12-06 22:39:45 +00:00
Simon Ser 4ff46e6cf9 xwayland/xwm: add support for xwayland-shell-v1 2022-11-18 15:35:20 +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
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
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
Tudor Brindus ae2f3ecb68 xwm: implement _NET_CLIENT_LIST_STACKING
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-31 10:41:29 +02:00
Aleksei Bavshin e0f239fa28 xwayland: query window PIDs via XResQueryClientIds
`_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-23 09:55:01 +02:00
Simon Ser 1eb38e0015 Remove WLR_HAS_XCB_ERRORS
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-04-09 21:54:38 +02:00
Simon Ser de5347d0f2 xwayland: require xcb-icccm
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-29 12:24:26 +02:00
Manuel Stoeckl 79be26ff1f xwayland/xwm: make atom_map const 2021-02-05 10:04:20 +01:00
Tudor Brindus 2fa257313a xwayland/selection: use one target window per selection
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-02-04 17:06:14 +01:00
Tudor Brindus 7964a313e8 xwayland/selection: use one X11 window per incoming transfer
This commit introduces logic for using a new X11 window for each
incoming transfer, rather than having a global window for each selection
source.

This eliminates a whole class of bugs involving multiple concurrent
incoming transfers.

For now, we retain the outgoing transfer queue, and the selection
source-specific windows to support it. Source-specific windows are no
longer used in the incoming path, and will be removed in a future PR.

Refs #1497.
2021-02-04 13:33:59 +01:00
Simon Ser 5a2ef794dc xwayland: drop unused enum net_wm_state_action 2021-01-27 10:47:16 +01:00
Ilia Bozhinov 74f7be7287 xwayland: do not allow apps to change focus after wlroots request 2020-07-30 13:40:36 +02:00
Scott Moreau 6d0ee53e1a xwm: Set _NET_WM_STATE_FOCUSED property for the focused surface
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-27 14:26:30 +02:00
Tobias Langendorf bd387da62d xwm: add support for xwayland minimize 2020-07-21 13:20:17 +02:00
Simon Ser 27609ba0d9 xwayland: split server
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-05-19 22:07:47 +02:00
Simon Ser 4bb391c896 xwayland: remove underscore prefix from atom names
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-06 21:34:44 +01:00
Simon Ser 175af4f74f xwayland: remove duplicate _NET_WM_NAME entry 2020-03-06 21:34:44 +01:00
Simon Ser 68a69ee079 xwayland: use explicit indexes when initializing atom_map
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-03-06 21:34:44 +01:00
Uli Schlachter e7d9cf5815 xwm: Add _NET_CLIENT_LIST support
Fixes: https://github.com/swaywm/wlroots/issues/1469
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-15 11:08:54 +01:00
emersion 4cb0697e57 data-device, primary-selection: add request_set_selection
This makes compositors able to block and/or customize set_selection requests
coming from clients. For instance, it's possible for a compositor to disable
rich selection content (by removing all MIME types except text/plain). This
commit implements the design proposed in [1].

Two new events are added to wlr_seat: request_set_selection and
request_set_primary_selection. Compositors need to listen to these events and
either destroy the source or effectively set the selection.

Fixes https://github.com/swaywm/wlroots/issues/1138

[1]: https://github.com/swaywm/wlroots/issues/1367#issuecomment-442403454
2019-01-24 11:38:23 +01:00
emersion 51bfdd620e
Use #if instead of #ifdef for wlroots config data
This prevents some annoying issues when e.g. not including wlr/config.h or
making a typo in the guard name.
2018-11-12 10:12:46 +01:00
emersion f745befc06
xwayland: fix typo to enable transparency
We spent literally hours trying to debug this. Turns out it's a typo.

Kill me.
2018-10-27 11:59:27 +02:00
Ryan Dwyer b8cc4a4152 xwayland: Introduce set_role event 2018-09-03 17:07:14 +10:00
Ryan Dwyer 69a5279f79 xwayland: Add WM_STATE modal property
Adds a modal property to indicate whether the surface wants to be a
modal.
2018-09-02 08:50:04 +02:00
emersion 7f70d244a9
xwayland: fix some Chromium comboboxes
Some comboboxes (e.g. in chrome://flags) are advertized as…
Notifications of course! Yeah, notifications, the thing that
tells you you have mail, your battery is low, or the dog has
eaten your carpet. This isn't the first time we notice Chromium's
X11 backend is pretty shit.

Anyway, added notifications and splash screens to the list of
unmanaged windows. Also removed utility windows because those
should be managed, but maybe I'm wrong and I'll revert this.
2018-04-26 23:18:59 +01:00
emersion 17d0440b75
Add wlr_xwayland_surface_ping 2018-04-08 16:28:01 -04:00
emersion c55ad11d96
xwayland: add _NET_WM_WINDOW_TYPE_MENU support 2018-04-08 12:02:52 -04:00
emersion 591ea27cf9
xwayland: refactor selection code 2018-04-03 12:56:54 -04:00
emersion 8f84c5b05f
xwayland: only send one target at a time 2018-04-03 00:44:04 -04:00
emersion 92b74071d0
xwayland: support multiple wayland → xwayland selection transfers
This fixes drag'n'drop support for Chromium.
2018-04-02 19:56:41 -04:00
emersion cadfccf1fd
xwayland: use a separate window for drag'n'drop 2018-03-29 17:53:47 -04:00
emersion ca2a73b90d
xwayland: allow drag data source transfer after drag ends 2018-03-29 11:40:19 -04:00
emersion 6fd50947bd
xwayland: improve error handling 2018-03-28 21:36:53 -04:00
emersion 2a34b154e6
xwayland: send DND_DROP 2018-03-28 15:33:23 -04:00
emersion 73394deb76
xwayland: send DND_POSITION 2018-03-28 14:16:14 -04:00
emersion 0d7a81ccdf
xwayland: send DND_ENTER 2018-03-28 12:59:11 -04:00
emersion b6c1760de5
xwayland: create DND window, add DND atom helpers 2018-03-27 12:04:37 -04:00
Dominique Martinet a0b52a0dff Fix x11 backend
Need to include wlr/config.h before using the various WLR_HAS_xxx defines
2018-03-27 09:20:21 +02:00
Dominique Martinet 2910972b25 xwm.h: fix guard ifdef and remove wlr_ prefix from xwm_atoms_contains 2018-03-04 11:16:18 +01:00
Dominique Martinet d9a724c4a2 xcb errors: init errors context at start
`xcb_errors_context_new` is more than just a malloc, it does a few
xcb requests so we benefit from not generating a new context everytime
2018-03-03 17:06:30 +01:00
Dominique Martinet 7d1870c6f1 move xwm.h out of include/wlr
xwm.h was meant to be private, so move it to include/xwayland/xwm.h
We had an ifdef WLR_HAS_XCB_ICCCM in xwayland.h which was easy to move
to xwm, it is not safe to use the WLR_HAS_* in the public headers.

I checked a few of our current users and none rely on xwm.h being
public as expected (rootston, sway, hsroots)
2018-03-03 17:03:21 +01:00
Renamed from include/wlr/xwm.h (Browse further)