rem: wRaiseFrame(icon->core);
context: handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event){    WScreen *scr = dock->screen_ptr;    Window wins[2];    WIcon *icon = aicon->icon;    WDock *dock2 = NULL, *last_dock = dock, *clip = NULL;    int ondock, grabbed = 0, change_dock = 0, collapsed = 0;    XEvent ev;    int x = aicon->x_pos, y = aicon->y_pos;    int ofs_x = event->xbutton.x, ofs_y = event->xbutton.y;    int shad_x = x, shad_y = y;    int ix = aicon->xindex, iy = aicon->yindex;    int tmp;    Pixmap ghost = None;    Bool docked;    int superfluous = wPreferences.superfluous; /* we catch it to avoid problems */    if (wPreferences.flags.noupdates)	return;        if (XGrabPointer(dpy, icon->core->window, True, ButtonMotionMask		     |ButtonReleaseMask|ButtonPressMask, GrabModeAsync,		     GrabModeAsync, None, None, CurrentTime) !=GrabSuccess) {#ifdef DEBUG0	wwarning("pointer grab failed for icon move");#endif    }    wRaiseFrame(icon->core);    if (!wPreferences.flags.noclip)        clip = scr->workspaces[scr->current_workspace]->clip;    if (dock == scr->dock && !wPreferences.flags.noclip)        dock2 = clip;    else if (dock != scr->dock && !wPreferences.flags.nodock)        dock2 = scr->dock;    wins[0] = icon->core->window;    wins[1] = scr->dock_shadow;    XRestackWindows(dpy, wins, 2);    XMoveResizeWindow(dpy, scr->dock_shadow, aicon->x_pos, aicon->y_pos,		      ICON_SIZE, ICON_SIZE);    if (superfluous) {	if (icon->pixmap!=None)	    ghost = MakeGhostIcon(scr, icon->pixmap);	else	    ghost = MakeGhostIcon(scr, icon->core->window);		XSetWindowBackgroundPixmap(dpy, scr->dock_shadow, ghost);	XClearWindow(dpy, scr->dock_shadow);    }    XMapWindow(dpy, scr->dock_shadow);    ondock = 1;    while(1) {	XMaskEvent(dpy, PointerMotionMask|ButtonReleaseMask|ButtonPressMask		   |ButtonMotionMask|ExposureMask, &ev);	switch (ev.type) {	 case Expose:	    WMHandleEvent(&ev);	    break;	 case MotionNotify:	    if (!grabbed) {		if (abs(ofs_x-ev.xmotion.x)>=MOVE_THRESHOLD		    || abs(ofs_y-ev.xmotion.y)>=MOVE_THRESHOLD) {		    XChangeActivePointerGrab(dpy, ButtonMotionMask					    |ButtonReleaseMask|ButtonPressMask,					     wCursor[WCUR_MOVE], CurrentTime);		    grabbed=1;		} else {		    break;		}	    }			    x = ev.xmotion.x_root - ofs_x;	    y = ev.xmotion.y_root - ofs_y;            tmp = wDockSnapIcon(dock, aicon, x, y, &ix, &iy, True);            if (tmp && dock2) {                change_dock = 0;                if (last_dock != dock && collapsed) {                    last_dock->collapsed = 1;                    wDockHideIcons(last_dock);                    collapsed = 0;                }                if (!collapsed && (collapsed = dock->collapsed)) {                    dock->collapsed = 0;                    wDockShowIcons(dock);                }                if (dock->auto_raise_lower)                    wDockRaise(dock);                last_dock = dock;            } else if (dock2) {                tmp = wDockSnapIcon(dock2, aicon, x, y, &ix, &iy, False);                if (tmp) {                    change_dock = 1;                    if (last_dock != dock2 && collapsed) {                        last_dock->collapsed = 1;                        wDockHideIcons(last_dock);                        collapsed = 0;                    }                    if (!collapsed && (collapsed = dock2->collapsed)) {                        dock2->collapsed = 0;                        wDockShowIcons(dock2);                    }                    if (dock2->auto_raise_lower)                        wDockRaise(dock2);                    last_dock = dock2;                }            }            if (aicon->launching		|| (aicon->running && !(ev.xmotion.state & MOD_MASK))		|| (!aicon->running && tmp)) {                shad_x = last_dock->x_pos + ix*wPreferences.icon_size;                shad_y = last_dock->y_pos + iy*wPreferences.icon_size;				XMoveWindow(dpy, scr->dock_shadow, shad_x, shad_y);                		if (!ondock) {		    XMapWindow(dpy, scr->dock_shadow);		}		ondock = 1;	    } else {                if (ondock) {                    XUnmapWindow(dpy, scr->dock_shadow);                }		ondock = 0;	    }	    XMoveWindow(dpy, icon->core->window, x, y);	    break;	 case ButtonPress:	    break;	 case ButtonRelease:	    if (ev.xbutton.button != event->xbutton.button)		break;	    XUngrabPointer(dpy, CurrentTime);	    if (ondock) {		SlideWindow(icon->core->window, x, y, shad_x, shad_y);                XUnmapWindow(dpy, scr->dock_shadow);                if (!change_dock) {                    reattachIcon(dock, aicon, ix, iy);                    if (clip && dock!=clip && clip->auto_raise_lower)                        wDockLower(clip);                } else {                    docked = moveIconBetweenDocks(dock, dock2, aicon, ix, iy);		    if (!docked) {			/* Slide it back if dock rejected it */			SlideWindow(icon->core->window, x, y, aicon->x_pos,  				    aicon->y_pos);			reattachIcon(dock, aicon, aicon->xindex,aicon->yindex);		    }                    if (last_dock->type==WM_CLIP && last_dock->auto_collapse) {                        collapsed = 0;                    }                }	    } else {		aicon->x_pos = x;		aicon->y_pos = y;                if (superfluous) {		    if (!aicon->running && !wPreferences.no_animations) {			/* We need to deselect it, even if is deselected in			 * wDockDetach(), because else DoKaboom() will fail.			 */			if (aicon->icon->selected)			    wIconSelect(aicon->icon);			DoKaboom(scr,aicon->icon->core->window, x, y);		    }                }                if (clip && clip->auto_raise_lower)                    wDockLower(clip);		wDockDetach(dock, aicon);            }            if (collapsed) {                last_dock->collapsed = 1;                wDockHideIcons(last_dock);                collapsed = 0;            }            if (superfluous) {		if (ghost!=None)		    XFreePixmap(dpy, ghost);		XSetWindowBackground(dpy, scr->dock_shadow, scr->white_pixel);            }#ifdef DEBUG	    puts("End icon move");#endif	    return;	}    }}