Re: Detect window manager using KWindowSystem

2014-10-26 Thread Paulo Lieuthier
Sorry, I've had some problems with my email and the list. Well,
checking the window manager's name is much more reliable, I tested
with many window managers and it worked with all. That's how I'm
doing:

bool LxQtModuleManager::nativeEvent
Filter(const QByteArray  eventType, void * message, long * result)
{
// a new window manager is started
if (!mWmStarted  mWaitLoop)
{
if (!QString(NETRootInfo(QX11Info::connection(),
NET::SupportingWMCheck).wmName()).isEmpty)
{
qDebug()  Window Manager started;
mWmStarted = true;
if (mWaitLoop-isRunning())
mWaitLoop-exit();
}
}

if (!mTrayStarted  QSystemTrayIcon::isSystemTrayAvailable()  mWaitLoop)
{
qDebug()  System Tray started;
mTrayStarted = true;
if (mWaitLoop-isRunning())
mWaitLoop-exit();

qApp-removeNativeEventFilter(this);
}

return false;
}

The reason for this is that lxqt-session only open the autostart
progams after the window manager is active (and the programs that ask
for a system tray after the system tray is active as well). There
probably is a better way, but that's our solution for now. Thanks for
your help!

Paulo Lieuthier


On Sun, Oct 19, 2014 at 10:15 AM, Thomas Lübking
thomas.luebk...@gmail.com wrote:
 On Sonntag, 19. Oktober 2014 15:08:51 CEST, Martin Gräßlin wrote:

 Might be worth adding it:
 bool NETRootInfo::isCompliantWindowManagerRunning() const?


 It certainly won't harm, but the question is: who actually needs such?

 WM's operate on the WM selection - and right now, i cannot imagine why any
 client should check for that (optional client side window management? ;-)

 - @Paulo, why do you need to check for this? (And do you want a bashlet?
 ;-)

 Cheers,
 Thomas



-- 

Paulo Lieuthier

Porque ainda um pouquinho de tempo, E o que há de vir virá, e não tardará.
-- Hebreus 10:37


Re: Re: Detect window manager using KWindowSystem

2014-10-19 Thread Martin Gräßlin
On Saturday 18 October 2014 15:34:53 Thomas Lübking wrote:
 You MUST check the hinted support window anyway, because if the WM was
 killed -9 or -11 it will unlikely (in case of -9 no way) have withdrawn
 any root property and your findings based upon this data alone would be
 wrong.
 
 There's no convenience function for that in KWindowSystem, is there?
 (I don't see it)

I just looked at the API as well and also cannot see a convenience function. 
Might be worth adding it:

bool NETRootInfo::isCompliantWindowManagerRunning() const?

Cheers
Martin


signature.asc
Description: This is a digitally signed message part.


Re: Detect window manager using KWindowSystem

2014-10-19 Thread Thomas Lübking

On Sonntag, 19. Oktober 2014 15:08:51 CEST, Martin Gräßlin wrote:


Might be worth adding it:
bool NETRootInfo::isCompliantWindowManagerRunning() const?


It certainly won't harm, but the question is: who actually needs such?

WM's operate on the WM selection - and right now, i cannot imagine why any 
client should check for that (optional client side window management? ;-)

- @Paulo, why do you need to check for this? (And do you want a bashlet? ;-)

Cheers,
Thomas


Re: Detect window manager using KWindowSystem

2014-10-18 Thread Thomas Lübking

On Freitag, 17. Oktober 2014 14:56:16 CEST, Paulo Lieuthier wrote:

I'm now trying to check if there is an active window manager, 
for lxqt-session. That's what I'm doing:


NETRootInfo rootInfo(QX11Info::connection(), NET::Supported);
qDebug()  SupportingWMCheck:  
rootInfo.isSupported(NET::SupportingWMCheck);

That appears to be the correct way to check it


NETWM spec:
---
NET_SUPPORTING_WM_CHECK, WINDOW/32
The Window Manager MUST set this property on the root window to be the ID of a 
child window created by himself, to indicate that a compliant window manager is 
active. The child window MUST also have the _NET_SUPPORTING_WM_CHECK property 
set to the ID of the child window. The child window MUST also have the 
_NET_WM_NAME property set to the name of the Window Manager.

Rationale: The child window is used to distinguish an active Window Manager 
from a stale _NET_SUPPORTING_WM_CHECK property that happens to point to another 
window. If the _NET_SUPPORTING_WM_CHECK window on the client window is missing 
or not properly set, clients SHOULD assume that no conforming Window Manager is 
present.
---

tl;dr:
---
you must fetch the support window WId from the root property and check the 
property again on that window.
KWin does apparently not withdraw the root property (not even the support 
list), but isn't oblieged to do so either.

You MUST check the hinted support window anyway, because if the WM was killed -9 or -11 
it will unlikely (in case of -9 no way) have withdrawn any root property and 
your findings based upon this data alone would be wrong.

There's no convenience function for that in KWindowSystem, is there?
(I don't see it)

Cheers,
Thomas