activate XGrabServer again
[wmaker-crm.git] / src / appicon.c
blobd4b98a9a4c3d8c62650c1f984cf1bceaabd237c5
1 /* appicon.c- icon for applications (not mini-window)
3 * Window Maker window manager
5 * Copyright (c) 1997-2003 Alfredo K. Kojima
6 * Copyright (c) 1998-2003 Dan Pascu
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 * USA.
24 #include "wconfig.h"
26 #include <X11/Xlib.h>
27 #include <X11/Xutil.h>
28 #include <stdlib.h>
29 #include <string.h>
31 #include "WindowMaker.h"
32 #include "wcore.h"
33 #include "window.h"
34 #include "icon.h"
35 #include "appicon.h"
36 #include "actions.h"
37 #include "stacking.h"
38 #include "dock.h"
39 #include "funcs.h"
40 #include "defaults.h"
41 #include "workspace.h"
42 #include "superfluous.h"
43 #include "menu.h"
44 #include "framewin.h"
45 #include "dialog.h"
46 #include "client.h"
47 #ifdef XDND
48 #include "xdnd.h"
49 #endif
52 * icon_file for the dock is got from the preferences file by
53 * using the classname/instancename
56 /**** Global variables ****/
57 extern Cursor wCursor[WCUR_LAST];
58 extern WPreferences wPreferences;
60 #define MOD_MASK wPreferences.modifier_mask
62 void appIconMouseDown(WObjDescriptor * desc, XEvent * event);
63 static void iconDblClick(WObjDescriptor * desc, XEvent * event);
64 static void iconExpose(WObjDescriptor * desc, XEvent * event);
66 WAppIcon *wAppIconCreateForDock(WScreen * scr, char *command, char *wm_instance, char *wm_class, int tile)
68 WAppIcon *dicon;
69 char *path;
71 dicon = wmalloc(sizeof(WAppIcon));
72 wretain(dicon);
73 memset(dicon, 0, sizeof(WAppIcon));
74 dicon->yindex = -1;
75 dicon->xindex = -1;
77 dicon->prev = NULL;
78 dicon->next = scr->app_icon_list;
79 if (scr->app_icon_list) {
80 scr->app_icon_list->prev = dicon;
82 scr->app_icon_list = dicon;
84 if (command) {
85 dicon->command = wstrdup(command);
87 if (wm_class)
88 dicon->wm_class = wstrdup(wm_class);
89 if (wm_instance)
90 dicon->wm_instance = wstrdup(wm_instance);
92 path = wDefaultGetIconFile(scr, wm_instance, wm_class, True);
93 if (!path && command) {
94 wApplicationExtractDirPackIcon(scr, command, wm_instance, wm_class);
96 path = wDefaultGetIconFile(scr, wm_instance, wm_class, False);
99 if (path)
100 path = FindImage(wPreferences.icon_path, path);
102 dicon->icon = wIconCreateWithIconFile(scr, path, tile);
103 if (path)
104 wfree(path);
105 #ifdef XDND
106 wXDNDMakeAwareness(dicon->icon->core->window);
107 #endif
109 /* will be overriden by dock */
110 dicon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
111 dicon->icon->core->descriptor.handle_expose = iconExpose;
112 dicon->icon->core->descriptor.parent_type = WCLASS_APPICON;
113 dicon->icon->core->descriptor.parent = dicon;
114 AddToStackList(dicon->icon->core);
116 return dicon;
119 WAppIcon *wAppIconCreate(WWindow * leader_win)
121 WAppIcon *aicon;
122 WScreen *scr = leader_win->screen_ptr;
124 aicon = wmalloc(sizeof(WAppIcon));
125 wretain(aicon);
126 memset(aicon, 0, sizeof(WAppIcon));
128 aicon->yindex = -1;
129 aicon->xindex = -1;
131 aicon->prev = NULL;
132 aicon->next = scr->app_icon_list;
133 if (scr->app_icon_list) {
134 scr->app_icon_list->prev = aicon;
136 scr->app_icon_list = aicon;
138 if (leader_win->wm_class)
139 aicon->wm_class = wstrdup(leader_win->wm_class);
140 if (leader_win->wm_instance)
141 aicon->wm_instance = wstrdup(leader_win->wm_instance);
143 aicon->icon = wIconCreate(leader_win);
144 #ifdef XDND
145 wXDNDMakeAwareness(aicon->icon->core->window);
146 #endif
148 /* will be overriden if docked */
149 aicon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
150 aicon->icon->core->descriptor.handle_expose = iconExpose;
151 aicon->icon->core->descriptor.parent_type = WCLASS_APPICON;
152 aicon->icon->core->descriptor.parent = aicon;
153 AddToStackList(aicon->icon->core);
154 aicon->icon->show_title = 0;
155 wIconUpdate(aicon->icon);
157 return aicon;
160 void wAppIconDestroy(WAppIcon * aicon)
162 WScreen *scr = aicon->icon->core->screen_ptr;
164 RemoveFromStackList(aicon->icon->core);
165 wIconDestroy(aicon->icon);
166 if (aicon->command)
167 wfree(aicon->command);
168 #ifdef XDND
169 if (aicon->dnd_command)
170 wfree(aicon->dnd_command);
171 #endif
172 if (aicon->wm_instance)
173 wfree(aicon->wm_instance);
174 if (aicon->wm_class)
175 wfree(aicon->wm_class);
177 if (aicon == scr->app_icon_list) {
178 if (aicon->next)
179 aicon->next->prev = NULL;
180 scr->app_icon_list = aicon->next;
181 } else {
182 if (aicon->next)
183 aicon->next->prev = aicon->prev;
184 if (aicon->prev)
185 aicon->prev->next = aicon->next;
188 aicon->destroyed = 1;
189 wrelease(aicon);
192 #ifdef NEWAPPICON
193 static void drawCorner(WIcon * icon, WWindow * wwin, int active)
195 WScreen *scr = wwin->screen_ptr;
196 XPoint points[3];
197 GC gc;
199 points[0].x = 2;
200 points[0].y = 2;
201 points[1].x = 12;
202 points[1].y = 2;
203 points[2].x = 2;
204 points[2].y = 12;
205 if (active) {
206 gc = scr->focused_texture->any.gc;
207 } else {
208 gc = scr->unfocused_texture->any.gc;
210 XFillPolygon(dpy, icon->core->window, gc, points, 3, Convex, CoordModeOrigin);
212 #endif /* NEWAPPICON */
214 static void drawCorner(WIcon * icon)
216 WScreen *scr = icon->core->screen_ptr;
217 XPoint points[3];
219 points[0].x = 1;
220 points[0].y = 1;
221 points[1].x = 12;
222 points[1].y = 1;
223 points[2].x = 1;
224 points[2].y = 12;
225 XFillPolygon(dpy, icon->core->window, scr->icon_title_texture->normal_gc,
226 points, 3, Convex, CoordModeOrigin);
227 XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc, 0, 0, 0, 12);
228 XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc, 0, 0, 12, 0);
229 /* drawing the second line gives a weird concave look. -Dan */
230 #if 0
231 XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc, 1, 1, 1, 11);
232 XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc, 1, 1, 11, 1);
233 #endif
236 void wAppIconMove(WAppIcon * aicon, int x, int y)
238 XMoveWindow(dpy, aicon->icon->core->window, x, y);
239 aicon->x_pos = x;
240 aicon->y_pos = y;
243 #ifdef WS_INDICATOR
244 static void updateDockNumbers(WScreen * scr)
246 int length;
247 char *ws_numbers;
248 WAppIcon *dicon = scr->dock->icon_array[0];
250 ws_numbers = wmalloc(20);
251 snprintf(ws_numbers, 20, "%i [ %i ]", scr->current_workspace + 1, ((scr->current_workspace / 10) + 1));
252 length = strlen(ws_numbers);
254 XClearArea(dpy, dicon->icon->core->window, 2, 2, 50, WMFontHeight(scr->icon_title_font) + 1, False);
256 WMDrawString(scr->wmscreen, dicon->icon->core->window, scr->black,
257 scr->icon_title_font, 4, 3, ws_numbers, length);
259 WMDrawString(scr->wmscreen, dicon->icon->core->window, scr->white,
260 scr->icon_title_font, 3, 2, ws_numbers, length);
262 wfree(ws_numbers);
264 #endif /* WS_INDICATOR */
266 void wAppIconPaint(WAppIcon * aicon)
268 WApplication *wapp;
269 WScreen *scr = aicon->icon->core->screen_ptr;
271 if (aicon->icon->owner)
272 wapp = wApplicationOf(aicon->icon->owner->main_window);
273 else
274 wapp = NULL;
276 wIconPaint(aicon->icon);
278 # ifdef WS_INDICATOR
279 if (aicon->docked && scr->dock && scr->dock == aicon->dock && aicon->yindex == 0)
280 updateDockNumbers(scr);
281 # endif
282 if (scr->dock_dots && aicon->docked && !aicon->running && aicon->command != NULL) {
283 XSetClipMask(dpy, scr->copy_gc, scr->dock_dots->mask);
284 XSetClipOrigin(dpy, scr->copy_gc, 0, 0);
285 XCopyArea(dpy, scr->dock_dots->image, aicon->icon->core->window,
286 scr->copy_gc, 0, 0, scr->dock_dots->width, scr->dock_dots->height, 0, 0);
288 #ifdef HIDDENDOT
289 if (wapp && wapp->flags.hidden) {
290 XSetClipMask(dpy, scr->copy_gc, scr->dock_dots->mask);
291 XSetClipOrigin(dpy, scr->copy_gc, 0, 0);
292 XCopyArea(dpy, scr->dock_dots->image,
293 aicon->icon->core->window, scr->copy_gc, 0, 0, 7, scr->dock_dots->height, 0, 0);
295 #endif /* HIDDENDOT */
297 if (aicon->omnipresent)
298 drawCorner(aicon->icon);
300 XSetClipMask(dpy, scr->copy_gc, None);
301 if (aicon->launching) {
302 XFillRectangle(dpy, aicon->icon->core->window, scr->stipple_gc,
303 0, 0, wPreferences.icon_size, wPreferences.icon_size);
307 #define canBeDocked(wwin) ((wwin) && ((wwin)->wm_class||(wwin)->wm_instance))
309 static void hideCallback(WMenu * menu, WMenuEntry * entry)
311 WApplication *wapp = (WApplication *) entry->clientdata;
313 if (wapp->flags.hidden) {
314 wWorkspaceChange(menu->menu->screen_ptr, wapp->last_workspace);
315 wUnhideApplication(wapp, False, False);
316 } else {
317 wHideApplication(wapp);
321 static void unhideHereCallback(WMenu * menu, WMenuEntry * entry)
323 WApplication *wapp = (WApplication *) entry->clientdata;
325 wUnhideApplication(wapp, False, True);
328 static void setIconCallback(WMenu * menu, WMenuEntry * entry)
330 WAppIcon *icon = ((WApplication *) entry->clientdata)->app_icon;
331 char *file = NULL;
332 WScreen *scr;
333 int result;
335 assert(icon != NULL);
337 if (icon->editing)
338 return;
339 icon->editing = 1;
340 scr = icon->icon->core->screen_ptr;
342 wretain(icon);
344 result = wIconChooserDialog(scr, &file, icon->wm_instance, icon->wm_class);
346 if (result && !icon->destroyed) {
347 if (file && *file == 0) {
348 wfree(file);
349 file = NULL;
351 if (!wIconChangeImageFile(icon->icon, file)) {
352 wMessageDialog(scr, _("Error"),
353 _("Could not open specified icon file"), _("OK"), NULL, NULL);
354 } else {
355 wDefaultChangeIcon(scr, icon->wm_instance, icon->wm_class, file);
356 wAppIconPaint(icon);
358 if (file)
359 wfree(file);
361 icon->editing = 0;
362 wrelease(icon);
365 static void killCallback(WMenu * menu, WMenuEntry * entry)
367 WApplication *wapp = (WApplication *) entry->clientdata;
368 WFakeGroupLeader *fPtr;
369 char *buffer;
370 char *shortname;
371 char *basename(const char *shortname);
373 if (!WCHECK_STATE(WSTATE_NORMAL))
374 return;
376 WCHANGE_STATE(WSTATE_MODAL);
378 assert(entry->clientdata != NULL);
380 shortname = basename(wapp->app_icon->wm_instance);
382 buffer = wstrconcat(wapp->app_icon ? shortname : NULL,
383 _(" will be forcibly closed.\n"
384 "Any unsaved changes will be lost.\n" "Please confirm."));
386 fPtr = wapp->main_window_desc->fake_group;
388 wretain(wapp->main_window_desc);
389 if (wPreferences.dont_confirm_kill
390 || wMessageDialog(menu->frame->screen_ptr, _("Kill Application"),
391 buffer, _("Yes"), _("No"), NULL) == WAPRDefault) {
392 if (fPtr != NULL) {
393 WWindow *wwin, *twin;
395 wwin = wapp->main_window_desc->screen_ptr->focused_window;
396 while (wwin) {
397 twin = wwin->prev;
398 if (wwin->fake_group == fPtr) {
399 wClientKill(wwin);
401 wwin = twin;
403 } else if (!wapp->main_window_desc->flags.destroyed) {
404 wClientKill(wapp->main_window_desc);
407 wrelease(wapp->main_window_desc);
409 wfree(buffer);
411 WCHANGE_STATE(WSTATE_NORMAL);
414 static WMenu *createApplicationMenu(WScreen * scr)
416 WMenu *menu;
418 menu = wMenuCreate(scr, NULL, False);
419 wMenuAddCallback(menu, _("Unhide Here"), unhideHereCallback, NULL);
420 wMenuAddCallback(menu, _("Hide"), hideCallback, NULL);
421 wMenuAddCallback(menu, _("Set Icon..."), setIconCallback, NULL);
422 wMenuAddCallback(menu, _("Kill"), killCallback, NULL);
424 return menu;
427 static void openApplicationMenu(WApplication * wapp, int x, int y)
429 WMenu *menu;
430 WScreen *scr = wapp->main_window_desc->screen_ptr;
431 int i;
433 if (!scr->icon_menu) {
434 scr->icon_menu = createApplicationMenu(scr);
435 wfree(scr->icon_menu->entries[1]->text);
438 menu = scr->icon_menu;
440 if (wapp->flags.hidden) {
441 menu->entries[1]->text = _("Unhide");
442 } else {
443 menu->entries[1]->text = _("Hide");
446 menu->flags.realized = 0;
447 wMenuRealize(menu);
449 x -= menu->frame->core->width / 2;
450 if (x + menu->frame->core->width > scr->scr_width)
451 x = scr->scr_width - menu->frame->core->width;
452 if (x < 0)
453 x = 0;
455 /* set client data */
456 for (i = 0; i < menu->entry_no; i++) {
457 menu->entries[i]->clientdata = wapp;
459 wMenuMapAt(menu, x, y, False);
462 /******************************************************************/
464 static void iconExpose(WObjDescriptor * desc, XEvent * event)
466 wAppIconPaint(desc->parent);
469 static void iconDblClick(WObjDescriptor * desc, XEvent * event)
471 WAppIcon *aicon = desc->parent;
472 WApplication *wapp;
473 WScreen *scr = aicon->icon->core->screen_ptr;
474 int unhideHere;
476 assert(aicon->icon->owner != NULL);
478 wapp = wApplicationOf(aicon->icon->owner->main_window);
479 #ifdef DEBUG0
480 if (!wapp) {
481 wwarning("could not find application descriptor for app icon!!");
482 return;
484 #endif
486 unhideHere = (event->xbutton.state & ShiftMask);
488 /* go to the last workspace that the user worked on the app */
489 if (!unhideHere && wapp->last_workspace != scr->current_workspace)
490 wWorkspaceChange(scr, wapp->last_workspace);
492 wUnhideApplication(wapp, event->xbutton.button == Button2, unhideHere);
494 if (event->xbutton.state & MOD_MASK) {
495 wHideOtherApplications(aicon->icon->owner);
499 void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
501 WAppIcon *aicon = desc->parent;
502 WIcon *icon = aicon->icon;
503 XEvent ev;
504 int x = aicon->x_pos, y = aicon->y_pos;
505 int dx = event->xbutton.x, dy = event->xbutton.y;
506 int grabbed = 0;
507 int done = 0;
508 int superfluous = wPreferences.superfluous; /* we catch it to avoid problems */
509 WScreen *scr = icon->core->screen_ptr;
510 WWorkspace *workspace = scr->workspaces[scr->current_workspace];
511 int shad_x = 0, shad_y = 0, docking = 0, dockable, collapsed = 0;
512 int ix, iy;
513 int clickButton = event->xbutton.button;
514 Pixmap ghost = None;
515 Window wins[2];
516 Bool movingSingle = False;
517 int oldX = x;
518 int oldY = y;
519 Bool hasMoved = False;
521 if (aicon->editing || WCHECK_STATE(WSTATE_MODAL))
522 return;
524 if (IsDoubleClick(scr, event)) {
525 iconDblClick(desc, event);
526 return;
529 if (event->xbutton.button == Button3) {
530 WObjDescriptor *desc;
531 WApplication *wapp = wApplicationOf(aicon->icon->owner->main_window);
533 if (!wapp)
534 return;
536 if (event->xbutton.send_event &&
537 XGrabPointer(dpy, aicon->icon->core->window, True, ButtonMotionMask
538 | ButtonReleaseMask | ButtonPressMask, GrabModeAsync,
539 GrabModeAsync, None, None, CurrentTime) != GrabSuccess) {
540 wwarning("pointer grab failed for appicon menu");
541 return;
544 openApplicationMenu(wapp, event->xbutton.x_root, event->xbutton.y_root);
546 /* allow drag select of menu */
547 desc = &scr->icon_menu->menu->descriptor;
548 event->xbutton.send_event = True;
549 (*desc->handle_mousedown) (desc, event);
550 return;
552 #ifdef DEBUG
553 puts("Moving icon");
554 #endif
555 if (event->xbutton.state & MOD_MASK)
556 wLowerFrame(icon->core);
557 else
558 wRaiseFrame(icon->core);
560 if (XGrabPointer(dpy, icon->core->window, True, ButtonMotionMask
561 | ButtonReleaseMask | ButtonPressMask, GrabModeAsync,
562 GrabModeAsync, None, None, CurrentTime) != GrabSuccess) {
563 wwarning("pointer grab failed for appicon move");
566 if (wPreferences.flags.nodock && wPreferences.flags.noclip)
567 dockable = 0;
568 else
569 dockable = canBeDocked(icon->owner);
571 wins[0] = icon->core->window;
572 wins[1] = scr->dock_shadow;
573 XRestackWindows(dpy, wins, 2);
574 if (superfluous) {
575 if (icon->pixmap != None)
576 ghost = MakeGhostIcon(scr, icon->pixmap);
577 else
578 ghost = MakeGhostIcon(scr, icon->core->window);
579 XSetWindowBackgroundPixmap(dpy, scr->dock_shadow, ghost);
580 XClearWindow(dpy, scr->dock_shadow);
583 while (!done) {
584 WMMaskEvent(dpy, PointerMotionMask | ButtonReleaseMask | ButtonPressMask
585 | ButtonMotionMask | ExposureMask | EnterWindowMask, &ev);
586 switch (ev.type) {
587 case Expose:
588 WMHandleEvent(&ev);
589 break;
591 case EnterNotify:
592 /* It means the cursor moved so fast that it entered
593 * something else (if moving slowly, it would have
594 * stayed in the appIcon that is being moved. Ignore
595 * such "spurious" EnterNotifiy's */
596 break;
598 case MotionNotify:
599 hasMoved = True;
600 if (!grabbed) {
601 if (abs(dx - ev.xmotion.x) >= MOVE_THRESHOLD
602 || abs(dy - ev.xmotion.y) >= MOVE_THRESHOLD) {
603 XChangeActivePointerGrab(dpy, ButtonMotionMask
604 | ButtonReleaseMask | ButtonPressMask,
605 wCursor[WCUR_MOVE], CurrentTime);
606 grabbed = 1;
607 } else {
608 break;
611 x = ev.xmotion.x_root - dx;
612 y = ev.xmotion.y_root - dy;
614 if (movingSingle) {
615 XMoveWindow(dpy, icon->core->window, x, y);
616 } else {
617 wAppIconMove(aicon, x, y);
620 if (dockable) {
621 if (scr->dock && wDockSnapIcon(scr->dock, aicon, x, y, &ix, &iy, False)) {
622 shad_x = scr->dock->x_pos + ix * wPreferences.icon_size;
623 shad_y = scr->dock->y_pos + iy * wPreferences.icon_size;
625 if (scr->last_dock != scr->dock && collapsed) {
626 scr->last_dock->collapsed = 1;
627 wDockHideIcons(scr->last_dock);
628 collapsed = 0;
630 if (!collapsed && (collapsed = scr->dock->collapsed)) {
631 scr->dock->collapsed = 0;
632 wDockShowIcons(scr->dock);
635 if (scr->dock->auto_raise_lower)
636 wDockRaise(scr->dock);
638 scr->last_dock = scr->dock;
640 XMoveWindow(dpy, scr->dock_shadow, shad_x, shad_y);
641 if (!docking) {
642 XMapWindow(dpy, scr->dock_shadow);
644 docking = 1;
645 } else if (workspace->clip &&
646 wDockSnapIcon(workspace->clip, aicon, x, y, &ix, &iy, False)) {
647 shad_x = workspace->clip->x_pos + ix * wPreferences.icon_size;
648 shad_y = workspace->clip->y_pos + iy * wPreferences.icon_size;
650 if (scr->last_dock != workspace->clip && collapsed) {
651 scr->last_dock->collapsed = 1;
652 wDockHideIcons(scr->last_dock);
653 collapsed = 0;
655 if (!collapsed && (collapsed = workspace->clip->collapsed)) {
656 workspace->clip->collapsed = 0;
657 wDockShowIcons(workspace->clip);
660 if (workspace->clip->auto_raise_lower)
661 wDockRaise(workspace->clip);
663 scr->last_dock = workspace->clip;
665 XMoveWindow(dpy, scr->dock_shadow, shad_x, shad_y);
666 if (!docking) {
667 XMapWindow(dpy, scr->dock_shadow);
669 docking = 1;
670 } else if (docking) {
671 XUnmapWindow(dpy, scr->dock_shadow);
672 docking = 0;
676 break;
678 case ButtonPress:
679 break;
681 case ButtonRelease:
682 if (ev.xbutton.button != clickButton)
683 break;
684 XUngrabPointer(dpy, CurrentTime);
686 if (docking) {
687 Bool docked;
689 /* icon is trying to be docked */
690 SlideWindow(icon->core->window, x, y, shad_x, shad_y);
691 XUnmapWindow(dpy, scr->dock_shadow);
692 docked = wDockAttachIcon(scr->last_dock, aicon, ix, iy);
693 if (scr->last_dock->auto_collapse) {
694 collapsed = 0;
696 if (workspace->clip &&
697 workspace->clip != scr->last_dock && workspace->clip->auto_raise_lower)
698 wDockLower(workspace->clip);
700 if (!docked) {
701 /* If icon could not be docked, slide it back to the old
702 * position */
703 SlideWindow(icon->core->window, x, y, oldX, oldY);
705 } else {
706 if (movingSingle) {
707 /* move back to its place */
708 SlideWindow(icon->core->window, x, y, oldX, oldY);
709 wAppIconMove(aicon, oldX, oldY);
710 } else {
711 XMoveWindow(dpy, icon->core->window, x, y);
712 aicon->x_pos = x;
713 aicon->y_pos = y;
715 if (workspace->clip && workspace->clip->auto_raise_lower)
716 wDockLower(workspace->clip);
718 if (collapsed) {
719 scr->last_dock->collapsed = 1;
720 wDockHideIcons(scr->last_dock);
721 collapsed = 0;
723 if (superfluous) {
724 if (ghost != None)
725 XFreePixmap(dpy, ghost);
726 XSetWindowBackground(dpy, scr->dock_shadow, scr->white_pixel);
729 if (wPreferences.auto_arrange_icons)
730 wArrangeIcons(scr, True);
732 if (wPreferences.single_click && !hasMoved)
733 iconDblClick(desc, event);
735 done = 1;
736 break;
739 #ifdef DEBUG
740 puts("End icon move");
741 #endif