labwc/src
Consolatis f56d07aa47 Add xdg-activation protocol
This PR allows applications to activate themselves *if they provide
a valid xdg_activation token* (e.g. raise to the top and get keyboard
focus).

These tokens are given out by the xdg_activation protocol implemented
by wlroots and can be configured by the client requesting the token
in three ways:
- an "empty" token
  (apparently used to tell the compositor about "urgency")
- seat / input serial attached
- surface attached

Wlroots makes sure that
- If the client attached the seat / input serial: those two are valid.
- If the client attached a surface: that it has keyboard focus at the
  point where the request is finalized. There is a patch [1] pending
  for backport to wlroots 0.16 that also allows valid tokens when the
  supplied surface had cursor focus.
- a token is only valid for 30 seconds after being given out

The token can then be used by the client or given to other clients by
unspecified means (e.g. via environment variable or dbus) which then
may use the token on their own surface and request activation.

We only handle the actual request activation part:
- If the seat is set on the token we know wlroots validated seat and
  input serial
- Thus, if no seat is set we deny the activation request so we don't
  have windows suddenly popping up and taking over the keyboard focus
  (focus stealing prevention)
- We should also check for the surface being set but we can't do that
  with wlroots 0.16 as it will reset the surface to `NULL` when it is
  destroyed (which is something that usually happens for
  notifications). Once we move to wlroots 0.17.x we can add the
  missing surface check because it provides a `new_token` signal.
  We can use it to attach further details to the token which are then
  verified later when we decide if we allow the activate request or
  not.

With this PR in place the following setup should activate windows:
- launching an URL in foot should activate the target application if
  it is already running, foot requests a proper token and then sets it
  as `XDG_ACTIVATION_TOKEN` environment var before spawning `xdg-open`
- clicking on a `mako` notification with a `default` action defined
  should request a proper token which is then given to the application
  starting the notification and can thus be used to activate itself

This protocol is still very much in the process of being
implemented / finalized all over the place (e.g. GTK / QT / Firefox /
notification daemons, ..) but we should do our part and remove labwc
from the puzzle of potential issues causing this not to work.

[1] f6008ffff4)
2023-02-10 20:51:29 +00:00
..
common Enable more compiler warnings 2023-02-01 10:42:22 +01:00
config src/config/rcxml.c: allow clearing key/mouse bindings 2023-02-03 03:30:10 +01:00
menu menu: Compute usable area for the correct output 2023-02-09 00:33:56 -05:00
ssd view: Use wlr_box for current/pending geometry 2023-02-09 10:44:15 -05:00
xbm Enable more compiler warnings 2023-02-01 10:42:22 +01:00
action.c view: Use wlr_box for current/pending geometry 2023-02-09 10:44:15 -05:00
buffer.c common: Add znew/znew_n() macros 2022-09-18 15:25:19 -04:00
cursor.c view: Use wlr_box for current/pending geometry 2023-02-09 10:44:15 -05:00
debug.c Enable more compiler warnings 2023-02-01 10:42:22 +01:00
desktop.c layer: improve keyboard-interactivity 2023-01-29 14:31:49 +00:00
dnd.c cursor: Restore drag icon after the move to scene-graph 2022-10-17 21:22:12 +01:00
foreign.c view: Use wlr_box for current/pending geometry 2023-02-09 10:44:15 -05:00
interactive.c view: Use wlr_box for current/pending geometry 2023-02-09 10:44:15 -05:00
key-state.c Enable more compiler warnings 2023-02-01 10:42:22 +01:00
keyboard.c src/config/rcxml.c: allow clearing key/mouse bindings 2023-02-03 03:30:10 +01:00
layers.c layer: improve keyboard-interactivity 2023-01-29 14:31:49 +00:00
main.c menu: Add generic menu_init() entry point 2022-12-06 21:08:43 +00:00
meson.build SnapToRegion: Add config parser 2023-01-11 18:52:23 +01:00
node.c common: Add znew/znew_n() macros 2022-09-18 15:25:19 -04:00
osd.c SnapToRegion: Add overlay while moving and pressing a modifier 2023-01-11 18:52:24 +01:00
output.c src/output.c: only overwrite the automatic layout if necessary 2023-01-29 14:36:15 +00:00
regions.c SnapToRegion: Allow for live config updates 2023-01-11 18:52:24 +01:00
resistance.c view: Use wlr_box for current/pending geometry 2023-02-09 10:44:15 -05:00
seat.c layer: improve keyboard-interactivity 2023-01-29 14:31:49 +00:00
server.c Add xdg-activation protocol 2023-02-10 20:51:29 +00:00
theme.c CodeStyle: prevent space in code indents 2023-01-31 21:22:40 +00:00
touch.c Chase wlroots: wlr_scene is now a tree node 2022-06-07 07:13:37 +01:00
view-impl.c include: Break out view.h from labwc.h 2022-11-21 21:42:37 +00:00
view.c xdg: Just call view_center() now that it uses pending width/height 2023-02-09 18:26:44 +01:00
workspaces.c src/workspaces.c: prevent re-focus for always-on-top views 2022-12-29 18:58:25 +01:00
xdg-deco.c CodeStyle: prevent space in code indents 2023-01-31 21:22:40 +00:00
xdg-popup.c view: Use wlr_box for current/pending geometry 2023-02-09 10:44:15 -05:00
xdg.c Add xdg-activation protocol 2023-02-10 20:51:29 +00:00
xwayland-unmanaged.c CodeStyle: prevent space in code indents 2023-01-31 21:22:40 +00:00
xwayland.c xdg: Fix positioning of initially-maximized views 2023-02-10 10:45:16 +01:00