Port staticWmClientLeader to XCB
Removes usage of kxerrorhandler in kwin/toplevel.cpp
This commit is contained in:
parent
8a5972b8cb
commit
687e264387
2 changed files with 8 additions and 19 deletions
25
toplevel.cpp
25
toplevel.cpp
|
@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "toplevel.h"
|
#include "toplevel.h"
|
||||||
|
|
||||||
#include <kxerrorhandler.h>
|
|
||||||
|
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
#ifdef KWIN_BUILD_ACTIVITIES
|
||||||
#include "activities.h"
|
#include "activities.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -172,24 +170,15 @@ QByteArray Toplevel::staticWmCommand(WId w)
|
||||||
/*!
|
/*!
|
||||||
Returns WM_CLIENT_LEADER property for a given window.
|
Returns WM_CLIENT_LEADER property for a given window.
|
||||||
*/
|
*/
|
||||||
Window Toplevel::staticWmClientLeader(WId w)
|
xcb_window_t Toplevel::staticWmClientLeader(xcb_window_t w)
|
||||||
{
|
{
|
||||||
Atom type;
|
xcb_connection_t *c = connection();
|
||||||
int format, status;
|
auto cookie = xcb_get_property_unchecked(c, false, w, atoms->wm_client_leader, XCB_ATOM_WINDOW, 0, 10000);
|
||||||
unsigned long nitems = 0;
|
ScopedCPointer<xcb_get_property_reply_t> prop(xcb_get_property_reply(c, cookie, nullptr));
|
||||||
unsigned long extra = 0;
|
if (prop.isNull() || prop->value_len <= 0) {
|
||||||
unsigned char *data = 0;
|
return w;
|
||||||
Window result = w;
|
|
||||||
KXErrorHandler err;
|
|
||||||
status = XGetWindowProperty(display(), w, atoms->wm_client_leader, 0, 10000,
|
|
||||||
false, XA_WINDOW, &type, &format,
|
|
||||||
&nitems, &extra, &data);
|
|
||||||
if (status == Success && !err.error(false)) {
|
|
||||||
if (data && nitems > 0)
|
|
||||||
result = *((Window*) data);
|
|
||||||
XFree(data);
|
|
||||||
}
|
}
|
||||||
return result;
|
return static_cast<xcb_window_t*>(xcb_get_property_value(prop.data()))[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -389,7 +389,7 @@ private:
|
||||||
static QByteArray staticSessionId(WId);
|
static QByteArray staticSessionId(WId);
|
||||||
static QByteArray staticWmCommand(WId);
|
static QByteArray staticWmCommand(WId);
|
||||||
static QByteArray staticWmClientMachine(WId);
|
static QByteArray staticWmClientMachine(WId);
|
||||||
static Window staticWmClientLeader(WId);
|
static xcb_window_t staticWmClientLeader(xcb_window_t);
|
||||||
// when adding new data members, check also copyToDeleted()
|
// when adding new data members, check also copyToDeleted()
|
||||||
Window client;
|
Window client;
|
||||||
Window frame;
|
Window frame;
|
||||||
|
|
Loading…
Reference in a new issue