Initial revision
[wmaker-crm.git] / src / icon.c
blobd0fe636a406865e2e6502ab8ab8f98054689ead1
1 /* icon.c - window icon and dock and appicon parent
2 *
3 * WindowMaker window manager
4 *
5 * Copyright (c) 1997, 1998 Alfredo K. Kojima
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 * USA.
23 #include "wconfig.h"
25 #include <X11/Xlib.h>
26 #include <X11/Xutil.h>
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include <string.h>
30 #include <ctype.h>
31 #include <wraster.h>
33 #include "WindowMaker.h"
34 #include "wcore.h"
35 #include "texture.h"
36 #include "window.h"
37 #include "icon.h"
38 #include "actions.h"
39 #include "funcs.h"
40 #include "stacking.h"
41 #include "application.h"
42 #include "defaults.h"
43 #include "appicon.h"
45 /**** Global variables ****/
46 extern WPreferences wPreferences;
48 #define MOD_MASK wPreferences.modifier_mask
50 extern Cursor wCursor[WCUR_LAST];
53 static void miniwindowExpose(WObjDescriptor *desc, XEvent *event);
54 static void miniwindowMouseDown(WObjDescriptor *desc, XEvent *event);
55 static void miniwindowDblClick(WObjDescriptor *desc, XEvent *event);
58 INLINE static void
59 getSize(Drawable d, unsigned int *w, unsigned int *h, unsigned int *dep)
61 Window rjunk;
62 int xjunk, yjunk;
63 unsigned int bjunk;
65 XGetGeometry(dpy, d, &rjunk, &xjunk, &yjunk, w, h, &bjunk, dep);
69 WIcon*
70 wIconCreate(WWindow *wwin)
72 WScreen *scr=wwin->screen_ptr;
73 WIcon *icon;
74 char *file;
75 unsigned long vmask = 0;
76 XSetWindowAttributes attribs;
78 icon = wmalloc(sizeof(WIcon));
79 memset(icon, 0, sizeof(WIcon));
80 icon->core = wCoreCreateTopLevel(scr, wwin->icon_x, wwin->icon_y,
81 wPreferences.icon_size,
82 wPreferences.icon_size, 0);
84 if (wPreferences.use_saveunders) {
85 vmask |= CWSaveUnder;
86 attribs.save_under = True;
88 /* a white border for selecting it */
89 vmask |= CWBorderPixel;
90 attribs.border_pixel = scr->white_pixel;
92 XChangeWindowAttributes(dpy, icon->core->window, vmask, &attribs);
95 /* will be overriden if this is an application icon */
96 icon->core->descriptor.handle_mousedown = miniwindowMouseDown;
97 icon->core->descriptor.handle_expose = miniwindowExpose;
98 icon->core->descriptor.parent_type = WCLASS_MINIWINDOW;
99 icon->core->descriptor.parent = icon;
101 icon->core->stacking = wmalloc(sizeof(WStacking));
102 icon->core->stacking->above = NULL;
103 icon->core->stacking->under = NULL;
104 icon->core->stacking->window_level = WMNormalWindowLevel;
105 icon->core->stacking->child_of = NULL;
107 icon->owner = wwin;
108 if (wwin->wm_hints && (wwin->wm_hints->flags & IconWindowHint)) {
109 if (wwin->client_win == wwin->main_window) {
110 WApplication *wapp;
111 /* do not let miniwindow steal app-icon's icon window */
112 wapp = wApplicationOf(wwin->client_win);
113 if (!wapp || wapp->app_icon==NULL)
114 icon->icon_win = wwin->wm_hints->icon_window;
115 } else {
116 icon->icon_win = wwin->wm_hints->icon_window;
119 #ifdef NO_MINIWINDOW_TITLES
120 icon->show_title = 0;
121 #else
122 icon->show_title = 1;
123 #endif
124 icon->image = wDefaultGetImage(scr, wwin->wm_instance, wwin->wm_class);
126 file = wDefaultGetIconFile(scr, wwin->wm_instance, wwin->wm_class,
127 False);
128 if (file) {
129 icon->file = wstrdup(file);
132 wGetIconName(dpy, wwin->client_win, &icon->icon_name);
134 icon->tile_type = TILE_NORMAL;
136 wIconUpdate(icon);
138 XFlush(dpy);
140 return icon;
144 WIcon*
145 wIconCreateWithIconFile(WScreen *scr, char *iconfile, int tile)
147 WIcon *icon;
148 unsigned long vmask = 0;
149 XSetWindowAttributes attribs;
151 icon = wmalloc(sizeof(WIcon));
152 memset(icon, 0, sizeof(WIcon));
153 icon->core = wCoreCreateTopLevel(scr, 0, 0, wPreferences.icon_size,
154 wPreferences.icon_size, 0);
155 if (wPreferences.use_saveunders) {
156 vmask = CWSaveUnder;
157 attribs.save_under = True;
159 /* a white border for selecting it */
160 vmask |= CWBorderPixel;
161 attribs.border_pixel = scr->white_pixel;
163 XChangeWindowAttributes(dpy, icon->core->window, vmask, &attribs);
165 /* will be overriden if this is a application icon */
166 icon->core->descriptor.handle_mousedown = miniwindowMouseDown;
167 icon->core->descriptor.handle_expose = miniwindowExpose;
168 icon->core->descriptor.parent_type = WCLASS_MINIWINDOW;
169 icon->core->descriptor.parent = icon;
171 icon->core->stacking = wmalloc(sizeof(WStacking));
172 icon->core->stacking->above = NULL;
173 icon->core->stacking->under = NULL;
174 icon->core->stacking->window_level = WMNormalWindowLevel;
175 icon->core->stacking->child_of = NULL;
177 if (iconfile) {
178 icon->image = RLoadImage(scr->rcontext, iconfile, 0);
179 if (!icon->image) {
180 wwarning(_("error loading image file \"%s\""), iconfile, RErrorString);
183 icon->image = wIconValidateIconSize(scr, icon->image);
185 icon->file = wstrdup(iconfile);
188 icon->tile_type = tile;
190 wIconUpdate(icon);
192 return icon;
197 void
198 wIconDestroy(WIcon *icon)
200 WCoreWindow *core = icon->core;
201 WScreen *scr = core->screen_ptr;
203 if (icon->handlerID)
204 WMDeleteTimerHandler(icon->handlerID);
206 if (icon->icon_win) {
207 int x=0, y=0;
209 if (icon->owner) {
210 x = icon->owner->icon_x;
211 y = icon->owner->icon_y;
213 XUnmapWindow(dpy, icon->icon_win);
214 XReparentWindow(dpy, icon->icon_win, scr->root_win, x, y);
216 if (icon->icon_name)
217 XFree(icon->icon_name);
219 if (icon->pixmap)
220 XFreePixmap(dpy, icon->pixmap);
222 if (icon->file)
223 free(icon->file);
225 if (icon->image!=NULL)
226 RDestroyImage(icon->image);
228 wCoreDestroy(icon->core);
229 free(icon);
234 static void
235 drawIconTitle(WScreen *scr, Pixmap pixmap, int height)
237 XFillRectangle(dpy, pixmap, scr->icon_title_texture->normal_gc,
238 0, 0, wPreferences.icon_size, height+1);
239 XDrawLine(dpy, pixmap, scr->icon_title_texture->light_gc, 0, 0,
240 wPreferences.icon_size, 0);
241 XDrawLine(dpy, pixmap, scr->icon_title_texture->light_gc, 0, 0,
242 0, height+1);
243 XDrawLine(dpy, pixmap, scr->icon_title_texture->dim_gc,
244 wPreferences.icon_size-1, 0, wPreferences.icon_size-1, height+1);
248 static Pixmap
249 makeIcon(WScreen *scr, RImage *icon, int titled, int shadowed, int tileType)
251 RImage *tile;
252 Pixmap pixmap;
253 int x, y, sx, sy;
254 unsigned w, h;
255 int theight = scr->icon_title_font->height;
257 if (tileType == TILE_NORMAL)
258 tile = RCloneImage(scr->icon_tile);
259 else {
260 assert(scr->clip_tile);
261 tile = RCloneImage(scr->clip_tile);
263 if (icon) {
264 w = (icon->width > wPreferences.icon_size)
265 ? wPreferences.icon_size : icon->width;
266 x = (wPreferences.icon_size - w) / 2;
267 sx = (icon->width - w)/2;
269 if (!titled) {
270 h = (icon->height > wPreferences.icon_size)
271 ? wPreferences.icon_size : icon->height;
272 y = (wPreferences.icon_size - h) / 2;
273 sy = (icon->height - h)/2;
274 } else {
275 h = (icon->height+theight > wPreferences.icon_size
276 ? wPreferences.icon_size-theight : icon->height);
277 y = theight+((int)wPreferences.icon_size-theight-h)/2;
278 sy = (icon->height - h)/2;
280 RCombineArea(tile, icon, sx, sy, w, h, x, y);
283 if (shadowed) {
284 RColor color;
286 color.red = scr->icon_back_texture->light.red >> 8;
287 color.green = scr->icon_back_texture->light.green >> 8;
288 color.blue = scr->icon_back_texture->light.blue >> 8;
289 color.alpha = 150; /* about 60% */
290 RClearImage(tile, &color);
293 if (!RConvertImage(scr->rcontext, tile, &pixmap)) {
294 wwarning(_("error rendering image:%s"), RErrorString);
296 RDestroyImage(tile);
298 if (titled)
299 drawIconTitle(scr, pixmap, theight);
301 return pixmap;
305 void
306 wIconChangeTitle(WIcon *icon, char *new_title)
308 int changed;
310 changed = (new_title==NULL && icon->icon_name!=NULL)
311 || (new_title!=NULL && icon->icon_name==NULL);
313 if (icon->icon_name!=NULL)
314 XFree(icon->icon_name);
316 icon->icon_name = new_title;
318 if (changed)
319 icon->force_paint = 1;
320 wIconPaint(icon);
324 void
325 wIconChangeImage(WIcon *icon, RImage *new_image)
327 assert(icon != NULL);
329 if (icon->image)
330 RDestroyImage(icon->image);
332 icon->image = wIconValidateIconSize(icon->core->screen_ptr, new_image);
334 wIconUpdate(icon);
338 RImage*
339 wIconValidateIconSize(WScreen *scr, RImage *icon)
341 RImage *tmp;
342 int w, h;
344 if (!icon)
345 return NULL;
347 if (icon->width > wPreferences.icon_size
348 || icon->height > wPreferences.icon_size) {
349 if (icon->width > icon->height) {
350 w = wPreferences.icon_size - 4;
351 h = w*icon->height/icon->width;
352 } else {
353 h = wPreferences.icon_size - 4;
354 w = h*icon->width/icon->height;
356 tmp = RScaleImage(icon, w, h);
357 RDestroyImage(icon);
358 icon = tmp;
361 return icon;
365 Bool
366 wIconChangeImageFile(WIcon *icon, char *file)
368 WScreen *scr = icon->core->screen_ptr;
369 RImage *image;
370 char *path;
371 int error = 0;
373 if (!file) {
374 wIconChangeImage(icon, NULL);
375 return True;
378 path = FindImage(wPreferences.icon_path, file);
380 if (path && (image = RLoadImage(scr->rcontext, path, 0))) {
381 wIconChangeImage(icon, image);
382 } else {
383 error = 1;
386 if (path)
387 free(path);
389 return !error;
393 void
394 wIconChangeIconWindow(WIcon *icon, Window new_window);
397 static void
398 cycleColor(void *data)
400 WIcon *icon = (WIcon*)data;
401 WScreen *scr = icon->core->screen_ptr;
403 icon->step = !icon->step;
404 if (icon->step) {
405 XSetForeground(dpy, scr->icon_select_gc, scr->white_pixel);
406 XSetBackground(dpy, scr->icon_select_gc, scr->black_pixel);
407 } else {
408 XSetForeground(dpy, scr->icon_select_gc, scr->black_pixel);
409 XSetBackground(dpy, scr->icon_select_gc, scr->white_pixel);
411 XDrawRectangle(dpy, icon->core->window, scr->icon_select_gc, 0, 0,
412 icon->core->width-1, icon->core->height-1);
413 icon->handlerID = WMAddTimerHandler(COLOR_CYCLE_DELAY, cycleColor, icon);
417 void
418 wIconSetHighlited(WIcon *icon, Bool flag)
420 if (icon->highlighted == flag) {
421 return;
424 icon->highlighted = flag;
425 wIconPaint(icon);
430 void
431 wIconSelect(WIcon *icon)
433 WScreen *scr = icon->core->screen_ptr;
434 icon->selected = !icon->selected;
436 if (icon->selected) {
437 icon->step = 0;
438 if (!wPreferences.dont_blink)
439 icon->handlerID = WMAddTimerHandler(10, cycleColor, icon);
440 else
441 XDrawRectangle(dpy, icon->core->window, scr->icon_select_gc, 0, 0,
442 icon->core->width-1, icon->core->height-1);
443 } else {
444 if (icon->handlerID) {
445 WMDeleteTimerHandler(icon->handlerID);
446 icon->handlerID = NULL;
448 XClearArea(dpy, icon->core->window, 0, 0, icon->core->width,
449 icon->core->height, True);
454 void
455 wIconUpdate(WIcon *icon)
457 WScreen *scr = icon->core->screen_ptr;
458 int title_height = scr->icon_title_font->height;
459 WWindow *wwin = icon->owner;
461 assert(scr->icon_tile!=NULL);
463 if (icon->pixmap!=None)
464 XFreePixmap(dpy, icon->pixmap);
465 icon->pixmap = None;
468 if (wwin && wwin->window_flags.always_user_icon)
469 goto user_icon;
471 /* use client specified icon window */
472 if (icon->icon_win!=None) {
473 XWindowAttributes attr;
474 int resize=0;
475 int width, height, depth;
476 int theight;
477 Pixmap pixmap;
479 getSize(icon->icon_win, &width, &height, &depth);
481 if (width > wPreferences.icon_size) {
482 resize = 1;
483 width = wPreferences.icon_size;
485 if (height > wPreferences.icon_size) {
486 resize = 1;
487 height = wPreferences.icon_size;
489 if (icon->show_title
490 && (height+title_height < wPreferences.icon_size)) {
491 pixmap = XCreatePixmap(dpy, scr->w_win, wPreferences.icon_size,
492 wPreferences.icon_size, scr->w_depth);
493 XSetClipMask(dpy, scr->copy_gc, None);
494 XCopyArea(dpy, scr->icon_tile_pixmap, pixmap, scr->copy_gc, 0, 0,
495 wPreferences.icon_size, wPreferences.icon_size, 0, 0);
496 drawIconTitle(scr, pixmap, title_height);
497 theight = title_height;
498 } else {
499 pixmap = None;
500 theight = 0;
501 XSetWindowBackgroundPixmap(dpy, icon->core->window,
502 scr->icon_tile_pixmap);
505 XSetWindowBorderWidth(dpy, icon->icon_win, 0);
506 XReparentWindow(dpy, icon->icon_win, icon->core->window,
507 (wPreferences.icon_size-width)/2,
508 theight+(wPreferences.icon_size-height-theight)/2);
509 if (resize)
510 XResizeWindow(dpy, icon->icon_win, width, height);
512 XMapWindow(dpy, icon->icon_win);
514 XAddToSaveSet(dpy, icon->icon_win);
516 icon->pixmap = pixmap;
518 if (XGetWindowAttributes(dpy, icon->icon_win, &attr)) {
519 if (attr.all_event_masks & ButtonPressMask) {
520 XGrabButton(dpy, Button1, MOD_MASK, icon->core->window, True,
521 ButtonPressMask, GrabModeSync, GrabModeAsync, None,
522 wCursor[WCUR_ARROW]);
523 XGrabButton(dpy, Button1, MOD_MASK|LockMask, icon->core->window,
524 True, ButtonPressMask, GrabModeSync, GrabModeAsync,
525 None, wCursor[WCUR_ARROW]);
526 #ifdef NUMLOCK_HACK
527 wHackedGrabButton(Button1, MOD_MASK, icon->core->window, True,
528 ButtonPressMask, GrabModeSync, GrabModeAsync,
529 None, wCursor[WCUR_ARROW]);
530 #endif
533 } else if (wwin && wwin->wm_hints
534 && (wwin->wm_hints->flags & IconPixmapHint)) {
535 int x, y;
536 unsigned int w, h;
537 Window jw;
538 int ji, dotitle;
539 unsigned int ju, d;
540 Pixmap pixmap;
542 if (!XGetGeometry(dpy, wwin->wm_hints->icon_pixmap, &jw,
543 &ji, &ji, &w, &h, &ju, &d)) {
544 icon->owner->wm_hints->flags &= ~IconPixmapHint;
545 goto user_icon;
548 pixmap = XCreatePixmap(dpy, icon->core->window, wPreferences.icon_size,
549 wPreferences.icon_size, scr->w_depth);
550 XSetClipMask(dpy, scr->copy_gc, None);
551 XCopyArea(dpy, scr->icon_tile_pixmap, pixmap, scr->copy_gc, 0, 0,
552 wPreferences.icon_size, wPreferences.icon_size, 0, 0);
554 if (w > wPreferences.icon_size)
555 w = wPreferences.icon_size;
556 x = (wPreferences.icon_size-w)/2;
558 if (icon->show_title && (title_height < wPreferences.icon_size)) {
559 drawIconTitle(scr, pixmap, title_height);
560 dotitle = 1;
562 if (h > wPreferences.icon_size - title_height - 2) {
563 h = wPreferences.icon_size - title_height - 2;
564 y = title_height + 1;
565 } else {
566 y = (wPreferences.icon_size-h-title_height)/2+title_height + 1;
568 } else {
569 dotitle = 0;
570 if (w > wPreferences.icon_size)
571 w = wPreferences.icon_size;
572 y = (wPreferences.icon_size-h)/2;
575 if (wwin->wm_hints->flags & IconMaskHint)
576 XSetClipMask(dpy, scr->copy_gc, wwin->wm_hints->icon_mask);
578 XSetClipOrigin(dpy, scr->copy_gc, x, y);
580 if (d != scr->w_depth) {
581 XSetForeground(dpy, scr->copy_gc, scr->black_pixel);
582 XSetBackground(dpy, scr->copy_gc, scr->white_pixel);
583 XCopyPlane(dpy, wwin->wm_hints->icon_pixmap, pixmap, scr->copy_gc,
584 0, 0, w, h, x, y, 1);
585 } else {
586 XCopyArea(dpy, wwin->wm_hints->icon_pixmap, pixmap, scr->copy_gc,
587 0, 0, w, h, x, y);
590 XSetClipOrigin(dpy, scr->copy_gc, 0, 0);
592 icon->pixmap = pixmap;
593 } else {
594 user_icon:
596 if (icon->image) {
597 icon->pixmap = makeIcon(scr, icon->image, icon->show_title,
598 icon->shadowed, icon->tile_type);
599 } else {
600 /* make default icons */
602 if (!scr->def_icon_pixmap) {
603 RImage *image = NULL;
604 char *path;
605 char *file;
607 file = wDefaultGetIconFile(scr, NULL, NULL, False);
608 if (file) {
609 path = FindImage(wPreferences.icon_path, file);
610 if (!path) {
611 wwarning(_("could not find default icon \"%s\""),file);
612 goto make_icons;
615 image = RLoadImage(scr->rcontext, path, 0);
616 if (!image) {
617 wwarning(_("could not load default icon \"%s\":%s"),
618 file, RErrorString);
620 free(path);
622 make_icons:
624 image = wIconValidateIconSize(scr, image);
625 scr->def_icon_pixmap = makeIcon(scr, image, False, False,
626 icon->tile_type);
627 scr->def_ticon_pixmap = makeIcon(scr, image, True, False,
628 icon->tile_type);
629 if (image)
630 RDestroyImage(image);
633 if (icon->show_title) {
634 XSetWindowBackgroundPixmap(dpy, icon->core->window,
635 scr->def_ticon_pixmap);
636 } else {
637 XSetWindowBackgroundPixmap(dpy, icon->core->window,
638 scr->def_icon_pixmap);
640 icon->pixmap = None;
643 if (icon->pixmap != None) {
644 XSetWindowBackgroundPixmap(dpy, icon->core->window, icon->pixmap);
646 XClearWindow(dpy, icon->core->window);
648 wIconPaint(icon);
653 void
654 wIconPaint(WIcon *icon)
656 WScreen *scr=icon->core->screen_ptr;
657 GC gc = scr->icon_title_gc;
658 int x;
659 char *tmp;
661 if (icon->force_paint) {
662 icon->force_paint = 0;
663 wIconUpdate(icon);
664 return;
667 XClearWindow(dpy, icon->core->window);
669 /* draw the icon title */
670 if (icon->show_title && icon->icon_name!=NULL) {
671 int l;
672 int w;
674 tmp = ShrinkString(scr->icon_title_font, icon->icon_name,
675 wPreferences.icon_size-4);
676 w = wTextWidth(scr->icon_title_font->font, tmp, l=strlen(tmp));
678 if (w > icon->core->width - 4)
679 x = (icon->core->width - 4) - w;
680 else
681 x = (icon->core->width - w)/2;
683 wDrawString(icon->core->window, scr->icon_title_font, gc,
684 x, 1 + scr->icon_title_font->y, tmp, l);
685 free(tmp);
688 if (icon->selected)
689 XDrawRectangle(dpy, icon->core->window, scr->icon_select_gc, 0, 0,
690 icon->core->width-1, icon->core->height-1);
694 /******************************************************************/
696 static void
697 miniwindowExpose(WObjDescriptor *desc, XEvent *event)
699 wIconPaint(desc->parent);
703 static void
704 miniwindowDblClick(WObjDescriptor *desc, XEvent *event)
706 WIcon *icon = desc->parent;
708 assert(icon->owner!=NULL);
710 wDeiconifyWindow(icon->owner);
714 static void
715 miniwindowMouseDown(WObjDescriptor *desc, XEvent *event)
717 WIcon *icon = desc->parent;
718 WWindow *wwin = icon->owner;
719 XEvent ev;
720 int x=wwin->icon_x, y=wwin->icon_y;
721 int dx=event->xbutton.x, dy=event->xbutton.y;
722 int grabbed=0;
723 int clickButton=event->xbutton.button;
726 if (IsDoubleClick(icon->core->screen_ptr, event)) {
727 miniwindowDblClick(desc, event);
728 return;
731 #ifdef DEBUG
732 puts("Moving miniwindow");
733 #endif
734 if (event->xbutton.button==Button1) {
735 if (event->xbutton.state & MOD_MASK)
736 wLowerFrame(icon->core);
737 else
738 wRaiseFrame(icon->core);
739 if (event->xbutton.state & ShiftMask) {
740 wIconSelect(icon);
741 wSelectWindow(icon->owner);
745 if (XGrabPointer(dpy, icon->core->window, False, ButtonMotionMask
746 |ButtonReleaseMask|ButtonPressMask, GrabModeAsync,
747 GrabModeAsync, None, None, CurrentTime) !=GrabSuccess) {
748 #ifdef DEBUG0
749 wwarning("pointer grab failed for icon move");
750 #endif
752 while(1) {
753 WMMaskEvent(dpy, PointerMotionMask|ButtonReleaseMask|ButtonPressMask
754 |ButtonMotionMask|ExposureMask, &ev);
755 switch (ev.type) {
756 case Expose:
757 WMHandleEvent(&ev);
758 break;
760 case MotionNotify:
761 if (!grabbed) {
762 if (abs(dx-ev.xmotion.x)>=MOVE_THRESHOLD
763 || abs(dy-ev.xmotion.y)>=MOVE_THRESHOLD) {
764 XChangeActivePointerGrab(dpy, ButtonMotionMask
765 |ButtonReleaseMask|ButtonPressMask,
766 wCursor[WCUR_MOVE], CurrentTime);
767 grabbed=1;
768 } else {
769 break;
772 x = ev.xmotion.x_root - dx;
773 y = ev.xmotion.y_root - dy;
774 XMoveWindow(dpy, icon->core->window, x, y);
775 break;
777 case ButtonPress:
778 break;
780 case ButtonRelease:
781 if (ev.xbutton.button != clickButton)
782 break;
784 if (wwin->icon_x!=x || wwin->icon_y!=y)
785 wwin->flags.icon_moved = 1;
787 XMoveWindow(dpy, icon->core->window, x, y);
789 wwin->icon_x = x;
790 wwin->icon_y = y;
791 #ifdef DEBUG
792 puts("End miniwindow move");
793 #endif
794 XUngrabPointer(dpy, CurrentTime);
795 return;