From f15e054cfb103f78a04ace9eefaecddac8bc70e6 Mon Sep 17 00:00:00 2001 From: Yann Droneaud Date: Tue, 24 Mar 2009 12:59:01 +0100 Subject: 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. --- xcompmgr.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/xcompmgr.c b/xcompmgr.c index bf7910b..9d4072c 100644 --- a/xcompmgr.c +++ b/xcompmgr.c @@ -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; } -- cgit v1.2.3