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=48914icc-effect-5.14.5
parent
27f0e99920
commit
eb9d29938b
|
@ -62,6 +62,9 @@ Atoms::Atoms()
|
||||||
atoms[n] = &net_kde_docking_windows;
|
atoms[n] = &net_kde_docking_windows;
|
||||||
names[n++] = (char *) "_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 );
|
XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_return );
|
||||||
for (int i = 0; i < n; i++ )
|
for (int i = 0; i < n; i++ )
|
||||||
*atoms[i] = atoms_return[i];
|
*atoms[i] = atoms_return[i];
|
||||||
|
|
1
atoms.h
1
atoms.h
|
@ -29,6 +29,7 @@ public:
|
||||||
Atom net_wm_context_help;
|
Atom net_wm_context_help;
|
||||||
|
|
||||||
Atom net_kde_docking_windows;
|
Atom net_kde_docking_windows;
|
||||||
|
Atom net_avoid_spec;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
18
client.cpp
18
client.cpp
|
@ -1931,26 +1931,22 @@ void Client::updateAvoidPolicy()
|
||||||
// Find out if we should be avoided.
|
// Find out if we should be avoided.
|
||||||
|
|
||||||
// If this atom isn't set, set it now.
|
// If this atom isn't set, set it now.
|
||||||
Atom avoidAtom = XInternAtom(qt_xdisplay(), "_NET_AVOID_SPEC", False);
|
|
||||||
|
|
||||||
XTextProperty avoidProp;
|
XTextProperty avoidProp;
|
||||||
|
|
||||||
Status avoidStatus =
|
Status avoidStatus = XGetTextProperty(qt_xdisplay(), win, &avoidProp, atoms->net_avoid_spec );
|
||||||
XGetTextProperty(qt_xdisplay(), win, &avoidProp, avoidAtom);
|
|
||||||
|
|
||||||
if (0 != avoidStatus) {
|
if (avoidStatus) {
|
||||||
|
|
||||||
// qDebug("XGetTextProperty worked for atom _NET_AVOID_SPEC");
|
// qDebug("XGetTextProperty worked for atom _NET_AVOID_SPEC");
|
||||||
|
|
||||||
char ** avoidList;
|
char ** avoidList;
|
||||||
int avoidListCount;
|
int avoidListCount;
|
||||||
|
|
||||||
Status convertStatus =
|
Status convertStatus = XTextPropertyToStringList(&avoidProp, &avoidList, &avoidListCount);
|
||||||
XTextPropertyToStringList(&avoidProp, &avoidList, &avoidListCount);
|
|
||||||
|
|
||||||
if (0 != convertStatus) {
|
if (convertStatus) {
|
||||||
|
|
||||||
// qDebug("XTextPropertyToStringList succeded");
|
// qDebug("XTextPropertyToStringList succeded");
|
||||||
|
|
||||||
avoid_ = true;
|
avoid_ = true;
|
||||||
|
|
||||||
|
@ -1961,7 +1957,7 @@ void Client::updateAvoidPolicy()
|
||||||
|
|
||||||
char * itemZero = avoidList[0];
|
char * itemZero = avoidList[0];
|
||||||
|
|
||||||
// qDebug("Anchoring to border %s", itemZero);
|
// qDebug("Anchoring to border %s", itemZero);
|
||||||
|
|
||||||
switch (*itemZero) {
|
switch (*itemZero) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue