summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2007-07-28 14:58:04 +0200
committerDanny Baumann <dannybaumann@web.de>2007-07-28 14:58:04 +0200
commit99d2831d90691ae066d920ab244e9a400bfa8117 (patch)
treead85209f162a213752125e30da2760b917d0487e
parentcb532d9bc22a993e11fea72f56a3978cb2f8990b (diff)
downloadworkarounds-99d2831d90691ae066d920ab244e9a400bfa8117.tar.gz
workarounds-99d2831d90691ae066d920ab244e9a400bfa8117.tar.bz2
Added Qt window fix (taken from animation plugin).
-rw-r--r--workarounds.c72
-rw-r--r--workarounds.xml.in5
2 files changed, 77 insertions, 0 deletions
diff --git a/workarounds.c b/workarounds.c
index ef24c08..17858df 100644
--- a/workarounds.c
+++ b/workarounds.c
@@ -19,8 +19,10 @@
*/
#include <string.h>
+#include <limits.h>
#include <compiz.h>
+#include <X11/Xatom.h>
#include <workarounds_options.h>
static CompMetadata workaroundsMetadata;
@@ -28,6 +30,8 @@ static int displayPrivateIndex;
typedef struct _WorkaroundsDisplay {
int screenPrivateIndex;
+
+ Atom roleAtom;
} WorkaroundsDisplay;
typedef struct _WorkaroundsScreen {
@@ -61,6 +65,39 @@ typedef struct _WorkaroundsWindow {
GET_WORKAROUNDS_SCREEN (w->screen, \
GET_WORKAROUNDS_DISPLAY (w->screen->display)))
+static char *
+workaroundsGetWindowRoleAtom (CompWindow *w)
+{
+ CompDisplay *d = w->screen->display;
+ Atom type;
+ unsigned long nItems;
+ unsigned long bytesAfter;
+ unsigned char *str = NULL;
+ int format, result;
+ char *retval;
+
+ WORKAROUNDS_DISPLAY (d);
+
+ result = XGetWindowProperty (d->display, w->id, wd->roleAtom,
+ 0, LONG_MAX, FALSE, XA_STRING,
+ &type, &format, &nItems, &bytesAfter,
+ (unsigned char **) &str);
+
+ if (result != Success)
+ return NULL;
+
+ if (type != XA_STRING)
+ {
+ XFree (str);
+ return NULL;
+ }
+
+ retval = strdup ((char *) str);
+
+ XFree (str);
+
+ return retval;
+}
static void
workaroundsDoLegacyFullscreen (CompWindow *w)
@@ -145,6 +182,39 @@ workaroundsWindowAddNotify (CompWindow *w)
}
}
+ if (workaroundsGetQtFix (w->screen->display) && !appliedFix)
+ {
+ char *windowRole;
+
+ /* fix tooltips */
+ windowRole = workaroundsGetWindowRoleAtom (w);
+ if (windowRole)
+ {
+ if ((strcmp (windowRole, "toolTipTip") == 0) ||
+ (strcmp (windowRole, "qtooltip_label") == 0))
+ {
+ w->wmType = CompWindowTypeTooltipMask;
+ appliedFix = TRUE;
+ }
+
+ free (windowRole);
+ }
+
+ /* fix Qt transients - FIXME: is there a better way to detect them? */
+ if (!appliedFix)
+ {
+ Time t;
+ Bool res;
+
+ res = getWindowUserTime (w, &t);
+ if (res && !w->resName && (w->wmType == CompWindowTypeUnknownMask))
+ {
+ w->wmType = CompWindowTypeDropdownMenuMask;
+ appliedFix = TRUE;
+ }
+ }
+ }
+
recalcWindowType (w);
if (workaroundsGetLegacyFullscreen (w->screen->display))
@@ -171,6 +241,8 @@ workaroundsInitDisplay (CompPlugin *plugin, CompDisplay *d)
return FALSE;
}
+ wd->roleAtom = XInternAtom (d->display, "WM_WINDOW_ROLE", 0);
+
d->privates[displayPrivateIndex].ptr = wd;
return TRUE;
diff --git a/workarounds.xml.in b/workarounds.xml.in
index 5c9aaed..139a544 100644
--- a/workarounds.xml.in
+++ b/workarounds.xml.in
@@ -28,6 +28,11 @@
<_long>Fix window type of various Java windows.</_long>
<default>true</default>
</option>
+ <option type="bool" name="qt_fix">
+ <_short>Qt Window Fix</_short>
+ <_long>Fix window type of various Qt windows.</_long>
+ <default>true</default>
+ </option>
</display>
<screen>
</screen>