[Interest] Window ID of the current screen (root window)?

Volker Hilsheimer volker.hilsheimer at qt.io
Fri Nov 20 08:58:22 CET 2020


> On 20 Nov 2020, at 03:42, mirabilos <t.glaser at tarent.de> wrote:
> 
> On Thu, 19 Nov 2020, Thiago Macieira wrote:
> 
>> Then pass nothing.
> 
> That reportedly causes problems with kwallet.
> 
>> If the application is run non-interactively and possibly 
>> without GUI, then it doesn't have access window IDs.
> 
> It does run with a GUI, but the only UI elements it has are those
> rendered by the kwallet service (things like the unlock prompt);
> it requires a GUI display even if itself only uses stdio and command
> line arguments.
> 
>> What application are you launching? Because KWallet is a D-Bus service and 
>> kwalletmanager doesn't require window IDs.
> 
> http://www.mirbsd.org/cvs.cgi/contrib/hosted/tg/code/kwalletcli/kwif5.cc?rev=1.2
> 
> Search for openWallet there.
> 
> The window ID was added by the person who ported this to KDE 5;
> apparently, this is necessary now.
> 
> Thanks,
> //mirabilos


In Qt 6 there is no more Qt API to get the X11 root window for a display (also note that QDesktopWidget as a whole is gone).

So, you either have to go native if you rely on X11 specific data structures (which the code does anyway, in verifying that there is a DISPLAY environment variable), or pass a pointer to (or index of) a QScreen if you want to place a UI on a specific display.


Volker



More information about the Interest mailing list