NEVER call XInternAtom in an application like kwin that provides

a nifty interface for XInternAtom_s_. Have a look at atoms.cpp

svn path=/trunk/kdebase/kwin/; revision=48914
icc-effect-5.14.5
Matthias Ettrich 2000-05-08 21:22:57 +00:00
parent 27f0e99920
commit eb9d29938b
3 changed files with 45 additions and 45 deletions

View File

@ -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];

View File

@ -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;
};

View File

@ -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 )