diff --git a/clients/oxygen/x11util.cpp b/clients/oxygen/x11util.cpp index e4b232fc80..3fe43e5ab3 100644 --- a/clients/oxygen/x11util.cpp +++ b/clients/oxygen/x11util.cpp @@ -52,39 +52,31 @@ namespace Oxygen Atom net_supported( findAtom( _NET_SUPPORTED ) ); Atom searched( findAtom( atom ) ); - Atom actual; + Atom type; int format; unsigned char *data; - unsigned long offset = 0; + unsigned long count; + unsigned long unused; - while( 1 ) - { - unsigned long n, left; - XGetWindowProperty( display, QX11Info::appRootWindow(), - net_supported, offset, 1L, - false, XA_ATOM, &actual, - &format, &n, &left, - (unsigned char **) &data); + // get window property + if( XGetWindowProperty( + display, QX11Info::appRootWindow(), + net_supported, 0l, 2048l, + false, XA_ATOM, &type, + &format, &count, &unused, (unsigned char **) &data) != Success ) + { return false; } - if( data == None ) break; + if( type != XA_ATOM || format != 32 || count <= 0 || data == None ) + { return false; } - // try cast data to atom - Atom found( *(Atom*)data ); + long *states = (long *) data; + bool found = false; + static bool first( true ); + for( unsigned long i = 0; i