Remove sound support
[wmaker-crm.git] / src / appicon.c
blob37c9171d8db0035e006f64d838cb5454418e2c13
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 #ifdef DEMATERIALIZE_ICON
111 XSetWindowAttributes attribs;
112 attribs.save_under = True;
113 XChangeWindowAttributes(dpy, dicon->icon->core->window, CWSaveUnder, &attribs);
115 #endif
117 /* will be overriden by dock */
118 dicon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
119 dicon->icon->core->descriptor.handle_expose = iconExpose;
120 dicon->icon->core->descriptor.parent_type = WCLASS_APPICON;
121 dicon->icon->core->descriptor.parent = dicon;
122 AddToStackList(dicon->icon->core);
124 return dicon;
127 WAppIcon *wAppIconCreate(WWindow * leader_win)
129 WAppIcon *aicon;
130 WScreen *scr = leader_win->screen_ptr;
132 aicon = wmalloc(sizeof(WAppIcon));
133 wretain(aicon);
134 memset(aicon, 0, sizeof(WAppIcon));
136 aicon->yindex = -1;
137 aicon->xindex = -1;
139 aicon->prev = NULL;
140 aicon->next = scr->app_icon_list;
141 if (scr->app_icon_list) {
142 scr->app_icon_list->prev = aicon;
144 scr->app_icon_list = aicon;
146 if (leader_win->wm_class)
147 aicon->wm_class = wstrdup(leader_win->wm_class);
148 if (leader_win->wm_instance)
149 aicon->wm_instance = wstrdup(leader_win->wm_instance);
151 aicon->icon = wIconCreate(leader_win);
152 #ifdef DEMATERIALIZE_ICON
154 XSetWindowAttributes attribs;
155 attribs.save_under = True;
156 XChangeWindowAttributes(dpy, aicon->icon->core->window, CWSaveUnder, &attribs);
158 #endif
159 #ifdef XDND
160 wXDNDMakeAwareness(aicon->icon->core->window);
161 #endif
163 /* will be overriden if docked */
164 aicon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
165 aicon->icon->core->descriptor.handle_expose = iconExpose;
166 aicon->icon->core->descriptor.parent_type = WCLASS_APPICON;
167 aicon->icon->core->descriptor.parent = aicon;
168 AddToStackList(aicon->icon->core);
169 aicon->icon->show_title = 0;
170 wIconUpdate(aicon->icon);
172 return aicon;
175 void wAppIconDestroy(WAppIcon * aicon)
177 WScreen *scr = aicon->icon->core->screen_ptr;
179 RemoveFromStackList(aicon->icon->core);
180 wIconDestroy(aicon->icon);
181 if (aicon->command)
182 wfree(aicon->command);
183 #ifdef XDND
184 if (aicon->dnd_command)
185 wfree(aicon->dnd_command);
186 #endif
187 if (aicon->wm_instance)
188 wfree(aicon->wm_instance);
189 if (aicon->wm_class)
190 wfree(aicon->wm_class);
192 if (aicon == scr->app_icon_list) {
193 if (aicon->next)
194 aicon->next->prev = NULL;
195 scr->app_icon_list = aicon->next;
196 } else {
197 if (aicon->next)
198 aicon->next->prev = aicon->prev;
199 if (aicon->prev)
200 aicon->prev->next = aicon->next;
203 aicon->destroyed = 1;
204 wrelease(aicon);
207 #ifdef NEWAPPICON
208 static void drawCorner(WIcon * icon, WWindow * wwin, int active)
210 WScreen *scr = wwin->screen_ptr;
211 XPoint points[3];
212 GC gc;
214 points[0].x = 2;
215 points[0].y = 2;
216 points[1].x = 12;
217 points[1].y = 2;
218 points[2].x = 2;
219 points[2].y = 12;
220 if (active) {
221 gc = scr->focused_texture->any.gc;
222 } else {
223 gc = scr->unfocused_texture->any.gc;
225 XFillPolygon(dpy, icon->core->window, gc, points, 3, Convex, CoordModeOrigin);
227 #endif /* NEWAPPICON */
229 static void drawCorner(WIcon * icon)
231 WScreen *scr = icon->core->screen_ptr;
232 XPoint points[3];
234 points[0].x = 1;
235 points[0].y = 1;
236 points[1].x = 12;
237 points[1].y = 1;
238 points[2].x = 1;
239 points[2].y = 12;
240 XFillPolygon(dpy, icon->core->window, scr->icon_title_texture->normal_gc,
241 points, 3, Convex, CoordModeOrigin);
242 XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc, 0, 0, 0, 12);
243 XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc, 0, 0, 12, 0);
244 /* drawing the second line gives a weird concave look. -Dan */
245 #if 0
246 XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc, 1, 1, 1, 11);
247 XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc, 1, 1, 11, 1);
248 #endif
251 void wAppIconMove(WAppIcon * aicon, int x, int y)
253 XMoveWindow(dpy, aicon->icon->core->window, x, y);
254 aicon->x_pos = x;
255 aicon->y_pos = y;
258 #ifdef WS_INDICATOR
259 static void updateDockNumbers(WScreen * scr)
261 int length;
262 char *ws_numbers;
263 WAppIcon *dicon = scr->dock->icon_array[0];
265 ws_numbers = wmalloc(20);
266 snprintf(ws_numbers, 20, "%i [ %i ]", scr->current_workspace + 1, ((scr->current_workspace / 10) + 1));
267 length = strlen(ws_numbers);
269 XClearArea(dpy, dicon->icon->core->window, 2, 2, 50, WMFontHeight(scr->icon_title_font) + 1, False);
271 WMDrawString(scr->wmscreen, dicon->icon->core->window, scr->black,
272 scr->icon_title_font, 4, 3, ws_numbers, length);
274 WMDrawString(scr->wmscreen, dicon->icon->core->window, scr->white,
275 scr->icon_title_font, 3, 2, ws_numbers, length);
277 wfree(ws_numbers);
279 #endif /* WS_INDICATOR */
281 void wAppIconPaint(WAppIcon * aicon)
283 WApplication *wapp;
284 WScreen *scr = aicon->icon->core->screen_ptr;
286 if (aicon->icon->owner)
287 wapp = wApplicationOf(aicon->icon->owner->main_window);
288 else
289 wapp = NULL;
291 wIconPaint(aicon->icon);
293 # ifdef WS_INDICATOR
294 if (aicon->docked && scr->dock && scr->dock == aicon->dock && aicon->yindex == 0)
295 updateDockNumbers(scr);
296 # endif
297 if (scr->dock_dots && aicon->docked && !aicon->running && aicon->command != NULL) {
298 XSetClipMask(dpy, scr->copy_gc, scr->dock_dots->mask);
299 XSetClipOrigin(dpy, scr->copy_gc, 0, 0);
300 XCopyArea(dpy, scr->dock_dots->image, aicon->icon->core->window,
301 scr->copy_gc, 0, 0, scr->dock_dots->width, scr->dock_dots->height, 0, 0);
303 #ifdef HIDDENDOT
304 if (wapp && wapp->flags.hidden) {
305 XSetClipMask(dpy, scr->copy_gc, scr->dock_dots->mask);
306 XSetClipOrigin(dpy, scr->copy_gc, 0, 0);
307 XCopyArea(dpy, scr->dock_dots->image,
308 aicon->icon->core->window, scr->copy_gc, 0, 0, 7, scr->dock_dots->height, 0, 0);
310 #endif /* HIDDENDOT */
312 if (aicon->omnipresent)
313 drawCorner(aicon->icon);
315 XSetClipMask(dpy, scr->copy_gc, None);
316 if (aicon->launching) {
317 XFillRectangle(dpy, aicon->icon->core->window, scr->stipple_gc,
318 0, 0, wPreferences.icon_size, wPreferences.icon_size);
322 #define canBeDocked(wwin) ((wwin) && ((wwin)->wm_class||(wwin)->wm_instance))
324 static void hideCallback(WMenu * menu, WMenuEntry * entry)
326 WApplication *wapp = (WApplication *) entry->clientdata;
328 if (wapp->flags.hidden) {
329 wWorkspaceChange(menu->menu->screen_ptr, wapp->last_workspace);
330 wUnhideApplication(wapp, False, False);
331 } else {
332 wHideApplication(wapp);
336 static void unhideHereCallback(WMenu * menu, WMenuEntry * entry)
338 WApplication *wapp = (WApplication *) entry->clientdata;
340 wUnhideApplication(wapp, False, True);
343 static void setIconCallback(WMenu * menu, WMenuEntry * entry)
345 WAppIcon *icon = ((WApplication *) entry->clientdata)->app_icon;
346 char *file = NULL;
347 WScreen *scr;
348 int result;
350 assert(icon != NULL);
352 if (icon->editing)
353 return;
354 icon->editing = 1;
355 scr = icon->icon->core->screen_ptr;
357 wretain(icon);
359 result = wIconChooserDialog(scr, &file, icon->wm_instance, icon->wm_class);
361 if (result && !icon->destroyed) {
362 if (file && *file == 0) {
363 wfree(file);
364 file = NULL;
366 if (!wIconChangeImageFile(icon->icon, file)) {
367 wMessageDialog(scr, _("Error"),
368 _("Could not open specified icon file"), _("OK"), NULL, NULL);
369 } else {
370 wDefaultChangeIcon(scr, icon->wm_instance, icon->wm_class, file);
371 wAppIconPaint(icon);
373 if (file)
374 wfree(file);
376 icon->editing = 0;
377 wrelease(icon);
380 static void killCallback(WMenu * menu, WMenuEntry * entry)
382 WApplication *wapp = (WApplication *) entry->clientdata;
383 WFakeGroupLeader *fPtr;
384 char *buffer;
385 char *shortname;
386 char *basename(const char *shortname);
388 if (!WCHECK_STATE(WSTATE_NORMAL))
389 return;
391 WCHANGE_STATE(WSTATE_MODAL);
393 assert(entry->clientdata != NULL);
395 shortname = basename(wapp->app_icon->wm_instance);
397 buffer = wstrconcat(wapp->app_icon ? shortname : NULL,
398 _(" will be forcibly closed.\n"
399 "Any unsaved changes will be lost.\n" "Please confirm."));
401 fPtr = wapp->main_window_desc->fake_group;
403 wretain(wapp->main_window_desc);
404 if (wPreferences.dont_confirm_kill
405 || wMessageDialog(menu->frame->screen_ptr, _("Kill Application"),
406 buffer, _("Yes"), _("No"), NULL) == WAPRDefault) {
407 if (fPtr != NULL) {
408 WWindow *wwin, *twin;
410 wwin = wapp->main_window_desc->screen_ptr->focused_window;
411 while (wwin) {
412 twin = wwin->prev;
413 if (wwin->fake_group == fPtr) {
414 wClientKill(wwin);
416 wwin = twin;
418 } else if (!wapp->main_window_desc->flags.destroyed) {
419 wClientKill(wapp->main_window_desc);
422 wrelease(wapp->main_window_desc);
424 wfree(buffer);
426 WCHANGE_STATE(WSTATE_NORMAL);
429 static WMenu *createApplicationMenu(WScreen * scr)
431 WMenu *menu;
433 menu = wMenuCreate(scr, NULL, False);
434 wMenuAddCallback(menu, _("Unhide Here"), unhideHereCallback, NULL);
435 wMenuAddCallback(menu, _("Hide"), hideCallback, NULL);
436 wMenuAddCallback(menu, _("Set Icon..."), setIconCallback, NULL);
437 wMenuAddCallback(menu, _("Kill"), killCallback, NULL);
439 return menu;
442 static void openApplicationMenu(WApplication * wapp, int x, int y)
444 WMenu *menu;
445 WScreen *scr = wapp->main_window_desc->screen_ptr;
446 int i;
448 if (!scr->icon_menu) {
449 scr->icon_menu = createApplicationMenu(scr);
450 wfree(scr->icon_menu->entries[1]->text);
453 menu = scr->icon_menu;
455 if (wapp->flags.hidden) {
456 menu->entries[1]->text = _("Unhide");
457 } else {
458 menu->entries[1]->text = _("Hide");
461 menu->flags.realized = 0;
462 wMenuRealize(menu);
464 x -= menu->frame->core->width / 2;
465 if (x + menu->frame->core->width > scr->scr_width)
466 x = scr->scr_width - menu->frame->core->width;
467 if (x < 0)
468 x = 0;
470 /* set client data */
471 for (i = 0; i < menu->entry_no; i++) {
472 menu->entries[i]->clientdata = wapp;
474 wMenuMapAt(menu, x, y, False);
477 /******************************************************************/
479 static void iconExpose(WObjDescriptor * desc, XEvent * event)
481 wAppIconPaint(desc->parent);
484 static void iconDblClick(WObjDescriptor * desc, XEvent * event)
486 WAppIcon *aicon = desc->parent;
487 WApplication *wapp;
488 WScreen *scr = aicon->icon->core->screen_ptr;
489 int unhideHere;
491 assert(aicon->icon->owner != NULL);
493 wapp = wApplicationOf(aicon->icon->owner->main_window);
494 #ifdef DEBUG0
495 if (!wapp) {
496 wwarning("could not find application descriptor for app icon!!");
497 return;
499 #endif
501 unhideHere = (event->xbutton.state & ShiftMask);
503 /* go to the last workspace that the user worked on the app */
504 if (!unhideHere && wapp->last_workspace != scr->current_workspace)
505 wWorkspaceChange(scr, wapp->last_workspace);
507 wUnhideApplication(wapp, event->xbutton.button == Button2, unhideHere);
509 if (event->xbutton.state & MOD_MASK) {
510 wHideOtherApplications(aicon->icon->owner);
514 void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
516 WAppIcon *aicon = desc->parent;
517 WIcon *icon = aicon->icon;
518 XEvent ev;
519 int x = aicon->x_pos, y = aicon->y_pos;
520 int dx = event->xbutton.x, dy = event->xbutton.y;
521 int grabbed = 0;
522 int done = 0;
523 int superfluous = wPreferences.superfluous; /* we catch it to avoid problems */
524 WScreen *scr = icon->core->screen_ptr;
525 WWorkspace *workspace = scr->workspaces[scr->current_workspace];
526 int shad_x = 0, shad_y = 0, docking = 0, dockable, collapsed = 0;
527 int ix, iy;
528 int clickButton = event->xbutton.button;
529 Pixmap ghost = None;
530 Window wins[2];
531 Bool movingSingle = False;
532 int oldX = x;
533 int oldY = y;
534 Bool hasMoved = False;
536 if (aicon->editing || WCHECK_STATE(WSTATE_MODAL))
537 return;
539 if (IsDoubleClick(scr, event)) {
540 iconDblClick(desc, event);
541 return;
544 if (event->xbutton.button == Button3) {
545 WObjDescriptor *desc;
546 WApplication *wapp = wApplicationOf(aicon->icon->owner->main_window);
548 if (!wapp)
549 return;
551 if (event->xbutton.send_event &&
552 XGrabPointer(dpy, aicon->icon->core->window, True, ButtonMotionMask
553 | ButtonReleaseMask | ButtonPressMask, GrabModeAsync,
554 GrabModeAsync, None, None, CurrentTime) != GrabSuccess) {
555 wwarning("pointer grab failed for appicon menu");
556 return;
559 openApplicationMenu(wapp, event->xbutton.x_root, event->xbutton.y_root);
561 /* allow drag select of menu */
562 desc = &scr->icon_menu->menu->descriptor;
563 event->xbutton.send_event = True;
564 (*desc->handle_mousedown) (desc, event);
565 return;
567 #ifdef DEBUG
568 puts("Moving icon");
569 #endif
570 if (event->xbutton.state & MOD_MASK)
571 wLowerFrame(icon->core);
572 else
573 wRaiseFrame(icon->core);
575 if (XGrabPointer(dpy, icon->core->window, True, ButtonMotionMask
576 | ButtonReleaseMask | ButtonPressMask, GrabModeAsync,
577 GrabModeAsync, None, None, CurrentTime) != GrabSuccess) {
578 wwarning("pointer grab failed for appicon move");
581 if (wPreferences.flags.nodock && wPreferences.flags.noclip)
582 dockable = 0;
583 else
584 dockable = canBeDocked(icon->owner);
586 wins[0] = icon->core->window;
587 wins[1] = scr->dock_shadow;
588 XRestackWindows(dpy, wins, 2);
589 if (superfluous) {
590 if (icon->pixmap != None)
591 ghost = MakeGhostIcon(scr, icon->pixmap);
592 else
593 ghost = MakeGhostIcon(scr, icon->core->window);
594 XSetWindowBackgroundPixmap(dpy, scr->dock_shadow, ghost);
595 XClearWindow(dpy, scr->dock_shadow);
598 while (!done) {
599 WMMaskEvent(dpy, PointerMotionMask | ButtonReleaseMask | ButtonPressMask
600 | ButtonMotionMask | ExposureMask | EnterWindowMask, &ev);
601 switch (ev.type) {
602 case Expose:
603 WMHandleEvent(&ev);
604 break;
606 case EnterNotify:
607 /* It means the cursor moved so fast that it entered
608 * something else (if moving slowly, it would have
609 * stayed in the appIcon that is being moved. Ignore
610 * such "spurious" EnterNotifiy's */
611 break;
613 case MotionNotify:
614 hasMoved = True;
615 if (!grabbed) {
616 if (abs(dx - ev.xmotion.x) >= MOVE_THRESHOLD
617 || abs(dy - ev.xmotion.y) >= MOVE_THRESHOLD) {
618 XChangeActivePointerGrab(dpy, ButtonMotionMask
619 | ButtonReleaseMask | ButtonPressMask,
620 wCursor[WCUR_MOVE], CurrentTime);
621 grabbed = 1;
622 } else {
623 break;
626 x = ev.xmotion.x_root - dx;
627 y = ev.xmotion.y_root - dy;
629 if (movingSingle) {
630 XMoveWindow(dpy, icon->core->window, x, y);
631 } else {
632 wAppIconMove(aicon, x, y);
635 if (dockable) {
636 if (scr->dock && wDockSnapIcon(scr->dock, aicon, x, y, &ix, &iy, False)) {
637 shad_x = scr->dock->x_pos + ix * wPreferences.icon_size;
638 shad_y = scr->dock->y_pos + iy * wPreferences.icon_size;
640 if (scr->last_dock != scr->dock && collapsed) {
641 scr->last_dock->collapsed = 1;
642 wDockHideIcons(scr->last_dock);
643 collapsed = 0;
645 if (!collapsed && (collapsed = scr->dock->collapsed)) {
646 scr->dock->collapsed = 0;
647 wDockShowIcons(scr->dock);
650 if (scr->dock->auto_raise_lower)
651 wDockRaise(scr->dock);
653 scr->last_dock = scr->dock;
655 XMoveWindow(dpy, scr->dock_shadow, shad_x, shad_y);
656 if (!docking) {
657 XMapWindow(dpy, scr->dock_shadow);
659 docking = 1;
660 } else if (workspace->clip &&
661 wDockSnapIcon(workspace->clip, aicon, x, y, &ix, &iy, False)) {
662 shad_x = workspace->clip->x_pos + ix * wPreferences.icon_size;
663 shad_y = workspace->clip->y_pos + iy * wPreferences.icon_size;
665 if (scr->last_dock != workspace->clip && collapsed) {
666 scr->last_dock->collapsed = 1;
667 wDockHideIcons(scr->last_dock);
668 collapsed = 0;
670 if (!collapsed && (collapsed = workspace->clip->collapsed)) {
671 workspace->clip->collapsed = 0;
672 wDockShowIcons(workspace->clip);
675 if (workspace->clip->auto_raise_lower)
676 wDockRaise(workspace->clip);
678 scr->last_dock = workspace->clip;
680 XMoveWindow(dpy, scr->dock_shadow, shad_x, shad_y);
681 if (!docking) {
682 XMapWindow(dpy, scr->dock_shadow);
684 docking = 1;
685 } else if (docking) {
686 XUnmapWindow(dpy, scr->dock_shadow);
687 docking = 0;
691 break;
693 case ButtonPress:
694 break;
696 case ButtonRelease:
697 if (ev.xbutton.button != clickButton)
698 break;
699 XUngrabPointer(dpy, CurrentTime);
701 if (docking) {
702 Bool docked;
704 /* icon is trying to be docked */
705 SlideWindow(icon->core->window, x, y, shad_x, shad_y);
706 XUnmapWindow(dpy, scr->dock_shadow);
707 docked = wDockAttachIcon(scr->last_dock, aicon, ix, iy);
708 if (scr->last_dock->auto_collapse) {
709 collapsed = 0;
711 if (workspace->clip &&
712 workspace->clip != scr->last_dock && workspace->clip->auto_raise_lower)
713 wDockLower(workspace->clip);
715 if (!docked) {
716 /* If icon could not be docked, slide it back to the old
717 * position */
718 SlideWindow(icon->core->window, x, y, oldX, oldY);
720 } else {
721 if (movingSingle) {
722 /* move back to its place */
723 SlideWindow(icon->core->window, x, y, oldX, oldY);
724 wAppIconMove(aicon, oldX, oldY);
725 } else {
726 XMoveWindow(dpy, icon->core->window, x, y);
727 aicon->x_pos = x;
728 aicon->y_pos = y;
730 if (workspace->clip && workspace->clip->auto_raise_lower)
731 wDockLower(workspace->clip);
733 if (collapsed) {
734 scr->last_dock->collapsed = 1;
735 wDockHideIcons(scr->last_dock);
736 collapsed = 0;
738 if (superfluous) {
739 if (ghost != None)
740 XFreePixmap(dpy, ghost);
741 XSetWindowBackground(dpy, scr->dock_shadow, scr->white_pixel);
744 if (wPreferences.auto_arrange_icons)
745 wArrangeIcons(scr, True);
747 if (wPreferences.single_click && !hasMoved)
748 iconDblClick(desc, event);
750 done = 1;
751 break;
754 #ifdef DEBUG
755 puts("End icon move");
756 #endif