diff options
author | Yann Droneaud <ydroneaud@mandriva.com> | 2009-03-24 12:59:01 +0100 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2009-04-14 10:25:06 -0400 |
commit | f15e054cfb103f78a04ace9eefaecddac8bc70e6 (patch) | |
tree | c36cf61febccedc6733e12f96aa414f799081105 | |
parent | Check for _NET_WM_CM_Sn before trying to install ourself as composite manager (diff) | |
download | xcman-f15e054cfb103f78a04ace9eefaecddac8bc70e6.tar.gz xcman-f15e054cfb103f78a04ace9eefaecddac8bc70e6.tar.bz2 xcman-f15e054cfb103f78a04ace9eefaecddac8bc70e6.tar.xz |
Try to report current composite manager name
Try to read NET_WM_CM_Sn owner's NET_WM_NAME (or WM_NAME) property,
otherwise report it's window id.
Remarks: metacity and kwin currently don't set a window name for
NET_WM_CM_Sn owner, but xcompmgr and compiz do. This should be added
to wm-spec.
-rw-r--r-- | xcompmgr.c | 30 |
1 files changed, 27 insertions, 3 deletions
@@ -1886,9 +1886,33 @@ register_cm (void) snprintf (net_wm_cm, sizeof (net_wm_cm), "_NET_WM_CM_S%d", scr); a = XInternAtom (dpy, net_wm_cm, False); - if (XGetSelectionOwner (dpy, a) != None) - { - fprintf (stderr, "Another composite manager is already running\n"); + w = XGetSelectionOwner (dpy, a); + if (w != None) + { + XTextProperty tp; + char **strs; + int count; + Atom winNameAtom = XInternAtom (dpy, "_NET_WM_NAME", False); + + if (!XGetTextProperty (dpy, w, &tp, winNameAtom) && + !XGetTextProperty (dpy, w, &tp, XA_WM_NAME)) + { + fprintf (stderr, + "Another composite manager is already running (0x%lx)\n", + (unsigned long) w); + return False; + } + if (XmbTextPropertyToTextList (dpy, &tp, &strs, &count) == Success) + { + fprintf (stderr, + "Another composite manager is already running (%s)\n", + strs[0]); + + XFreeStringList (strs); + } + + XFree (tp.value); + return False; } |