1 /* icon.c - window icon and dock and appicon parent
3 * Window Maker window manager
5 * Copyright (c) 1997, 1998 Alfredo K. Kojima
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,
26 #include <X11/Xutil.h>
35 #include "WindowMaker.h"
43 #include "application.h"
47 /**** Global variables ****/
48 extern WPreferences wPreferences
;
50 #define MOD_MASK wPreferences.modifier_mask
52 extern Cursor wCursor
[WCUR_LAST
];
55 static void miniwindowExpose(WObjDescriptor
*desc
, XEvent
*event
);
56 static void miniwindowMouseDown(WObjDescriptor
*desc
, XEvent
*event
);
57 static void miniwindowDblClick(WObjDescriptor
*desc
, XEvent
*event
);
61 getSize(Drawable d
, unsigned int *w
, unsigned int *h
, unsigned int *dep
)
67 XGetGeometry(dpy
, d
, &rjunk
, &xjunk
, &yjunk
, w
, h
, &bjunk
, dep
);
72 wIconCreate(WWindow
*wwin
)
74 WScreen
*scr
=wwin
->screen_ptr
;
77 unsigned long vmask
= 0;
78 XSetWindowAttributes attribs
;
80 icon
= wmalloc(sizeof(WIcon
));
81 memset(icon
, 0, sizeof(WIcon
));
82 icon
->core
= wCoreCreateTopLevel(scr
, wwin
->icon_x
, wwin
->icon_y
,
83 wPreferences
.icon_size
,
84 wPreferences
.icon_size
, 0);
86 if (wPreferences
.use_saveunders
) {
88 attribs
.save_under
= True
;
90 /* a white border for selecting it */
91 vmask
|= CWBorderPixel
;
92 attribs
.border_pixel
= scr
->white_pixel
;
94 XChangeWindowAttributes(dpy
, icon
->core
->window
, vmask
, &attribs
);
97 /* will be overriden if this is an application icon */
98 icon
->core
->descriptor
.handle_mousedown
= miniwindowMouseDown
;
99 icon
->core
->descriptor
.handle_expose
= miniwindowExpose
;
100 icon
->core
->descriptor
.parent_type
= WCLASS_MINIWINDOW
;
101 icon
->core
->descriptor
.parent
= icon
;
103 icon
->core
->stacking
= wmalloc(sizeof(WStacking
));
104 icon
->core
->stacking
->above
= NULL
;
105 icon
->core
->stacking
->under
= NULL
;
106 icon
->core
->stacking
->window_level
= WMNormalWindowLevel
;
107 icon
->core
->stacking
->child_of
= NULL
;
110 if (wwin
->wm_hints
&& (wwin
->wm_hints
->flags
& IconWindowHint
)) {
111 if (wwin
->client_win
== wwin
->main_window
) {
113 /* do not let miniwindow steal app-icon's icon window */
114 wapp
= wApplicationOf(wwin
->client_win
);
115 if (!wapp
|| wapp
->app_icon
==NULL
)
116 icon
->icon_win
= wwin
->wm_hints
->icon_window
;
118 icon
->icon_win
= wwin
->wm_hints
->icon_window
;
121 #ifdef NO_MINIWINDOW_TITLES
122 icon
->show_title
= 0;
124 icon
->show_title
= 1;
126 icon
->image
= wDefaultGetImage(scr
, wwin
->wm_instance
, wwin
->wm_class
);
128 file
= wDefaultGetIconFile(scr
, wwin
->wm_instance
, wwin
->wm_class
,
131 icon
->file
= wstrdup(file
);
134 wGetIconName(dpy
, wwin
->client_win
, &icon
->icon_name
);
136 icon
->tile_type
= TILE_NORMAL
;
147 wIconCreateWithIconFile(WScreen
*scr
, char *iconfile
, int tile
)
150 unsigned long vmask
= 0;
151 XSetWindowAttributes attribs
;
153 icon
= wmalloc(sizeof(WIcon
));
154 memset(icon
, 0, sizeof(WIcon
));
155 icon
->core
= wCoreCreateTopLevel(scr
, 0, 0, wPreferences
.icon_size
,
156 wPreferences
.icon_size
, 0);
157 if (wPreferences
.use_saveunders
) {
159 attribs
.save_under
= True
;
161 /* a white border for selecting it */
162 vmask
|= CWBorderPixel
;
163 attribs
.border_pixel
= scr
->white_pixel
;
165 XChangeWindowAttributes(dpy
, icon
->core
->window
, vmask
, &attribs
);
167 /* will be overriden if this is a application icon */
168 icon
->core
->descriptor
.handle_mousedown
= miniwindowMouseDown
;
169 icon
->core
->descriptor
.handle_expose
= miniwindowExpose
;
170 icon
->core
->descriptor
.parent_type
= WCLASS_MINIWINDOW
;
171 icon
->core
->descriptor
.parent
= icon
;
173 icon
->core
->stacking
= wmalloc(sizeof(WStacking
));
174 icon
->core
->stacking
->above
= NULL
;
175 icon
->core
->stacking
->under
= NULL
;
176 icon
->core
->stacking
->window_level
= WMNormalWindowLevel
;
177 icon
->core
->stacking
->child_of
= NULL
;
180 icon
->image
= RLoadImage(scr
->rcontext
, iconfile
, 0);
182 wwarning(_("error loading image file \"%s\""), iconfile
, RMessageForError(RErrorCode
));
185 icon
->image
= wIconValidateIconSize(scr
, icon
->image
);
187 icon
->file
= wstrdup(iconfile
);
190 icon
->tile_type
= tile
;
200 wIconDestroy(WIcon
*icon
)
202 WCoreWindow
*core
= icon
->core
;
203 WScreen
*scr
= core
->screen_ptr
;
206 WMDeleteTimerHandler(icon
->handlerID
);
208 if (icon
->icon_win
) {
212 x
= icon
->owner
->icon_x
;
213 y
= icon
->owner
->icon_y
;
215 XUnmapWindow(dpy
, icon
->icon_win
);
216 XReparentWindow(dpy
, icon
->icon_win
, scr
->root_win
, x
, y
);
219 XFree(icon
->icon_name
);
222 XFreePixmap(dpy
, icon
->pixmap
);
227 if (icon
->image
!=NULL
)
228 RDestroyImage(icon
->image
);
230 wCoreDestroy(icon
->core
);
237 drawIconTitle(WScreen
*scr
, Pixmap pixmap
, int height
)
239 XFillRectangle(dpy
, pixmap
, scr
->icon_title_texture
->normal_gc
,
240 0, 0, wPreferences
.icon_size
, height
+1);
241 XDrawLine(dpy
, pixmap
, scr
->icon_title_texture
->light_gc
, 0, 0,
242 wPreferences
.icon_size
, 0);
243 XDrawLine(dpy
, pixmap
, scr
->icon_title_texture
->light_gc
, 0, 0,
245 XDrawLine(dpy
, pixmap
, scr
->icon_title_texture
->dim_gc
,
246 wPreferences
.icon_size
-1, 0, wPreferences
.icon_size
-1, height
+1);
251 makeIcon(WScreen
*scr
, RImage
*icon
, int titled
, int shadowed
, int tileType
)
257 int theight
= scr
->icon_title_font
->height
;
259 if (tileType
== TILE_NORMAL
)
260 tile
= RCloneImage(scr
->icon_tile
);
262 assert(scr
->clip_tile
);
263 tile
= RCloneImage(scr
->clip_tile
);
266 w
= (icon
->width
> wPreferences
.icon_size
)
267 ? wPreferences
.icon_size
: icon
->width
;
268 x
= (wPreferences
.icon_size
- w
) / 2;
269 sx
= (icon
->width
- w
)/2;
272 h
= (icon
->height
> wPreferences
.icon_size
)
273 ? wPreferences
.icon_size
: icon
->height
;
274 y
= (wPreferences
.icon_size
- h
) / 2;
275 sy
= (icon
->height
- h
)/2;
277 h
= (icon
->height
+theight
> wPreferences
.icon_size
278 ? wPreferences
.icon_size
-theight
: icon
->height
);
279 y
= theight
+((int)wPreferences
.icon_size
-theight
-h
)/2;
280 sy
= (icon
->height
- h
)/2;
282 RCombineArea(tile
, icon
, sx
, sy
, w
, h
, x
, y
);
288 color
.red
= scr
->icon_back_texture
->light
.red
>> 8;
289 color
.green
= scr
->icon_back_texture
->light
.green
>> 8;
290 color
.blue
= scr
->icon_back_texture
->light
.blue
>> 8;
291 color
.alpha
= 150; /* about 60% */
292 RClearImage(tile
, &color
);
295 if (!RConvertImage(scr
->rcontext
, tile
, &pixmap
)) {
296 wwarning(_("error rendering image:%s"), RMessageForError(RErrorCode
));
301 drawIconTitle(scr
, pixmap
, theight
);
308 wIconChangeTitle(WIcon
*icon
, char *new_title
)
312 changed
= (new_title
==NULL
&& icon
->icon_name
!=NULL
)
313 || (new_title
!=NULL
&& icon
->icon_name
==NULL
);
315 if (icon
->icon_name
!=NULL
)
316 XFree(icon
->icon_name
);
318 icon
->icon_name
= new_title
;
321 icon
->force_paint
= 1;
327 wIconChangeImage(WIcon
*icon
, RImage
*new_image
)
329 assert(icon
!= NULL
);
332 RDestroyImage(icon
->image
);
334 icon
->image
= wIconValidateIconSize(icon
->core
->screen_ptr
, new_image
);
341 wIconValidateIconSize(WScreen
*scr
, RImage
*icon
)
349 if (icon
->width
> wPreferences
.icon_size
350 || icon
->height
> wPreferences
.icon_size
) {
351 if (icon
->width
> icon
->height
) {
352 w
= wPreferences
.icon_size
- 4;
353 h
= w
*icon
->height
/icon
->width
;
355 h
= wPreferences
.icon_size
- 4;
356 w
= h
*icon
->width
/icon
->height
;
358 tmp
= RScaleImage(icon
, w
, h
);
368 wIconChangeImageFile(WIcon
*icon
, char *file
)
370 WScreen
*scr
= icon
->core
->screen_ptr
;
376 wIconChangeImage(icon
, NULL
);
380 path
= FindImage(wPreferences
.icon_path
, file
);
382 if (path
&& (image
= RLoadImage(scr
->rcontext
, path
, 0))) {
383 wIconChangeImage(icon
, image
);
397 getnameforicon(WWindow
*wwin
)
399 char *prefix
, *suffix
;
403 if (wwin
->wm_class
&& wwin
->wm_instance
) {
404 suffix
= wmalloc(strlen(wwin
->wm_class
)+strlen(wwin
->wm_instance
)+2);
405 sprintf(suffix
, "%s.%s", wwin
->wm_instance
, wwin
->wm_class
);
406 } else if (wwin
->wm_class
) {
407 suffix
= wmalloc(strlen(wwin
->wm_class
)+1);
408 strcpy(suffix
, wwin
->wm_class
);
410 suffix
= wmalloc(strlen(wwin
->wm_instance
)+1);
411 strcpy(suffix
, wwin
->wm_instance
);
414 prefix
= getenv("GNUSTEP_USER_PATH");
416 len
= strlen(wgethomedir())+64+strlen(suffix
);
417 path
= wmalloc(len
+1);
418 sprintf(path
, "%s/GNUstep/.AppInfo", wgethomedir());
420 prefix
= wexpandpath(prefix
);
421 len
= strlen(prefix
)+64+strlen(suffix
);
422 path
= wmalloc(len
+1);
423 sprintf(path
, "%s/.AppInfo", prefix
);
426 if (access(path
, F_OK
)!=0) {
427 if (mkdir(path
, S_IRUSR
|S_IWUSR
|S_IXUSR
)) {
428 wsyserror(_("could not create directory %s"), path
);
434 strcat(path
, "/WindowMaker");
435 if (access(path
, F_OK
)!=0) {
436 if (mkdir(path
, S_IRUSR
|S_IWUSR
|S_IXUSR
)!=0) {
437 wsyserror(_("could not create directory %s"), path
);
445 strcat(path
, suffix
);
446 strcat(path
, ".xpm");
455 * Stores the client supplied icon at ~/GNUstep/.AppInfo/WindowMaker
456 * and returns the path for that icon. Returns NULL if there is no
457 * client supplied icon or on failure.
460 * New directories might be created.
463 wIconStore(WIcon
*icon
)
467 WWindow
*wwin
= icon
->owner
;
469 if (!wwin
|| !wwin
->wm_hints
|| !(wwin
->wm_hints
->flags
& IconPixmapHint
)
470 || wwin
->wm_hints
->icon_pixmap
== None
)
473 path
= getnameforicon(wwin
);
475 image
= RCreateImageFromDrawable(icon
->core
->screen_ptr
->rcontext
,
476 wwin
->wm_hints
->icon_pixmap
,
477 (wwin
->wm_hints
->flags
& IconMaskHint
)
478 ? wwin
->wm_hints
->icon_mask
: None
);
484 if (!RSaveImage(image
, path
, "XPM")) {
488 RDestroyImage(image
);
496 wIconChangeIconWindow(WIcon *icon, Window new_window);
500 cycleColor(void *data
)
502 WIcon
*icon
= (WIcon
*)data
;
503 WScreen
*scr
= icon
->core
->screen_ptr
;
507 gcv
.dash_offset
= icon
->step
;
508 XChangeGC(dpy
, scr
->icon_select_gc
, GCDashOffset
, &gcv
);
510 XDrawRectangle(dpy
, icon
->core
->window
, scr
->icon_select_gc
, 0, 0,
511 icon
->core
->width
-1, icon
->core
->height
-1);
512 icon
->handlerID
= WMAddTimerHandler(COLOR_CYCLE_DELAY
, cycleColor
, icon
);
517 wIconSetHighlited(WIcon
*icon
, Bool flag
)
519 if (icon
->highlighted
== flag
) {
523 icon
->highlighted
= flag
;
530 wIconSelect(WIcon
*icon
)
532 WScreen
*scr
= icon
->core
->screen_ptr
;
533 icon
->selected
= !icon
->selected
;
535 if (icon
->selected
) {
537 if (!wPreferences
.dont_blink
)
538 icon
->handlerID
= WMAddTimerHandler(10, cycleColor
, icon
);
540 XDrawRectangle(dpy
, icon
->core
->window
, scr
->icon_select_gc
, 0, 0,
541 icon
->core
->width
-1, icon
->core
->height
-1);
543 if (icon
->handlerID
) {
544 WMDeleteTimerHandler(icon
->handlerID
);
545 icon
->handlerID
= NULL
;
547 XClearArea(dpy
, icon
->core
->window
, 0, 0, icon
->core
->width
,
548 icon
->core
->height
, True
);
554 wIconUpdate(WIcon
*icon
)
556 WScreen
*scr
= icon
->core
->screen_ptr
;
557 int title_height
= scr
->icon_title_font
->height
;
558 WWindow
*wwin
= icon
->owner
;
560 assert(scr
->icon_tile
!=NULL
);
562 if (icon
->pixmap
!=None
)
563 XFreePixmap(dpy
, icon
->pixmap
);
567 if (wwin
&& wwin
->window_flags
.always_user_icon
)
570 /* use client specified icon window */
571 if (icon
->icon_win
!=None
) {
572 XWindowAttributes attr
;
574 int width
, height
, depth
;
578 getSize(icon
->icon_win
, &width
, &height
, &depth
);
580 if (width
> wPreferences
.icon_size
) {
582 width
= wPreferences
.icon_size
;
584 if (height
> wPreferences
.icon_size
) {
586 height
= wPreferences
.icon_size
;
589 && (height
+title_height
< wPreferences
.icon_size
)) {
590 pixmap
= XCreatePixmap(dpy
, scr
->w_win
, wPreferences
.icon_size
,
591 wPreferences
.icon_size
, scr
->w_depth
);
592 XSetClipMask(dpy
, scr
->copy_gc
, None
);
593 XCopyArea(dpy
, scr
->icon_tile_pixmap
, pixmap
, scr
->copy_gc
, 0, 0,
594 wPreferences
.icon_size
, wPreferences
.icon_size
, 0, 0);
595 drawIconTitle(scr
, pixmap
, title_height
);
596 theight
= title_height
;
600 XSetWindowBackgroundPixmap(dpy
, icon
->core
->window
,
601 scr
->icon_tile_pixmap
);
604 XSetWindowBorderWidth(dpy
, icon
->icon_win
, 0);
605 XReparentWindow(dpy
, icon
->icon_win
, icon
->core
->window
,
606 (wPreferences
.icon_size
-width
)/2,
607 theight
+(wPreferences
.icon_size
-height
-theight
)/2);
609 XResizeWindow(dpy
, icon
->icon_win
, width
, height
);
611 XMapWindow(dpy
, icon
->icon_win
);
613 XAddToSaveSet(dpy
, icon
->icon_win
);
615 icon
->pixmap
= pixmap
;
617 if (XGetWindowAttributes(dpy
, icon
->icon_win
, &attr
)) {
618 if (attr
.all_event_masks
& ButtonPressMask
) {
619 wHackedGrabButton(Button1
, MOD_MASK
, icon
->core
->window
, True
,
620 ButtonPressMask
, GrabModeSync
, GrabModeAsync
,
621 None
, wCursor
[WCUR_ARROW
]);
624 } else if (wwin
&& wwin
->wm_hints
625 && (wwin
->wm_hints
->flags
& IconPixmapHint
)) {
633 if (!XGetGeometry(dpy
, wwin
->wm_hints
->icon_pixmap
, &jw
,
634 &ji
, &ji
, &w
, &h
, &ju
, &d
)) {
635 icon
->owner
->wm_hints
->flags
&= ~IconPixmapHint
;
639 pixmap
= XCreatePixmap(dpy
, icon
->core
->window
, wPreferences
.icon_size
,
640 wPreferences
.icon_size
, scr
->w_depth
);
641 XSetClipMask(dpy
, scr
->copy_gc
, None
);
642 XCopyArea(dpy
, scr
->icon_tile_pixmap
, pixmap
, scr
->copy_gc
, 0, 0,
643 wPreferences
.icon_size
, wPreferences
.icon_size
, 0, 0);
645 if (w
> wPreferences
.icon_size
)
646 w
= wPreferences
.icon_size
;
647 x
= (wPreferences
.icon_size
-w
)/2;
649 if (icon
->show_title
&& (title_height
< wPreferences
.icon_size
)) {
650 drawIconTitle(scr
, pixmap
, title_height
);
653 if (h
> wPreferences
.icon_size
- title_height
- 2) {
654 h
= wPreferences
.icon_size
- title_height
- 2;
655 y
= title_height
+ 1;
657 y
= (wPreferences
.icon_size
-h
-title_height
)/2+title_height
+ 1;
661 if (w
> wPreferences
.icon_size
)
662 w
= wPreferences
.icon_size
;
663 y
= (wPreferences
.icon_size
-h
)/2;
666 if (wwin
->wm_hints
->flags
& IconMaskHint
)
667 XSetClipMask(dpy
, scr
->copy_gc
, wwin
->wm_hints
->icon_mask
);
669 XSetClipOrigin(dpy
, scr
->copy_gc
, x
, y
);
671 if (d
!= scr
->w_depth
) {
672 XSetForeground(dpy
, scr
->copy_gc
, scr
->black_pixel
);
673 XSetBackground(dpy
, scr
->copy_gc
, scr
->white_pixel
);
674 XCopyPlane(dpy
, wwin
->wm_hints
->icon_pixmap
, pixmap
, scr
->copy_gc
,
675 0, 0, w
, h
, x
, y
, 1);
677 XCopyArea(dpy
, wwin
->wm_hints
->icon_pixmap
, pixmap
, scr
->copy_gc
,
681 XSetClipOrigin(dpy
, scr
->copy_gc
, 0, 0);
683 icon
->pixmap
= pixmap
;
688 icon
->pixmap
= makeIcon(scr
, icon
->image
, icon
->show_title
,
689 icon
->shadowed
, icon
->tile_type
);
691 /* make default icons */
693 if (!scr
->def_icon_pixmap
) {
694 RImage
*image
= NULL
;
698 file
= wDefaultGetIconFile(scr
, NULL
, NULL
, False
);
700 path
= FindImage(wPreferences
.icon_path
, file
);
702 wwarning(_("could not find default icon \"%s\""),file
);
706 image
= RLoadImage(scr
->rcontext
, path
, 0);
708 wwarning(_("could not load default icon \"%s\":%s"),
709 file
, RMessageForError(RErrorCode
));
715 image
= wIconValidateIconSize(scr
, image
);
716 scr
->def_icon_pixmap
= makeIcon(scr
, image
, False
, False
,
718 scr
->def_ticon_pixmap
= makeIcon(scr
, image
, True
, False
,
721 RDestroyImage(image
);
724 if (icon
->show_title
) {
725 XSetWindowBackgroundPixmap(dpy
, icon
->core
->window
,
726 scr
->def_ticon_pixmap
);
728 XSetWindowBackgroundPixmap(dpy
, icon
->core
->window
,
729 scr
->def_icon_pixmap
);
734 if (icon
->pixmap
!= None
) {
735 XSetWindowBackgroundPixmap(dpy
, icon
->core
->window
, icon
->pixmap
);
737 XClearWindow(dpy
, icon
->core
->window
);
745 wIconPaint(WIcon
*icon
)
747 WScreen
*scr
=icon
->core
->screen_ptr
;
748 GC gc
= scr
->icon_title_gc
;
752 if (icon
->force_paint
) {
753 icon
->force_paint
= 0;
758 XClearWindow(dpy
, icon
->core
->window
);
760 /* draw the icon title */
761 if (icon
->show_title
&& icon
->icon_name
!=NULL
) {
765 tmp
= ShrinkString(scr
->icon_title_font
, icon
->icon_name
,
766 wPreferences
.icon_size
-4);
767 w
= wTextWidth(scr
->icon_title_font
->font
, tmp
, l
=strlen(tmp
));
769 if (w
> icon
->core
->width
- 4)
770 x
= (icon
->core
->width
- 4) - w
;
772 x
= (icon
->core
->width
- w
)/2;
774 wDrawString(icon
->core
->window
, scr
->icon_title_font
, gc
,
775 x
, 1 + scr
->icon_title_font
->y
, tmp
, l
);
780 XDrawRectangle(dpy
, icon
->core
->window
, scr
->icon_select_gc
, 0, 0,
781 icon
->core
->width
-1, icon
->core
->height
-1);
785 /******************************************************************/
788 miniwindowExpose(WObjDescriptor
*desc
, XEvent
*event
)
790 wIconPaint(desc
->parent
);
795 miniwindowDblClick(WObjDescriptor
*desc
, XEvent
*event
)
797 WIcon
*icon
= desc
->parent
;
799 assert(icon
->owner
!=NULL
);
801 wDeiconifyWindow(icon
->owner
);
806 miniwindowMouseDown(WObjDescriptor
*desc
, XEvent
*event
)
808 WIcon
*icon
= desc
->parent
;
809 WWindow
*wwin
= icon
->owner
;
811 int x
=wwin
->icon_x
, y
=wwin
->icon_y
;
812 int dx
=event
->xbutton
.x
, dy
=event
->xbutton
.y
;
814 int clickButton
=event
->xbutton
.button
;
817 if (IsDoubleClick(icon
->core
->screen_ptr
, event
)) {
818 miniwindowDblClick(desc
, event
);
823 puts("Moving miniwindow");
825 if (event
->xbutton
.button
==Button1
) {
826 if (event
->xbutton
.state
& MOD_MASK
)
827 wLowerFrame(icon
->core
);
829 wRaiseFrame(icon
->core
);
830 if (event
->xbutton
.state
& ShiftMask
) {
832 wSelectWindow(icon
->owner
);
836 if (XGrabPointer(dpy
, icon
->core
->window
, False
, ButtonMotionMask
837 |ButtonReleaseMask
|ButtonPressMask
, GrabModeAsync
,
838 GrabModeAsync
, None
, None
, CurrentTime
) !=GrabSuccess
) {
840 wwarning("pointer grab failed for icon move");
844 WMMaskEvent(dpy
, PointerMotionMask
|ButtonReleaseMask
|ButtonPressMask
845 |ButtonMotionMask
|ExposureMask
, &ev
);
853 if (abs(dx
-ev
.xmotion
.x
)>=MOVE_THRESHOLD
854 || abs(dy
-ev
.xmotion
.y
)>=MOVE_THRESHOLD
) {
855 XChangeActivePointerGrab(dpy
, ButtonMotionMask
856 |ButtonReleaseMask
|ButtonPressMask
,
857 wCursor
[WCUR_MOVE
], CurrentTime
);
863 x
= ev
.xmotion
.x_root
- dx
;
864 y
= ev
.xmotion
.y_root
- dy
;
865 XMoveWindow(dpy
, icon
->core
->window
, x
, y
);
872 if (ev
.xbutton
.button
!= clickButton
)
875 if (wwin
->icon_x
!=x
|| wwin
->icon_y
!=y
)
876 wwin
->flags
.icon_moved
= 1;
878 XMoveWindow(dpy
, icon
->core
->window
, x
, y
);
883 puts("End miniwindow move");
885 XUngrabPointer(dpy
, CurrentTime
);