Bug 453494 - Polkit password dialog should open centered above parent application rather than respecting window positioning method
Summary: Polkit password dialog should open centered above parent application rather t...
Status: CONFIRMED
Alias: None
Product: policykit-kde-agent-1
Classification: Plasma
Component: general (show other bugs)
Version: 5.24.4
Platform: Manjaro Linux
: NOR wishlist
Target Milestone: ---
Assignee: Dario Freddi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-07 11:50 UTC by kde.org
Modified: 2023-05-07 20:16 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
qdbus org.kde.KWin /KWin supportInformation > supinfo.txt (4.67 KB, text/plain)
2022-05-07 11:50 UTC, kde.org
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kde.org 2022-05-07 11:50:45 UTC
Created attachment 148633 [details]
qdbus org.kde.KWin /KWin supportInformation > supinfo.txt

SUMMARY
I have a rather large screen (880mm x 490mm). When I  use it under Wayland, the password authentication dialog opens in a free space somewhere on my screen, making it hard to recognize that it opened. When using X11, the dialog always opens centered on the screen, regardless of the free space and displayed windows on my desktop. I'd prefer that the password window would open centered above the requesting application, or at least centered on the same screen, like it does on X11.

STEPS TO REPRODUCE
1. kate /etc/fstab
2. change anything in the file 
3. save it

OBSERVED RESULT
Polkit password window opens somewhere on the desktop/screen, depending on the layout of currently opened windows. 

EXPECTED RESULT
Polkit password window opens centered above the Kate window, or alternatively Polkit password window opens centered on screen, like it does on wayland.


SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 5.15.32-1-MANJARO (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-4670 CPU @ 3.40GHz
Memory: 15,3 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 4600

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2022-05-09 17:34:44 UTC
Can confirm: seems like it gets opened according to the KWin window placement mode instead of being treated as a dialog with a parent window that it can be centered within.
Comment 2 kde.org 2022-05-13 11:36:53 UTC
I just updated to 5.24.5 and the issue seems to be gone. Behavior on Wayland is the same as on X11, at least for me now. 
@Nate, can you still reproduce it with 5.24.5?
Comment 3 Nate Graham 2022-05-13 14:03:16 UTC
Still broken for me on git master (which will be 5.25), which means something may have regressed if it works for you on 5.24.5.

Are you certain it wasn't working by accident because the window that spawned the dialog appeared in the center of the screen? Does it work if yo manually move a window to a screen corner and then trigger the auth dialog?
Comment 4 kde.org 2022-05-13 16:43:14 UTC
Hmm, that's weird, I'll reopen then. For me it previously only displayed the window centered, when there was no free space left on the desktop that the window would fit in. After upgrading to 5.24.5 the dialog is always centered, no matter where the window of the application requesting the authorization is located. It also doesn't matter how much free space is available on my desktop, either. I tried it a couple of times now, using pamac to install new software, changing root files with kate, ... The window is always centered on wayland now.
Comment 5 kde.org 2022-05-13 16:44:54 UTC
I'm wondering who is actually responsible for the placement. As the centering works on X11, is this something kwin_wayland is responsible for, or is that something polkit  must take care of?
Comment 6 Nate Graham 2022-05-13 17:08:36 UTC
It must not be getting a parent window set properly on Wayland somehow. That's how this works on X11; child windows are always centered in their parent windows. And that works on Wayland too as long as the parent window is properly set.
Comment 7 kde.org 2022-05-13 17:37:27 UTC
If it works like you describe it, then I don't think it has a parent window set in X11, either. At least for me, in X11 it always centers on the screen and is not displayed centered above in the application window, requesting the authentication. If I understand the way the integration of the polkit window works correctly, the requesting application asks for the authentication to performed via dbus. Therefore the polkit window is running in a separate process and doesn't have any information about the windows of the calling application. Hence, polkit cannot easily set the parent window. Imagine a command run on the commandline in konsole requesting authorization, for example  "pamac" in Manjaro. That command doesn't even have any windows. If this command requests authorization, polkit would have to figure out that the command is run from within konsole and then find out, which of the Konsole windows it's run from. As this is quite complicated to get right and would probably require a lot of information passed on dbus between the applications and polkit, it's probably easier for polkit to just open the window centered on the screen. As I have only one screen, I wouldn't even know if polkit manages to display the window on the correct screen.