changed indentation to use spaces only
[wmaker-crm.git] / src / appicon.c
blob994fa82145b126feec04362481a817d84f9aef84
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
50 #include "wsound.h"
54 * icon_file for the dock is got from the preferences file by
55 * using the classname/instancename
58 /**** Global variables ****/
59 extern Cursor wCursor[WCUR_LAST];
60 extern WPreferences wPreferences;
62 #define MOD_MASK wPreferences.modifier_mask
64 void appIconMouseDown(WObjDescriptor *desc, XEvent *event);
65 static void iconDblClick(WObjDescriptor *desc, XEvent *event);
66 static void iconExpose(WObjDescriptor *desc, XEvent *event);
70 WAppIcon*
71 wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance,
72 char *wm_class, int tile)
74 WAppIcon *dicon;
75 char *path;
77 dicon = wmalloc(sizeof(WAppIcon));
78 wretain(dicon);
79 memset(dicon, 0, sizeof(WAppIcon));
80 dicon->yindex = -1;
81 dicon->xindex = -1;
83 dicon->prev = NULL;
84 dicon->next = scr->app_icon_list;
85 if (scr->app_icon_list) {
86 scr->app_icon_list->prev = dicon;
88 scr->app_icon_list = dicon;
90 if (command) {
91 dicon->command = wstrdup(command);
93 if (wm_class)
94 dicon->wm_class = wstrdup(wm_class);
95 if (wm_instance)
96 dicon->wm_instance = wstrdup(wm_instance);
98 path = wDefaultGetIconFile(scr, wm_instance, wm_class, True);
99 if (!path && command) {
100 wApplicationExtractDirPackIcon(scr, command, wm_instance, wm_class);
102 path = wDefaultGetIconFile(scr, wm_instance, wm_class, False);
105 if (path)
106 path = FindImage(wPreferences.icon_path, path);
108 dicon->icon = wIconCreateWithIconFile(scr, path, tile);
109 if (path)
110 wfree(path);
111 #ifdef XDND
112 wXDNDMakeAwareness(dicon->icon->core->window);
113 #endif
115 #ifdef DEMATERIALIZE_ICON
117 XSetWindowAttributes attribs;
118 attribs.save_under = True;
119 XChangeWindowAttributes(dpy, dicon->icon->core->window,
120 CWSaveUnder, &attribs);
122 #endif
124 /* will be overriden by dock */
125 dicon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
126 dicon->icon->core->descriptor.handle_expose = iconExpose;
127 dicon->icon->core->descriptor.parent_type = WCLASS_APPICON;
128 dicon->icon->core->descriptor.parent = dicon;
129 AddToStackList(dicon->icon->core);
131 return dicon;
136 WAppIcon*
137 wAppIconCreate(WWindow *leader_win)
139 WAppIcon *aicon;
140 WScreen *scr = leader_win->screen_ptr;
142 aicon = wmalloc(sizeof(WAppIcon));
143 wretain(aicon);
144 memset(aicon, 0, sizeof(WAppIcon));
146 aicon->yindex = -1;
147 aicon->xindex = -1;
149 aicon->prev = NULL;
150 aicon->next = scr->app_icon_list;
151 if (scr->app_icon_list) {
152 scr->app_icon_list->prev = aicon;
154 scr->app_icon_list = aicon;
156 if (leader_win->wm_class)
157 aicon->wm_class = wstrdup(leader_win->wm_class);
158 if (leader_win->wm_instance)
159 aicon->wm_instance = wstrdup(leader_win->wm_instance);
161 aicon->icon = wIconCreate(leader_win);
162 #ifdef DEMATERIALIZE_ICON
164 XSetWindowAttributes attribs;
165 attribs.save_under = True;
166 XChangeWindowAttributes(dpy, aicon->icon->core->window,
167 CWSaveUnder, &attribs);
169 #endif
170 #ifdef XDND
171 wXDNDMakeAwareness(aicon->icon->core->window);
172 #endif
174 /* will be overriden if docked */
175 aicon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
176 aicon->icon->core->descriptor.handle_expose = iconExpose;
177 aicon->icon->core->descriptor.parent_type = WCLASS_APPICON;
178 aicon->icon->core->descriptor.parent = aicon;
179 AddToStackList(aicon->icon->core);
180 aicon->icon->show_title = 0;
181 wIconUpdate(aicon->icon);
183 return aicon;
187 void
188 wAppIconDestroy(WAppIcon *aicon)
190 WScreen *scr = aicon->icon->core->screen_ptr;
192 RemoveFromStackList(aicon->icon->core);
193 wIconDestroy(aicon->icon);
194 if (aicon->command)
195 wfree(aicon->command);
196 #ifdef OFFIX_DND
197 if (aicon->dnd_command)
198 wfree(aicon->dnd_command);
199 #endif
200 if (aicon->wm_instance)
201 wfree(aicon->wm_instance);
202 if (aicon->wm_class)
203 wfree(aicon->wm_class);
205 if (aicon == scr->app_icon_list) {
206 if (aicon->next)
207 aicon->next->prev = NULL;
208 scr->app_icon_list = aicon->next;
210 else {
211 if (aicon->next)
212 aicon->next->prev = aicon->prev;
213 if (aicon->prev)
214 aicon->prev->next = aicon->next;
217 aicon->destroyed = 1;
218 wrelease(aicon);
223 #ifdef NEWAPPICON
224 static void
225 drawCorner(WIcon *icon, WWindow *wwin, int active)
227 WScreen *scr = wwin->screen_ptr;
228 XPoint points[3];
229 GC gc;
231 points[0].x = 2;
232 points[0].y = 2;
233 points[1].x = 12;
234 points[1].y = 2;
235 points[2].x = 2;
236 points[2].y = 12;
237 if (active) {
238 gc=scr->focused_texture->any.gc;
239 } else {
240 gc=scr->unfocused_texture->any.gc;
242 XFillPolygon(dpy, icon->core->window, gc, points, 3,
243 Convex, CoordModeOrigin);
245 #endif /* NEWAPPICON */
248 static void
249 drawCorner(WIcon *icon)
251 WScreen *scr = icon->core->screen_ptr;
252 XPoint points[3];
254 points[0].x = 1;
255 points[0].y = 1;
256 points[1].x = 12;
257 points[1].y = 1;
258 points[2].x = 1;
259 points[2].y = 12;
260 XFillPolygon(dpy, icon->core->window, scr->icon_title_texture->normal_gc,
261 points, 3, Convex, CoordModeOrigin);
262 XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc,
263 0, 0, 0, 12);
264 XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc,
265 0, 0, 12, 0);
266 /* drawing the second line gives a weird concave look. -Dan */
267 #if 0
268 XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc,
269 1, 1, 1, 11);
270 XDrawLine(dpy, icon->core->window, scr->icon_title_texture->light_gc,
271 1, 1, 11, 1);
272 #endif
276 void
277 wAppIconMove(WAppIcon *aicon, int x, int y)
279 XMoveWindow(dpy, aicon->icon->core->window, x, y);
280 aicon->x_pos = x;
281 aicon->y_pos = y;
285 #ifdef WS_INDICATOR
286 static void
287 updateDockNumbers(WScreen *scr)
289 int length;
290 char *ws_numbers;
291 WAppIcon *dicon = scr->dock->icon_array[0];
293 ws_numbers = wmalloc(20);
294 snprintf(ws_numbers, 20, "%i [ %i ]", scr->current_workspace+1,
295 ((scr->current_workspace/10)+1));
296 length = strlen(ws_numbers);
298 XClearArea(dpy, dicon->icon->core->window, 2, 2, 50,
299 WMFontHeight(scr->icon_title_font)+1, False);
301 WMDrawString(scr->wmscreen, dicon->icon->core->window, scr->black,
302 scr->icon_title_font, 4, 3, ws_numbers, length);
304 WMDrawString(scr->wmscreen, dicon->icon->core->window, scr->white,
305 scr->icon_title_font, 3, 2, ws_numbers, length);
307 wfree(ws_numbers);
309 #endif /* WS_INDICATOR */
312 void
313 wAppIconPaint(WAppIcon *aicon)
315 WApplication *wapp;
316 WScreen *scr = aicon->icon->core->screen_ptr;
318 if (aicon->icon->owner)
319 wapp = wApplicationOf(aicon->icon->owner->main_window);
320 else
321 wapp = NULL;
323 wIconPaint(aicon->icon);
326 # ifdef WS_INDICATOR
327 if (aicon->docked && scr->dock && scr->dock==aicon->dock &&
328 aicon->yindex==0)
329 updateDockNumbers(scr);
330 # endif
331 if (scr->dock_dots && aicon->docked && !aicon->running
332 && aicon->command!=NULL) {
333 XSetClipMask(dpy, scr->copy_gc, scr->dock_dots->mask);
334 XSetClipOrigin(dpy, scr->copy_gc, 0, 0);
335 XCopyArea(dpy, scr->dock_dots->image, aicon->icon->core->window,
336 scr->copy_gc, 0, 0, scr->dock_dots->width,
337 scr->dock_dots->height, 0, 0);
340 #ifdef HIDDENDOT
341 if (wapp && wapp->flags.hidden) {
342 XSetClipMask(dpy, scr->copy_gc, scr->dock_dots->mask);
343 XSetClipOrigin(dpy, scr->copy_gc, 0, 0);
344 XCopyArea(dpy, scr->dock_dots->image,
345 aicon->icon->core->window,
346 scr->copy_gc, 0, 0, 7,
347 scr->dock_dots->height, 0, 0);
349 #endif /* HIDDENDOT */
351 if (aicon->omnipresent)
352 drawCorner(aicon->icon);
354 XSetClipMask(dpy, scr->copy_gc, None);
355 if (aicon->launching) {
356 XFillRectangle(dpy, aicon->icon->core->window, scr->stipple_gc,
357 0, 0, wPreferences.icon_size, wPreferences.icon_size);
363 #define canBeDocked(wwin) ((wwin) && ((wwin)->wm_class||(wwin)->wm_instance))
367 static void
368 hideCallback(WMenu *menu, WMenuEntry *entry)
370 WApplication *wapp = (WApplication*)entry->clientdata;
372 if (wapp->flags.hidden) {
373 wWorkspaceChange(menu->menu->screen_ptr, wapp->last_workspace);
374 wUnhideApplication(wapp, False, False);
375 } else {
376 wHideApplication(wapp);
381 static void
382 unhideHereCallback(WMenu *menu, WMenuEntry *entry)
384 WApplication *wapp = (WApplication*)entry->clientdata;
386 wUnhideApplication(wapp, False, True);
390 static void
391 setIconCallback(WMenu *menu, WMenuEntry *entry)
393 WAppIcon *icon = ((WApplication*)entry->clientdata)->app_icon;
394 char *file=NULL;
395 WScreen *scr;
396 int result;
398 assert(icon!=NULL);
400 if (icon->editing)
401 return;
402 icon->editing = 1;
403 scr = icon->icon->core->screen_ptr;
405 wretain(icon);
407 result = wIconChooserDialog(scr, &file, icon->wm_instance, icon->wm_class);
409 if (result && !icon->destroyed) {
410 if (file && *file==0) {
411 wfree(file);
412 file = NULL;
414 if (!wIconChangeImageFile(icon->icon, file)) {
415 wMessageDialog(scr, _("Error"),
416 _("Could not open specified icon file"),
417 _("OK"), NULL, NULL);
418 } else {
419 wDefaultChangeIcon(scr, icon->wm_instance, icon->wm_class, file);
420 wAppIconPaint(icon);
422 if (file)
423 wfree(file);
425 icon->editing = 0;
426 wrelease(icon);
430 static void
431 killCallback(WMenu *menu, WMenuEntry *entry)
433 WApplication *wapp = (WApplication*)entry->clientdata;
434 WFakeGroupLeader *fPtr;
435 char *buffer;
437 if (!WCHECK_STATE(WSTATE_NORMAL))
438 return;
440 WCHANGE_STATE(WSTATE_MODAL);
442 assert(entry->clientdata!=NULL);
444 buffer = wstrconcat(wapp->app_icon ? wapp->app_icon->wm_class : NULL,
445 _(" will be forcibly closed.\n"
446 "Any unsaved changes will be lost.\n"
447 "Please confirm."));
449 fPtr = wapp->main_window_desc->fake_group;
451 wretain(wapp->main_window_desc);
452 if (wPreferences.dont_confirm_kill
453 || wMessageDialog(menu->frame->screen_ptr, _("Kill Application"),
454 buffer, _("Yes"), _("No"), NULL)==WAPRDefault) {
455 if (fPtr!=NULL) {
456 WWindow *wwin, *twin;
458 wwin = wapp->main_window_desc->screen_ptr->focused_window;
459 while (wwin) {
460 twin = wwin->prev;
461 if (wwin->fake_group == fPtr) {
462 wClientKill(wwin);
464 wwin = twin;
466 } else if (!wapp->main_window_desc->flags.destroyed) {
467 wClientKill(wapp->main_window_desc);
470 wrelease(wapp->main_window_desc);
472 wfree(buffer);
474 WCHANGE_STATE(WSTATE_NORMAL);
478 static WMenu*
479 createApplicationMenu(WScreen *scr)
481 WMenu *menu;
483 menu = wMenuCreate(scr, NULL, False);
484 wMenuAddCallback(menu, _("Unhide Here"), unhideHereCallback, NULL);
485 wMenuAddCallback(menu, _("Hide"), hideCallback, NULL);
486 wMenuAddCallback(menu, _("Set Icon..."), setIconCallback, NULL);
487 wMenuAddCallback(menu, _("Kill"), killCallback, NULL);
489 return menu;
493 static void
494 openApplicationMenu(WApplication *wapp, int x, int y)
496 WMenu *menu;
497 WScreen *scr = wapp->main_window_desc->screen_ptr;
498 int i;
500 if (!scr->icon_menu) {
501 scr->icon_menu = createApplicationMenu(scr);
502 wfree(scr->icon_menu->entries[1]->text);
505 menu = scr->icon_menu;
507 if (wapp->flags.hidden) {
508 menu->entries[1]->text = _("Unhide");
509 } else {
510 menu->entries[1]->text = _("Hide");
513 menu->flags.realized = 0;
514 wMenuRealize(menu);
516 x -= menu->frame->core->width/2;
517 if (x + menu->frame->core->width > scr->scr_width)
518 x = scr->scr_width - menu->frame->core->width;
519 if (x < 0)
520 x = 0;
522 /* set client data */
523 for (i = 0; i < menu->entry_no; i++) {
524 menu->entries[i]->clientdata = wapp;
526 wMenuMapAt(menu, x, y, False);
530 /******************************************************************/
532 static void
533 iconExpose(WObjDescriptor *desc, XEvent *event)
535 wAppIconPaint(desc->parent);
539 static void
540 iconDblClick(WObjDescriptor *desc, XEvent *event)
542 WAppIcon *aicon = desc->parent;
543 WApplication *wapp;
544 WScreen *scr = aicon->icon->core->screen_ptr;
545 int unhideHere;
547 assert(aicon->icon->owner!=NULL);
549 wapp = wApplicationOf(aicon->icon->owner->main_window);
550 #ifdef DEBUG0
551 if (!wapp) {
552 wwarning("could not find application descriptor for app icon!!");
553 return;
555 #endif
557 unhideHere = (event->xbutton.state & ShiftMask);
559 /* go to the last workspace that the user worked on the app */
560 if (!unhideHere && wapp->last_workspace != scr->current_workspace)
561 wWorkspaceChange(scr, wapp->last_workspace);
563 wUnhideApplication(wapp, event->xbutton.button==Button2, unhideHere);
565 if (event->xbutton.state & MOD_MASK) {
566 wHideOtherApplications(aicon->icon->owner);
572 void
573 appIconMouseDown(WObjDescriptor *desc, XEvent *event)
575 WAppIcon *aicon = desc->parent;
576 WIcon *icon = aicon->icon;
577 XEvent ev;
578 int x=aicon->x_pos, y=aicon->y_pos;
579 int dx=event->xbutton.x, dy=event->xbutton.y;
580 int grabbed=0;
581 int done=0;
582 int superfluous = wPreferences.superfluous; /* we catch it to avoid problems */
583 WScreen *scr = icon->core->screen_ptr;
584 WWorkspace *workspace = scr->workspaces[scr->current_workspace];
585 int shad_x = 0, shad_y = 0, docking=0, dockable, collapsed = 0;
586 int ix, iy;
587 int clickButton = event->xbutton.button;
588 Pixmap ghost = None;
589 Window wins[2];
590 Bool movingSingle = False;
591 int oldX = x;
592 int oldY = y;
594 if (aicon->editing || WCHECK_STATE(WSTATE_MODAL))
595 return;
597 if (IsDoubleClick(scr, event)) {
598 iconDblClick(desc, event);
599 return;
602 if (event->xbutton.button == Button3) {
603 WObjDescriptor *desc;
604 WApplication *wapp = wApplicationOf(aicon->icon->owner->main_window);
606 if (!wapp)
607 return;
609 if (event->xbutton.send_event &&
610 XGrabPointer(dpy, aicon->icon->core->window, True, ButtonMotionMask
611 |ButtonReleaseMask|ButtonPressMask, GrabModeAsync,
612 GrabModeAsync, None, None, CurrentTime) !=GrabSuccess) {
613 wwarning("pointer grab failed for appicon menu");
614 return;
617 openApplicationMenu(wapp, event->xbutton.x_root,
618 event->xbutton.y_root);
620 /* allow drag select of menu */
621 desc = &scr->icon_menu->menu->descriptor;
622 event->xbutton.send_event = True;
623 (*desc->handle_mousedown)(desc, event);
624 return;
627 #ifdef DEBUG
628 puts("Moving icon");
629 #endif
630 if (event->xbutton.state & MOD_MASK)
631 wLowerFrame(icon->core);
632 else
633 wRaiseFrame(icon->core);
635 if (XGrabPointer(dpy, icon->core->window, True, ButtonMotionMask
636 |ButtonReleaseMask|ButtonPressMask, GrabModeAsync,
637 GrabModeAsync, None, None, CurrentTime) !=GrabSuccess) {
638 wwarning("pointer grab failed for appicon move");
641 if (wPreferences.flags.nodock && wPreferences.flags.noclip)
642 dockable = 0;
643 else
644 dockable = canBeDocked(icon->owner);
646 wins[0] = icon->core->window;
647 wins[1] = scr->dock_shadow;
648 XRestackWindows(dpy, wins, 2);
649 if (superfluous) {
650 if (icon->pixmap!=None)
651 ghost = MakeGhostIcon(scr, icon->pixmap);
652 else
653 ghost = MakeGhostIcon(scr, icon->core->window);
654 XSetWindowBackgroundPixmap(dpy, scr->dock_shadow,
655 ghost);
656 XClearWindow(dpy, scr->dock_shadow);
659 while (!done) {
660 WMMaskEvent(dpy, PointerMotionMask|ButtonReleaseMask|ButtonPressMask
661 |ButtonMotionMask|ExposureMask, &ev);
662 switch (ev.type) {
663 case Expose:
664 WMHandleEvent(&ev);
665 break;
667 case MotionNotify:
668 if (!grabbed) {
669 if (abs(dx-ev.xmotion.x)>=MOVE_THRESHOLD
670 || abs(dy-ev.xmotion.y)>=MOVE_THRESHOLD) {
671 XChangeActivePointerGrab(dpy, ButtonMotionMask
672 |ButtonReleaseMask|ButtonPressMask,
673 wCursor[WCUR_MOVE], CurrentTime);
674 grabbed=1;
675 } else {
676 break;
679 x = ev.xmotion.x_root - dx;
680 y = ev.xmotion.y_root - dy;
682 if (movingSingle) {
683 XMoveWindow(dpy, icon->core->window, x, y);
684 } else {
685 wAppIconMove(aicon, x, y);
688 if (dockable) {
689 if (scr->dock && wDockSnapIcon(scr->dock, aicon, x, y,
690 &ix, &iy, False)) {
691 shad_x = scr->dock->x_pos + ix*wPreferences.icon_size;
692 shad_y = scr->dock->y_pos + iy*wPreferences.icon_size;
694 if (scr->last_dock != scr->dock && collapsed) {
695 scr->last_dock->collapsed = 1;
696 wDockHideIcons(scr->last_dock);
697 collapsed = 0;
699 if (!collapsed && (collapsed = scr->dock->collapsed)) {
700 scr->dock->collapsed = 0;
701 wDockShowIcons(scr->dock);
704 if (scr->dock->auto_raise_lower)
705 wDockRaise(scr->dock);
707 scr->last_dock = scr->dock;
709 XMoveWindow(dpy, scr->dock_shadow, shad_x, shad_y);
710 if (!docking) {
711 XMapWindow(dpy, scr->dock_shadow);
713 docking = 1;
714 } else if (workspace->clip &&
715 wDockSnapIcon(workspace->clip, aicon, x, y,
716 &ix, &iy, False)) {
717 shad_x = workspace->clip->x_pos + ix*wPreferences.icon_size;
718 shad_y = workspace->clip->y_pos + iy*wPreferences.icon_size;
720 if (scr->last_dock != workspace->clip && collapsed) {
721 scr->last_dock->collapsed = 1;
722 wDockHideIcons(scr->last_dock);
723 collapsed = 0;
725 if (!collapsed && (collapsed = workspace->clip->collapsed)) {
726 workspace->clip->collapsed = 0;
727 wDockShowIcons(workspace->clip);
730 if (workspace->clip->auto_raise_lower)
731 wDockRaise(workspace->clip);
733 scr->last_dock = workspace->clip;
735 XMoveWindow(dpy, scr->dock_shadow, shad_x, shad_y);
736 if (!docking) {
737 XMapWindow(dpy, scr->dock_shadow);
739 docking = 1;
740 } else if (docking) {
741 XUnmapWindow(dpy, scr->dock_shadow);
742 docking = 0;
746 break;
748 case ButtonPress:
749 break;
751 case ButtonRelease:
752 if (ev.xbutton.button != clickButton)
753 break;
754 XUngrabPointer(dpy, CurrentTime);
756 if (docking) {
757 Bool docked;
759 /* icon is trying to be docked */
760 SlideWindow(icon->core->window, x, y, shad_x, shad_y);
761 XUnmapWindow(dpy, scr->dock_shadow);
762 docked = wDockAttachIcon(scr->last_dock, aicon, ix, iy);
763 if (scr->last_dock->auto_collapse) {
764 collapsed = 0;
766 if (workspace->clip &&
767 workspace->clip != scr->last_dock &&
768 workspace->clip->auto_raise_lower)
769 wDockLower(workspace->clip);
771 if (!docked) {
772 /* If icon could not be docked, slide it back to the old
773 * position */
774 SlideWindow(icon->core->window, x, y, oldX, oldY);
777 wSoundPlay(WSOUND_DOCK);
778 } else {
779 if (movingSingle) {
780 /* move back to its place */
781 SlideWindow(icon->core->window, x, y, oldX, oldY);
782 wAppIconMove(aicon, oldX, oldY);
783 } else {
784 XMoveWindow(dpy, icon->core->window, x, y);
785 aicon->x_pos = x;
786 aicon->y_pos = y;
788 if (workspace->clip && workspace->clip->auto_raise_lower)
789 wDockLower(workspace->clip);
791 if (collapsed) {
792 scr->last_dock->collapsed = 1;
793 wDockHideIcons(scr->last_dock);
794 collapsed = 0;
796 if (superfluous) {
797 if (ghost!=None)
798 XFreePixmap(dpy, ghost);
799 XSetWindowBackground(dpy, scr->dock_shadow, scr->white_pixel);
802 if (wPreferences.auto_arrange_icons)
803 wArrangeIcons(scr, True);
805 done = 1;
806 break;
809 #ifdef DEBUG
810 puts("End icon move");
811 #endif