1 /* appicon.c- icon for applications (not mini-window)
3 * Window Maker window manager
5 * Copyright (c) 1997, 1998 Alfredo K. Kojima
6 * Copyright (c) 1998 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,
27 #include <X11/Xutil.h>
31 #include "WindowMaker.h"
41 #include "workspace.h"
42 #include "superfluous.h"
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
);
69 wAppIconCreateForDock(WScreen
*scr
, char *command
, char *wm_instance
,
70 char *wm_class
, int tile
)
75 dicon
= wmalloc(sizeof(WAppIcon
));
77 memset(dicon
, 0, sizeof(WAppIcon
));
82 dicon
->next
= scr
->app_icon_list
;
83 if (scr
->app_icon_list
) {
84 scr
->app_icon_list
->prev
= dicon
;
86 scr
->app_icon_list
= dicon
;
89 dicon
->command
= wstrdup(command
);
92 dicon
->wm_class
= wstrdup(wm_class
);
94 dicon
->wm_instance
= wstrdup(wm_instance
);
96 path
= wDefaultGetIconFile(scr
, wm_instance
, wm_class
, True
);
97 if (!path
&& command
) {
98 wApplicationExtractDirPackIcon(scr
, command
, wm_instance
, wm_class
);
100 path
= wDefaultGetIconFile(scr
, wm_instance
, wm_class
, False
);
104 path
= FindImage(wPreferences
.icon_path
, path
);
106 dicon
->icon
= wIconCreateWithIconFile(scr
, path
, tile
);
110 wXDNDMakeAwareness(dicon
->icon
->core
->window
);
112 #ifdef REDUCE_APPICONS
115 #ifdef DEMATERIALIZE_ICON
117 XSetWindowAttributes attribs
;
118 attribs
.save_under
= True
;
119 XChangeWindowAttributes(dpy
, dicon
->icon
->core
->window
,
120 CWSaveUnder
, &attribs
);
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
);
137 wAppIconCreate(WWindow
*leader_win
)
140 #ifdef REDUCE_APPICONS
142 WAppIconAppList
*applist
;
143 char *tinstance
, *tclass
;
145 WScreen
*scr
= leader_win
->screen_ptr
;
147 aicon
= wmalloc(sizeof(WAppIcon
));
149 memset(aicon
, 0, sizeof(WAppIcon
));
150 #ifdef REDUCE_APPICONS
151 applist
= wmalloc(sizeof(WAppIconAppList
));
152 memset(applist
, 0, sizeof(WAppIconAppList
));
153 applist
->wapp
= wApplicationOf(leader_win
->main_window
);
154 aicon
->applist
= applist
;
155 if (applist
->wapp
== NULL
) {
156 /* Something's wrong. wApplicationOf() should always return a
157 * valid structure. Rather than violate assumptions, bail. -cls
169 aicon
->next
= scr
->app_icon_list
;
170 if (scr
->app_icon_list
) {
171 #ifndef REDUCE_APPICONS
172 scr
->app_icon_list
->prev
= aicon
;
174 /* If we aren't going to have a match, jump straight to new appicon */
175 if (leader_win
->wm_class
== NULL
|| leader_win
->wm_class
== NULL
)
178 atmp
= scr
->app_icon_list
;
180 while (atmp
!= NULL
) {
181 if ((tinstance
= atmp
->wm_instance
) == NULL
)
183 if ((tclass
= atmp
->wm_class
) == NULL
)
185 if ((strcmp(leader_win
->wm_class
, tclass
) == 0) &&
186 (strcmp(leader_win
->wm_instance
, tinstance
) == 0))
188 /* We have a winner */
191 applist
->next
= atmp
->applist
;
193 atmp
->applist
->prev
= applist
;
194 atmp
->applist
= applist
;
197 wDockSimulateLaunch(atmp
->dock
, atmp
);
205 scr
->app_icon_list
->prev
= aicon
;
207 #endif /* REDUCE_APPICONS */
209 scr
->app_icon_list
= aicon
;
211 if (leader_win
->wm_class
)
212 aicon
->wm_class
= wstrdup(leader_win
->wm_class
);
213 if (leader_win
->wm_instance
)
214 aicon
->wm_instance
= wstrdup(leader_win
->wm_instance
);
215 #ifdef REDUCE_APPICONS
219 aicon
->icon
= wIconCreate(leader_win
);
220 #ifdef DEMATERIALIZE_ICON
222 XSetWindowAttributes attribs
;
223 attribs
.save_under
= True
;
224 XChangeWindowAttributes(dpy
, aicon
->icon
->core
->window
,
225 CWSaveUnder
, &attribs
);
229 wXDNDMakeAwareness(aicon
->icon
->core
->window
);
232 /* will be overriden if docked */
233 aicon
->icon
->core
->descriptor
.handle_mousedown
= appIconMouseDown
;
234 aicon
->icon
->core
->descriptor
.handle_expose
= iconExpose
;
235 aicon
->icon
->core
->descriptor
.parent_type
= WCLASS_APPICON
;
236 aicon
->icon
->core
->descriptor
.parent
= aicon
;
237 AddToStackList(aicon
->icon
->core
);
238 aicon
->icon
->show_title
= 0;
239 wIconUpdate(aicon
->icon
);
246 wAppIconDestroy(WAppIcon
*aicon
)
248 WScreen
*scr
= aicon
->icon
->core
->screen_ptr
;
249 #ifdef REDUCE_APPICONS
250 WAppIconAppList
*aptmp
;
253 RemoveFromStackList(aicon
->icon
->core
);
254 wIconDestroy(aicon
->icon
);
256 free(aicon
->command
);
258 if (aicon
->dnd_command
)
259 free(aicon
->dnd_command
);
261 if (aicon
->wm_instance
)
262 free(aicon
->wm_instance
);
264 free(aicon
->wm_class
);
265 #ifdef REDUCE_APPICONS
266 /* There should never be a list but just in case */
267 if (aicon
->applist
!= NULL
) {
268 aptmp
= aicon
->applist
;
269 while (aptmp
->next
) {
277 if (aicon
== scr
->app_icon_list
) {
279 aicon
->next
->prev
= NULL
;
280 scr
->app_icon_list
= aicon
->next
;
284 aicon
->next
->prev
= aicon
->prev
;
286 aicon
->prev
->next
= aicon
->next
;
289 aicon
->destroyed
= 1;
297 drawCorner(WIcon
*icon
, WWindow
*wwin
, int active
)
299 WScreen
*scr
= wwin
->screen_ptr
;
310 gc
=scr
->focused_texture
->any
.gc
;
312 gc
=scr
->unfocused_texture
->any
.gc
;
314 XFillPolygon(dpy
, icon
->core
->window
, gc
, points
, 3,
315 Convex
, CoordModeOrigin
);
317 #endif /* NEWAPPICON */
321 wAppIconMove(WAppIcon
*aicon
, int x
, int y
)
323 XMoveWindow(dpy
, aicon
->icon
->core
->window
, x
, y
);
331 updateDockNumbers(WScreen
*scr
)
336 XGCValues my_gc_values
;
337 unsigned long my_v_mask
= (GCForeground
);
338 WAppIcon
*dicon
= scr
->dock
->icon_array
[0];
340 my_gc_values
.foreground
= scr
->white_pixel
;
341 numbers_gc
= XCreateGC(dpy
, dicon
->icon
->core
->window
,
342 my_v_mask
, &my_gc_values
);
344 ws_numbers
= malloc(20);
345 sprintf(ws_numbers
, "%i [ %i ]", scr
->current_workspace
+1,
346 ((scr
->current_workspace
/10)+1));
347 length
= strlen(ws_numbers
);
349 XClearArea(dpy
, dicon
->icon
->core
->window
, 2, 2, 50,
350 scr
->icon_title_font
->y
+1, False
);
352 XSetForeground(dpy
, numbers_gc
, scr
->black_pixel
);
353 WMDrawString(scr
->wmscreen
, dicon
->icon
->core
->window
, numbers_gc
,
354 scr
->icon_title_font
->font
, 4, 3, ws_numbers
, length
);
356 XSetForeground(dpy
, numbers_gc
, scr
->white_pixel
);
357 WMDrawString(scr
->wmscreen
, dicon
->icon
->core
->window
, numbers_gc
,
358 scr
->icon_title_font
->font
, 3, 2, ws_numbers
, length
);
360 XFreeGC(dpy
, numbers_gc
);
363 #endif /* WS_INDICATOR */
367 wAppIconPaint(WAppIcon
*aicon
)
369 WScreen
*scr
= aicon
->icon
->core
->screen_ptr
;
371 wIconPaint(aicon
->icon
);
375 if (aicon
->docked
&& scr
->dock
&& aicon
->yindex
==0)
376 updateDockNumbers(scr
);
378 if (scr
->dock_dots
&& aicon
->docked
&& !aicon
->running
379 && aicon
->command
!=NULL
) {
380 XSetClipMask(dpy
, scr
->copy_gc
, scr
->dock_dots
->mask
);
381 XSetClipOrigin(dpy
, scr
->copy_gc
, 0, 0);
382 XCopyArea(dpy
, scr
->dock_dots
->image
, aicon
->icon
->core
->window
,
383 scr
->copy_gc
, 0, 0, scr
->dock_dots
->width
,
384 scr
->dock_dots
->height
, 0, 0);
390 wapp
= wApplicationOf(aicon
->main_window
);
391 if (wapp
&& wapp
->flags
.hidden
) {
392 XSetClipMask(dpy
, scr
->copy_gc
, scr
->dock_dots
->mask
);
393 XSetClipOrigin(dpy
, scr
->copy_gc
, 0, 0);
394 XCopyArea(dpy
, scr
->dock_dots
->image
,
395 aicon
->icon
->core
->window
,
396 scr
->copy_gc
, 0, 0, 7,
397 scr
->dock_dots
->height
, 0, 0);
400 #endif /* HIDDENDOT */
403 if (!wPreferences
.strict_ns
&& aicon
->icon
->owner
!=NULL
) {
405 if (aicon
->main_window
==None
) {
406 active
= (aicon
->icon
->owner
->flags
.focused
? 1 : 0);
410 wapp
= wApplicationOf(aicon
->main_window
);
412 active
= aicon
->icon
->owner
->flags
.focused
;
413 wwarning("error in wAppIconPaint(). Please report it");
415 active
= wapp
->main_window_desc
->flags
.focused
;
416 if (wapp
->main_window_desc
->flags
.hidden
417 || !wapp
->main_window_desc
->flags
.mapped
)
422 drawCorner(aicon
->icon
, aicon
->icon
->owner
, active
);
424 #endif /* NEWAPPICON */
426 XSetClipMask(dpy
, scr
->copy_gc
, None
);
427 if (aicon
->launching
) {
428 XFillRectangle(dpy
, aicon
->icon
->core
->window
, scr
->stipple_gc
,
429 0, 0, wPreferences
.icon_size
, wPreferences
.icon_size
);
435 #define canBeDocked(wwin) ((wwin) && ((wwin)->wm_class||(wwin)->wm_instance))
437 #ifdef REDUCE_APPICONS
439 wAppIconReduceAppCount(WApplication
*wapp
)
441 WAppIconAppList
*applist
;
446 if (wapp
->app_icon
== NULL
)
449 /* If given a main window, check the applist
450 * and remove the if it exists
452 applist
= wapp
->app_icon
->applist
;
453 while (applist
!= NULL
) {
454 if (applist
->wapp
== wapp
) {
455 /* If this app owns the appicon, change the appicon's
456 * owner to the next app in the list or NULL
458 if (wapp
->app_icon
->icon
->owner
== applist
->wapp
->main_window_desc
)
461 wapp
->app_icon
->icon
->owner
= applist
->next
->wapp
->main_window_desc
;
462 } else if (applist
->prev
) {
463 wapp
->app_icon
->icon
->owner
= applist
->prev
->wapp
->main_window_desc
;
465 wapp
->app_icon
->icon
->owner
= NULL
;
469 applist
->prev
->next
= applist
->next
;
472 applist
->next
->prev
= applist
->prev
;
474 if (applist
== wapp
->app_icon
->applist
)
475 wapp
->app_icon
->applist
= applist
->next
;
479 if (wapp
->app_icon
->applist
!= NULL
)
480 wapp
->app_icon
->main_window
= wapp
->app_icon
->applist
->wapp
->main_window
;
482 return (--wapp
->app_icon
->num_apps
);
484 applist
= applist
->next
;
486 return (--wapp
->app_icon
->num_apps
);
492 hideCallback(WMenu
*menu
, WMenuEntry
*entry
)
494 WApplication
*wapp
= (WApplication
*)entry
->clientdata
;
496 if (wapp
->flags
.hidden
) {
497 wWorkspaceChange(menu
->menu
->screen_ptr
, wapp
->last_workspace
);
498 wUnhideApplication(wapp
, False
, False
);
500 wHideApplication(wapp
);
506 unhideHereCallback(WMenu
*menu
, WMenuEntry
*entry
)
508 WApplication
*wapp
= (WApplication
*)entry
->clientdata
;
510 wUnhideApplication(wapp
, False
, True
);
515 setIconCallback(WMenu
*menu
, WMenuEntry
*entry
)
517 WAppIcon
*icon
= ((WApplication
*)entry
->clientdata
)->app_icon
;
527 scr
= icon
->icon
->core
->screen_ptr
;
531 result
= wIconChooserDialog(scr
, &file
, icon
->wm_instance
, icon
->wm_class
);
533 if (result
&& !icon
->destroyed
) {
538 if (!wIconChangeImageFile(icon
->icon
, file
)) {
539 wMessageDialog(scr
, _("Error"),
540 _("Could not open specified icon file"),
541 _("OK"), NULL
, NULL
);
543 wDefaultChangeIcon(scr
, icon
->wm_instance
, icon
->wm_class
, file
);
555 killCallback(WMenu
*menu
, WMenuEntry
*entry
)
557 WApplication
*wapp
= (WApplication
*)entry
->clientdata
;
560 if (!WCHECK_STATE(WSTATE_NORMAL
))
563 WCHANGE_STATE(WSTATE_MODAL
);
565 assert(entry
->clientdata
!=NULL
);
567 buffer
= wstrappend(wapp
->app_icon
? wapp
->app_icon
->wm_class
: NULL
,
568 _(" will be forcibly closed.\n"
569 "Any unsaved changes will be lost.\n"
572 wretain(wapp
->main_window_desc
);
573 if (wPreferences
.dont_confirm_kill
574 || wMessageDialog(menu
->frame
->screen_ptr
, _("Kill Application"),
575 buffer
, _("Yes"), _("No"), NULL
)==WAPRDefault
) {
576 if (!wapp
->main_window_desc
->flags
.destroyed
)
577 wClientKill(wapp
->main_window_desc
);
579 wrelease(wapp
->main_window_desc
);
583 WCHANGE_STATE(WSTATE_NORMAL
);
588 createApplicationMenu(WScreen
*scr
)
592 menu
= wMenuCreate(scr
, NULL
, False
);
593 wMenuAddCallback(menu
, _("Unhide Here"), unhideHereCallback
, NULL
);
594 wMenuAddCallback(menu
, _("Hide"), hideCallback
, NULL
);
595 wMenuAddCallback(menu
, _("Set Icon..."), setIconCallback
, NULL
);
596 wMenuAddCallback(menu
, _("Kill"), killCallback
, NULL
);
603 openApplicationMenu(WApplication
*wapp
, int x
, int y
)
606 WScreen
*scr
= wapp
->main_window_desc
->screen_ptr
;
609 if (!scr
->icon_menu
) {
610 scr
->icon_menu
= createApplicationMenu(scr
);
611 free(scr
->icon_menu
->entries
[1]->text
);
614 menu
= scr
->icon_menu
;
616 if (wapp
->flags
.hidden
) {
617 menu
->entries
[1]->text
= _("Unhide");
619 menu
->entries
[1]->text
= _("Hide");
622 menu
->flags
.realized
= 0;
625 x
-= menu
->frame
->core
->width
/2;
626 if (x
+ menu
->frame
->core
->width
> scr
->scr_width
)
627 x
= scr
->scr_width
- menu
->frame
->core
->width
;
631 /* set client data */
632 for (i
= 0; i
< menu
->entry_no
; i
++) {
633 menu
->entries
[i
]->clientdata
= wapp
;
635 wMenuMapAt(menu
, x
, y
, False
);
639 /******************************************************************/
642 iconExpose(WObjDescriptor
*desc
, XEvent
*event
)
644 wAppIconPaint(desc
->parent
);
649 iconDblClick(WObjDescriptor
*desc
, XEvent
*event
)
651 WAppIcon
*aicon
= desc
->parent
;
653 WScreen
*scr
= aicon
->icon
->core
->screen_ptr
;
656 #ifndef REDUCE_APPICONS
657 assert(aicon
->icon
->owner
!=NULL
);
659 if (aicon
->icon
->owner
== NULL
) {
660 fprintf(stderr
, "Double-click disabled: missing main window.\n");
665 wapp
= wApplicationOf(aicon
->icon
->owner
->main_window
);
668 wwarning("could not find application descriptor for app icon!!");
672 #ifdef REDUCE_APPICONS
674 fprintf(stderr
, "Double-click disabled: missing wapp.\n");
677 #endif /* REDUCE_APPICONS */
679 unhideHere
= (event
->xbutton
.state
& ShiftMask
);
681 /* go to the last workspace that the user worked on the app */
682 if (!unhideHere
&& wapp
->last_workspace
!= scr
->current_workspace
)
683 wWorkspaceChange(scr
, wapp
->last_workspace
);
685 wUnhideApplication(wapp
, event
->xbutton
.button
==Button2
, unhideHere
);
687 if (event
->xbutton
.state
& MOD_MASK
) {
688 wHideOtherApplications(aicon
->icon
->owner
);
694 appIconMouseDown(WObjDescriptor
*desc
, XEvent
*event
)
696 WAppIcon
*aicon
= desc
->parent
;
697 WIcon
*icon
= aicon
->icon
;
699 int x
=aicon
->x_pos
, y
=aicon
->y_pos
;
700 int dx
=event
->xbutton
.x
, dy
=event
->xbutton
.y
;
703 int superfluous
= wPreferences
.superfluous
; /* we catch it to avoid problems */
704 WScreen
*scr
= icon
->core
->screen_ptr
;
705 WWorkspace
*workspace
= scr
->workspaces
[scr
->current_workspace
];
706 int shad_x
= 0, shad_y
= 0, docking
=0, dockable
, collapsed
= 0;
708 int clickButton
= event
->xbutton
.button
;
712 if (aicon
->editing
|| WCHECK_STATE(WSTATE_MODAL
))
715 if (IsDoubleClick(scr
, event
)) {
716 iconDblClick(desc
, event
);
720 if (event
->xbutton
.button
== Button3
) {
721 WObjDescriptor
*desc
;
722 WApplication
*wapp
= wApplicationOf(aicon
->icon
->owner
->main_window
);
727 openApplicationMenu(wapp
, event
->xbutton
.x_root
,
728 event
->xbutton
.y_root
);
730 /* allow drag select of menu */
731 desc
= &scr
->icon_menu
->menu
->descriptor
;
732 event
->xbutton
.send_event
= True
;
733 (*desc
->handle_mousedown
)(desc
, event
);
740 if (event
->xbutton
.state
& MOD_MASK
)
741 wLowerFrame(icon
->core
);
743 wRaiseFrame(icon
->core
);
746 if (XGrabPointer(dpy
, icon
->core
->window
, True
, ButtonMotionMask
747 |ButtonReleaseMask
|ButtonPressMask
, GrabModeAsync
,
748 GrabModeAsync
, None
, None
, CurrentTime
) !=GrabSuccess
) {
749 wwarning("pointer grab failed for appicon move");
752 if (wPreferences
.flags
.nodock
&& wPreferences
.flags
.noclip
)
755 dockable
= canBeDocked(icon
->owner
);
757 wins
[0] = icon
->core
->window
;
758 wins
[1] = scr
->dock_shadow
;
759 XRestackWindows(dpy
, wins
, 2);
761 if (icon
->pixmap
!=None
)
762 ghost
= MakeGhostIcon(scr
, icon
->pixmap
);
764 ghost
= MakeGhostIcon(scr
, icon
->core
->window
);
765 XSetWindowBackgroundPixmap(dpy
, scr
->dock_shadow
,
767 XClearWindow(dpy
, scr
->dock_shadow
);
771 WMMaskEvent(dpy
, PointerMotionMask
|ButtonReleaseMask
|ButtonPressMask
772 |ButtonMotionMask
|ExposureMask
, &ev
);
780 if (abs(dx
-ev
.xmotion
.x
)>=MOVE_THRESHOLD
781 || abs(dy
-ev
.xmotion
.y
)>=MOVE_THRESHOLD
) {
782 XChangeActivePointerGrab(dpy
, ButtonMotionMask
783 |ButtonReleaseMask
|ButtonPressMask
,
784 wCursor
[WCUR_MOVE
], CurrentTime
);
790 x
= ev
.xmotion
.x_root
- dx
;
791 y
= ev
.xmotion
.y_root
- dy
;
792 XMoveWindow(dpy
, icon
->core
->window
, x
, y
);
795 if (scr
->dock
&& wDockSnapIcon(scr
->dock
, aicon
, x
, y
,
797 shad_x
= scr
->dock
->x_pos
+ ix
*wPreferences
.icon_size
;
798 shad_y
= scr
->dock
->y_pos
+ iy
*wPreferences
.icon_size
;
800 if (scr
->last_dock
!= scr
->dock
&& collapsed
) {
801 scr
->last_dock
->collapsed
= 1;
802 wDockHideIcons(scr
->last_dock
);
805 if (!collapsed
&& (collapsed
= scr
->dock
->collapsed
)) {
806 scr
->dock
->collapsed
= 0;
807 wDockShowIcons(scr
->dock
);
810 if (scr
->dock
->auto_raise_lower
)
811 wDockRaise(scr
->dock
);
813 scr
->last_dock
= scr
->dock
;
815 XMoveWindow(dpy
, scr
->dock_shadow
, shad_x
, shad_y
);
817 XMapWindow(dpy
, scr
->dock_shadow
);
820 } else if (workspace
->clip
&&
821 wDockSnapIcon(workspace
->clip
, aicon
, x
, y
,
823 shad_x
= workspace
->clip
->x_pos
+ ix
*wPreferences
.icon_size
;
824 shad_y
= workspace
->clip
->y_pos
+ iy
*wPreferences
.icon_size
;
826 if (scr
->last_dock
!= workspace
->clip
&& collapsed
) {
827 scr
->last_dock
->collapsed
= 1;
828 wDockHideIcons(scr
->last_dock
);
831 if (!collapsed
&& (collapsed
= workspace
->clip
->collapsed
)) {
832 workspace
->clip
->collapsed
= 0;
833 wDockShowIcons(workspace
->clip
);
836 if (workspace
->clip
->auto_raise_lower
)
837 wDockRaise(workspace
->clip
);
839 scr
->last_dock
= workspace
->clip
;
841 XMoveWindow(dpy
, scr
->dock_shadow
, shad_x
, shad_y
);
843 XMapWindow(dpy
, scr
->dock_shadow
);
846 } else if (docking
) {
847 XUnmapWindow(dpy
, scr
->dock_shadow
);
858 if (ev
.xbutton
.button
!= clickButton
)
860 XUngrabPointer(dpy
, CurrentTime
);
865 /* icon is trying to be docked */
866 SlideWindow(icon
->core
->window
, x
, y
, shad_x
, shad_y
);
867 XUnmapWindow(dpy
, scr
->dock_shadow
);
868 docked
= wDockAttachIcon(scr
->last_dock
, aicon
, ix
, iy
);
869 if (scr
->last_dock
->auto_collapse
) {
872 if (workspace
->clip
&&
873 workspace
->clip
!= scr
->last_dock
&&
874 workspace
->clip
->auto_raise_lower
)
875 wDockLower(workspace
->clip
);
878 /* If icon could not be docked, slide it back to the old
880 SlideWindow(icon
->core
->window
, x
, y
, aicon
->x_pos
,
884 XMoveWindow(dpy
, icon
->core
->window
, x
, y
);
887 if (workspace
->clip
&& workspace
->clip
->auto_raise_lower
)
888 wDockLower(workspace
->clip
);
891 scr
->last_dock
->collapsed
= 1;
892 wDockHideIcons(scr
->last_dock
);
897 XFreePixmap(dpy
, ghost
);
898 XSetWindowBackground(dpy
, scr
->dock_shadow
, scr
->white_pixel
);
901 if (wPreferences
.auto_arrange_icons
)
902 wArrangeIcons(scr
, True
);
909 puts("End icon move");