Skip to content

Support parent window and focussing on Wayland

Kai Uwe Broulik requested to merge work/kbroulik/xdg-foreign into master

Allows the Polkit prompt to parent itself to the respective origin window (using XDG Foreign) and actiate itself (using XDG Activation).

Two new DBus methods are introduced to set the window handle and activation token respectively.

The code now also handles the tokens being provided asynchronously, i.e. after the dialog has already been shown.

While at it, re-implement parent handling on X which seemed to have gone missing in the QtQuick port.


KAuth side: powerdevil!282 (diffs)

Of course needs the caller to set KAuth::Action::setWindow, cf. powerdevil!282 (merged)

The old DBus method is kept for compatibility.

  • Window is properly parented to kcmshell6 and systemsettings window when changing charge threshold
  • Didn’t test X11 yet
  • The activation doesn’t seem to work properly, with “extreme” focus stealing prevention, that is. By default KWin focusses any new window but I’d like to be future-proof and correct here.

KAuth does

[ 906202.181]  -> xdg_activation_v1@36.get_activation_token(new id xdg_activation_token_v1@56)
[ 906202.192]  -> xdg_activation_token_v1@56.set_surface(wl_surface@40)
[ 906202.199]  -> xdg_activation_token_v1@56.set_app_id("kcm_powerdevilglobalconfig")
[ 906202.207]  -> xdg_activation_token_v1@56.set_serial(179932, wl_seat@9)
[ 906202.213]  -> xdg_activation_token_v1@56.commit()
[ 906202.951] xdg_activation_token_v1@56.done("kwin-693")

Polkit agent does

[ 962207.431]  -> xdg_activation_v1@36.activate("kwin-693", wl_surface@40)

Yet KWin doesn’t focus it and doesn’t print anything in journal. Needs more investigation.

@sitter @devinlin @vladz @davidedmundson @davidre

Edited by Kai Uwe Broulik

Merge request reports