rem: char **argv; int argc;  if (!wapp || !wapp->app_icon)
add: char *command;  if (!wapp || !wapp->app_icon || wapp->app_icon->docked)
context: wClientCheckProperty(WWindow *wwin, XPropertyEvent *event) {    XWindowAttributes attribs;    XWMHints *new_hints;    int i, g1, g2;    char *tmp = NULL;        switch (event->atom) {     case XA_WM_NAME:	/* window title was changed */	if (!wFetchName(dpy, wwin->client_win, &tmp)) {	    wWindowUpdateName(wwin, NULL);	} else {	    wWindowUpdateName(wwin, tmp);	}	if (tmp)	    XFree(tmp);		break;	     case XA_WM_ICON_NAME:#ifdef KWM_HINTS	wKWMSendEventMessage(wwin, WKWMChangedClient);#endif	if (!wwin->icon) 	    break;	else {	    char *new_title;	    	    /* icon title was changed */	    wGetIconName(dpy, wwin->client_win, &new_title);	    wIconChangeTitle(wwin->icon, new_title);	}	break;     case XA_WM_COMMAND:	if (wwin->main_window!=None) {	    WApplication *wapp = wApplicationOf(wwin->main_window);	    char **argv;	    int argc;            if (!wapp || !wapp->app_icon)		break;	    if (XGetCommand(dpy, wwin->main_window, &argv, &argc)) {		if (argc > 0 && argv != NULL) {		    if (wapp->app_icon->command)		        wfree(wapp->app_icon->command);		    wapp->app_icon->command = wtokenjoin(argv, argc);		}		if (argv) {		    XFreeStringList(argv);		}	    }	}	break;     case XA_WM_HINTS:	/* WM_HINTS */	new_hints = XGetWMHints(dpy, wwin->client_win);		/* group leader update	 * 	 * This means that the window is setting the leader after	 * it was mapped, changing leaders or removing the leader.	 * 	 * Valid state transitions are:	 *	 *          _1            __2	 *         / \           /  \	 *         v |           v  |	 *         (GC)         (GC')	 *        /  ^          /   ^	 *       3|  |4        5|   |6	 *        |  |          |   |	 *        v  /          v   /	 *        (G'C)        (G'C')	 * 	 * Where G is the window_group hint, C is CLIENT_LEADER property	 * and ' indicates the hint is unset.	 *	 * 1,2 - change group leader to new value of window_group	 * 3 - change leader to value of CLIENT_LEADER	 * 4 - change leader to value of window_group	 * 5 - destroy application	 * 6 - create application	 */	if (new_hints && (new_hints->flags & WindowGroupHint)	    && new_hints->window_group!=None) {	    g2 = 1;	} else {	    g2 = 0;	}	if (wwin->wm_hints && (wwin->wm_hints->flags & WindowGroupHint)	    && wwin->wm_hints->window_group!=None) {	    g1 = 1;	} else {	    g1 = 0;	}		if (wwin->client_leader) {	    if (g1 && g2 		&& wwin->wm_hints->window_group!=new_hints->window_group) {		i = 1;	    } else if (g1 && !g2) {		i = 3;	    } else if (!g1 && g2) {		i = 4;	    } else {		i = 0;	    }	} else {	    if (g1 && g2 		&& wwin->wm_hints->window_group!=new_hints->window_group) {		i = 2;	    } else if (g1 && !g2) {		i = 5;	    } else if (!g1 && g2) {		i = 6;	    } else {		i = 0;	    }	}        /* Handling this may require more work. -Dan */        if (wwin->fake_group!=NULL) {            i = 7;        }	if (wwin->wm_hints)	  XFree(wwin->wm_hints);	wwin->wm_hints = new_hints;	/* do action according to state transition */	switch (i) {	    	 /* 3 - change leader to value of CLIENT_LEADER */	 case 3:	    wApplicationDestroy(wApplicationOf(wwin->main_window));	    wwin->main_window = wwin->client_leader;	    wwin->group_id = None;	    wApplicationCreate(wwin->screen_ptr, wwin->main_window);	    break;	 /* 1,2,4 - change leader to new value of window_group */	 case 1:	 case 2:	 case 4:	    wApplicationDestroy(wApplicationOf(wwin->main_window));	    wwin->main_window = new_hints->window_group;	    wwin->group_id = wwin->main_window;	    wApplicationCreate(wwin->screen_ptr, wwin->main_window);	    break;	    	 /* 5 - destroy application */	 case 5:	    wApplicationDestroy(wApplicationOf(wwin->main_window));	    wwin->main_window = None;	    wwin->group_id = None;	    break;	    	 /* 6 - create application */	 case 6:	    wwin->main_window = new_hints->window_group;	    wwin->group_id = wwin->main_window;	    wApplicationCreate(wwin->screen_ptr, wwin->main_window);	    break;         /* 7 - we have a fake window group id, so just ignore anything else */         case 7:            break;        }#ifdef DEBUG	if (i) {	    printf("window leader update caused state transition %i\n",i);	}#endif	if (wwin->wm_hints) {	    /* update icon */	    if ((wwin->wm_hints->flags & IconPixmapHint)		|| (wwin->wm_hints->flags & IconWindowHint)) {		WApplication *wapp;		if (wwin->flags.miniaturized && wwin->icon) {		    wIconUpdate(wwin->icon);		}		wapp = wApplicationOf(wwin->main_window);		if (wapp && wapp->app_icon) {		    wIconUpdate(wapp->app_icon->icon);		}#ifdef KWM_HINTS		wKWMSendEventMessage(wwin, WKWMIconChange);#endif	    }	    if (wwin->wm_hints->flags & UrgencyHint)	      wwin->flags.urgent = 1;	    else	      wwin->flags.urgent = 0;        /*} else if (wwin->fake_group!=NULL) {            wwin->group_id = wwin->fake_group->leader;*/        } else {            wwin->group_id = None;	}	break;	     case XA_WM_NORMAL_HINTS:	/* normal (geometry) hints */	{	    int foo;	    unsigned bar;	    XGetWindowAttributes(dpy, wwin->client_win, &attribs);	    wClientGetNormalHints(wwin, &attribs, False, &foo, &foo,				  &bar, &bar);	    /* TODO: should we check for consistency of the current	     * size against the new geometry hints? */	}	break;	     case XA_WM_TRANSIENT_FOR:	{	    Window new_owner;	    WWindow *owner;	    	    if (!XGetTransientForHint(dpy, wwin->client_win, &new_owner)) {		new_owner = None;	    } else {		if (new_owner==0 || new_owner == wwin->client_win) {		    new_owner = wwin->screen_ptr->root_win;		}	    }	    if (new_owner!=wwin->transient_for) {		owner = wWindowFor(wwin->transient_for);		if (owner) {		    if (owner->flags.semi_focused) {			owner->flags.semi_focused = 0;			if ((owner->flags.mapped || owner->flags.shaded)			    && owner->frame)			  wFrameWindowPaint(owner->frame);		    }		}		owner = wWindowFor(new_owner);		if (owner) {		    if (!owner->flags.semi_focused) {			owner->flags.semi_focused = 1;			if ((owner->flags.mapped || owner->flags.shaded)			    && owner->frame)			  wFrameWindowPaint(owner->frame);		    }		}		wwin->transient_for = new_owner;		if (new_owner==None) {		    if (WFLAGP(wwin, no_miniaturizable)) {			WSETUFLAG(wwin, no_miniaturizable, 0);			WSETUFLAG(wwin, no_miniaturize_button, 0);			if (wwin->frame)			    wWindowConfigureBorders(wwin);		    }		} else if (!WFLAGP(wwin, no_miniaturizable)) {		    WSETUFLAG(wwin, no_miniaturizable, 1);		    WSETUFLAG(wwin, no_miniaturize_button, 1);		    if (wwin->frame)			wWindowConfigureBorders(wwin);		}	    }	}	break;	     default:	if (event->atom==_XA_WM_PROTOCOLS) {	    PropGetProtocols(wwin->client_win, &wwin->protocols);	    WSETUFLAG(wwin, kill_close, !wwin->protocols.DELETE_WINDOW);	    if (wwin->frame)		wWindowUpdateButtonImages(wwin);	} else if (event->atom==_XA_WM_COLORMAP_WINDOWS) {	    	    GetColormapWindows(wwin);	    wColormapInstallForWindow(wwin->screen_ptr, wwin);	} else if (event->atom==_XA_WINDOWMAKER_MENU) {	    WApplication *wapp;	    wapp = wApplicationOf(wwin->main_window);	    if (wapp) {		if (wapp->menu) {		    /* update menu */		    /* TODO: remake appmenu update */		    wAppMenuDestroy(wapp->menu);		}                if (wwin->fake_group) {                    extern WPreferences wPreferences;                    WScreen *scr = wwin->screen_ptr;                    WWindow *foo = scr->focused_window;                    WFakeGroupLeader *fPtr = wwin->fake_group;                    wApplicationDestroy(wapp);                    while (foo) {                        if (foo->fake_group && foo->fake_group==fPtr) {                            WSETUFLAG(foo, shared_appicon, 0);                            foo->fake_group = NULL;                            if (foo->group_id!=None)                                foo->main_window = foo->group_id;                            else if (foo->client_leader!=None)                                foo->main_window = foo->client_leader;                            else if (WFLAGP(foo, emulate_appicon))                                foo->main_window = foo->client_win;                            else                                foo->main_window = None;                            if (foo->main_window) {                                wapp = wApplicationCreate(scr, foo->main_window);                            }                        }                        foo = foo->prev;                    }                    if (fPtr->leader!=None)                        XDestroyWindow(dpy, fPtr->leader);                    fPtr->retainCount = 0;                    fPtr->leader = None;                    fPtr->origLeader = None;                    wapp = wApplicationOf(wwin->main_window);                    if (wapp) {                        wapp->menu = wAppMenuGet(scr, wwin->main_window);                    }                    if (wPreferences.auto_arrange_icons) {                        wArrangeIcons(wwin->screen_ptr, True);                    }                } else {                    wapp->menu = wAppMenuGet(wwin->screen_ptr, wwin->main_window);                }                /* make the appmenu be mapped */                wSetFocusTo(wwin->screen_ptr, NULL);                wSetFocusTo(wwin->screen_ptr, wwin->screen_ptr->focused_window);	    }	} else if (event->atom==_XA_GNUSTEP_WM_ATTR) {	    GNUstepWMAttributes *attr;	    PropGetGNUstepWMAttr(wwin->client_win, &attr);	    	    wWindowUpdateGNUstepAttr(wwin, attr);	    	    XFree(attr);	} else {#ifdef KWM_HINTS	    Bool done;	    done = wKWMCheckClientHintChange(wwin, event);#endif /* KWM_HINTS */	}    }}