diff --git a/atoms.cpp b/atoms.cpp index 83d57269a9..6710531782 100644 --- a/atoms.cpp +++ b/atoms.cpp @@ -37,7 +37,7 @@ Atoms::Atoms() atoms[n] = &kwm_command; names[n++] = (char *) "KWM_COMMAND"; - + atoms[n] = &motif_wm_hints; names[n++] = (char *) "_MOTIF_WM_HINTS"; @@ -62,6 +62,9 @@ Atoms::Atoms() atoms[n] = &net_kde_docking_windows; names[n++] = (char *) "_NET_KDE_DOCKING_WINDOWS"; + atoms[n] = &net_avoid_spec; + names[n++] = (char *) "_NET_AVOID_SPEC"; + XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_return ); for (int i = 0; i < n; i++ ) *atoms[i] = atoms_return[i]; diff --git a/atoms.h b/atoms.h index 4ae39e9e5e..ba4de21754 100644 --- a/atoms.h +++ b/atoms.h @@ -18,7 +18,7 @@ public: Atom kwm_win_icon; // compatibility Atom kwm_command; // compatibility Atom kwm_running; - + Atom motif_wm_hints; Atom net_number_of_desktops; @@ -29,6 +29,7 @@ public: Atom net_wm_context_help; Atom net_kde_docking_windows; + Atom net_avoid_spec; }; diff --git a/client.cpp b/client.cpp index f04abb7a42..2e136bce5c 100644 --- a/client.cpp +++ b/client.cpp @@ -1928,67 +1928,63 @@ QCString Client::sessionId() void Client::updateAvoidPolicy() { // qDebug("kwin: Client::updateAvoidPolicy() - win id == %x", (int)win); - // Find out if we should be avoided. + // Find out if we should be avoided. // If this atom isn't set, set it now. - Atom avoidAtom = XInternAtom(qt_xdisplay(), "_NET_AVOID_SPEC", False); + XTextProperty avoidProp; - XTextProperty avoidProp; + Status avoidStatus = XGetTextProperty(qt_xdisplay(), win, &avoidProp, atoms->net_avoid_spec ); - Status avoidStatus = - XGetTextProperty(qt_xdisplay(), win, &avoidProp, avoidAtom); + if (avoidStatus) { - if (0 != avoidStatus) { + // qDebug("XGetTextProperty worked for atom _NET_AVOID_SPEC"); -// qDebug("XGetTextProperty worked for atom _NET_AVOID_SPEC"); + char ** avoidList; + int avoidListCount; - char ** avoidList; - int avoidListCount; + Status convertStatus = XTextPropertyToStringList(&avoidProp, &avoidList, &avoidListCount); - Status convertStatus = - XTextPropertyToStringList(&avoidProp, &avoidList, &avoidListCount); + if (convertStatus) { - if (0 != convertStatus) { + // qDebug("XTextPropertyToStringList succeded"); -// qDebug("XTextPropertyToStringList succeded"); + avoid_ = true; - avoid_ = true; + if (avoidListCount != 1) { + qDebug( "kwin: Client::updateAvoidPolicy(): " + "Extra values in avoidance list. Ignoring."); + } - if (avoidListCount != 1) { - qDebug( "kwin: Client::updateAvoidPolicy(): " - "Extra values in avoidance list. Ignoring."); - } + char * itemZero = avoidList[0]; - char * itemZero = avoidList[0]; + // qDebug("Anchoring to border %s", itemZero); -// qDebug("Anchoring to border %s", itemZero); + switch (*itemZero) { - switch (*itemZero) { + case 'N': + anchorEdge_ = AnchorNorth; + break; + case 'S': + anchorEdge_ = AnchorSouth; + break; + case 'E': + anchorEdge_ = AnchorEast; + break; + case 'W': + anchorEdge_ = AnchorWest; + break; + default: + avoid_ = false; + break; + } - case 'N': - anchorEdge_ = AnchorNorth; - break; - case 'S': - anchorEdge_ = AnchorSouth; - break; - case 'E': - anchorEdge_ = AnchorEast; - break; - case 'W': - anchorEdge_ = AnchorWest; - break; - default: - avoid_ = false; - break; - } + XFreeStringList(avoidList); - XFreeStringList(avoidList); + } else + qDebug( "kwin: Client::updateAvoidPolicy(): " + "XTextPropertyToStringList failed"); - } else - qDebug( "kwin: Client::updateAvoidPolicy(): " - "XTextPropertyToStringList failed"); - - } + } } NoBorderClient::NoBorderClient( Workspace *ws, WId w, QWidget *parent, const char *name )