labwc/include
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 SnapToRegion: Add implementation 2023-01-10 23:29:10 +01:00
config src/config/rcxml.c: allow clearing key/mouse bindings 2023-02-03 03:30:10 +01:00
menu menu: Dynamically adjust menu width based on widest item 2022-12-06 21:08:43 +00:00
xbm Prepare to move from wlr_texture to lab_data_buffer 2022-02-23 21:47:01 +00:00
action.h src/action.c: Provide generic parsing of XML action arguments 2022-12-10 19:55:53 +00:00
buffer.h src/buffer: Automatically adapt to scale attribute 2022-06-14 22:03:08 +01:00
cursor.h cursor: update cursor image on scale change 2023-01-26 22:02:13 +00:00
debug.h Add debug_dump_scene() 2022-02-23 21:47:01 +00:00
dnd.h cursor: Restore drag icon after the move to scene-graph 2022-10-17 21:22:12 +01:00
key-state.h seat: only pass on sent keys on surface-focus 2022-09-21 21:25:13 +01:00
labwc.h Add xdg-activation protocol 2023-02-10 20:51:29 +00:00
layers.h layer: remove wl_list layers[] from struct output 2022-12-29 23:18:08 +01:00
meson.build Make xwayland support optional 2020-12-30 10:29:21 +00:00
node.h src/ssd: Convert button node descriptors to struct ssd_button 2022-06-09 22:04:35 +01:00
regions.h SnapToRegion: Allow for live config updates 2023-01-11 18:52:24 +01:00
resistance.h Add SPDX identifiers 2021-11-13 21:56:53 +00:00
ssd-internal.h view: Use wlr_box for current/pending geometry 2023-02-09 10:44:15 -05:00
ssd.h include/ssd.h: prefix defines with SSD_ 2023-01-06 18:32:36 +01:00
theme.h menu: Dynamically adjust menu width based on widest item 2022-12-06 21:08:43 +00:00
view.h xdg: Just call view_center() now that it uses pending width/height 2023-02-09 18:26:44 +01:00
workspaces.h view: Rename/move workspaces_send_to() to view_move_to_workspace() 2022-11-22 09:17:33 +01:00
xwayland.h xwayland: Add xwayland.h and move more things to xwayland.c 2023-01-07 22:22:55 -05:00