1 /* action.c- misc. window commands (miniaturize, hide etc.)
3 * Window Maker window manager
5 * Copyright (c) 1997, 1998, 1999 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,
28 #include <X11/Xutil.h>
35 #include "WindowMaker.h"
42 #include "application.h"
48 #include "winspector.h"
50 #include "workspace.h"
64 /****** Global Variables ******/
65 extern Time LastTimestamp
;
66 extern Time LastFocusChange
;
68 extern Cursor wCursor
[WCUR_LAST
];
70 extern WPreferences wPreferences
;
72 extern Atom _XA_WM_TAKE_FOCUS
;
75 /******* Local Variables *******/
80 {SHADE_STEPS_UF
, SHADE_DELAY_UF
},
81 {SHADE_STEPS_F
, SHADE_DELAY_F
},
82 {SHADE_STEPS_M
, SHADE_DELAY_M
},
83 {SHADE_STEPS_S
, SHADE_DELAY_S
},
84 {SHADE_STEPS_U
, SHADE_DELAY_U
}};
86 #define SHADE_STEPS shadePars[(int)wPreferences.shade_speed].steps
87 #define SHADE_DELAY shadePars[(int)wPreferences.shade_speed].delay
90 static int ignoreTimestamp
=0;
95 processEvents(int event_count
)
100 * This is a hack. When animations are enabled, processing of
101 * events ocurred during a animation are delayed until it's end.
102 * Calls that consider the TimeStamp, like XSetInputFocus(), will
103 * fail because the TimeStamp is too old. Then, for example, if
104 * the user changes window focus while a miniaturize animation is
105 * in course, the window will not get focus properly after the end
106 * of the animation. This tries to workaround it by passing CurrentTime
107 * as the TimeStamp for XSetInputFocus() for all events ocurred during
111 while (XPending(dpy
) && event_count
--) {
112 WMNextEvent(dpy
, &event
);
113 WMHandleEvent(&event
);
117 #endif /* ANIMATIONS */
122 *----------------------------------------------------------------------
124 * Changes the window focus to the one passed as argument.
125 * If the window to focus is not already focused, it will be brought
126 * to the head of the list of windows. Previously focused window is
130 * Window list may be reordered and the window focus is changed.
132 *----------------------------------------------------------------------
135 wSetFocusTo(WScreen
*scr
, WWindow
*wwin
)
137 WWindow
*focused
=scr
->focused_window
;
138 int timestamp
=LastTimestamp
;
139 WApplication
*oapp
=NULL
, *napp
=NULL
;
142 LastFocusChange
= timestamp
;
145 * This is a hack, because XSetInputFocus() should have a proper
146 * timestamp instead of CurrentTime but it seems that some times
147 * clients will not receive focus properly that way.
150 timestamp
= CurrentTime
;
153 oapp
= wApplicationOf(focused
->main_window
);
156 XSetInputFocus(dpy
, scr
->no_focus_win
, RevertToParent
, timestamp
);
158 wWindowUnfocus(focused
);
161 wAppMenuUnmap(oapp
->menu
);
163 wApplicationDeactivate(oapp
);
167 wKWMUpdateActiveWindowHint(scr
);
168 wKWMSendEventMessage(NULL
, WKWMFocusWindow
);
172 wasfocused
= wwin
->flags
.focused
;
173 napp
= wApplicationOf(wwin
->main_window
);
175 /* remember last workspace where the app has been */
177 napp
->last_workspace
= wwin
->screen_ptr
->current_workspace
;
179 if (wwin
->flags
.mapped
&& !WFLAGP(wwin
, no_focusable
)) {
180 /* install colormap if colormap mode is lock mode */
181 if (wPreferences
.colormap_mode
==WKF_CLICK
)
182 wColormapInstallForWindow(scr
, wwin
);
184 /* set input focus */
185 switch (wwin
->focus_mode
) {
187 XSetInputFocus(dpy
, scr
->no_focus_win
, RevertToParent
, timestamp
);
191 case WFM_LOCALLY_ACTIVE
:
192 XSetInputFocus(dpy
, wwin
->client_win
, RevertToParent
, timestamp
);
195 case WFM_GLOBALLY_ACTIVE
:
199 if (wwin
->protocols
.TAKE_FOCUS
) {
200 wClientSendProtocol(wwin
, _XA_WM_TAKE_FOCUS
, timestamp
);
204 XSetInputFocus(dpy
, scr
->no_focus_win
, RevertToParent
, timestamp
);
206 if (WFLAGP(wwin
, no_focusable
))
209 /* if this is not the focused window focus it */
211 /* change the focus window list order */
213 wwin
->prev
->next
= wwin
->next
;
216 wwin
->next
->prev
= wwin
->prev
;
218 wwin
->prev
= focused
;
219 focused
->next
= wwin
;
221 scr
->focused_window
= wwin
;
223 if (oapp
&& oapp
!= napp
) {
224 wAppMenuUnmap(oapp
->menu
);
226 wApplicationDeactivate(oapp
);
231 wWindowFocus(wwin
, focused
);
233 if (napp
&& !wasfocused
) {
235 wUserMenuRefreshInstances(napp
->menu
, wwin
);
236 #endif /* USER_MENU */
238 if (wwin
->flags
.mapped
)
239 wAppMenuMap(napp
->menu
, wwin
);
241 wApplicationActivate(napp
);
245 wKWMUpdateActiveWindowHint(scr
);
246 wKWMSendEventMessage(wwin
, WKWMFocusWindow
);
253 wShadeWindow(WWindow
*wwin
)
255 time_t time0
= time(NULL
);
260 if (wwin
->flags
.shaded
)
263 XLowerWindow(dpy
, wwin
->client_win
);
266 wSoundPlay(WMSOUND_SHADE
);
270 if (!wwin
->screen_ptr
->flags
.startup
&& !wwin
->flags
.skip_next_animation
271 && !wPreferences
.no_animations
) {
272 /* do the shading animation */
273 h
= wwin
->frame
->core
->height
;
276 w
= wwin
->frame
->core
->width
;
277 y
= wwin
->frame
->top_width
;
278 while (h
>wwin
->frame
->top_width
+1) {
279 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
280 XResizeWindow(dpy
, wwin
->frame
->core
->window
, w
, h
);
283 if (time(NULL
)-time0
> MAX_ANIMATION_TIME
)
287 wusleep(SHADE_DELAY
*1000L);
291 XMoveWindow(dpy
, wwin
->client_win
, 0, wwin
->frame
->top_width
);
293 #endif /* ANIMATIONS */
295 wwin
->flags
.skip_next_animation
= 0;
296 wwin
->flags
.shaded
= 1;
297 wwin
->flags
.mapped
= 0;
298 /* prevent window withdrawal when getting UnmapNotify */
299 XSelectInput(dpy
, wwin
->client_win
,
300 wwin
->event_mask
& ~StructureNotifyMask
);
301 XUnmapWindow(dpy
, wwin
->client_win
);
302 XSelectInput(dpy
, wwin
->client_win
, wwin
->event_mask
);
304 /* for the client it's just like iconification */
305 wFrameWindowResize(wwin
->frame
, wwin
->frame
->core
->width
,
306 wwin
->frame
->top_width
- 1);
308 wwin
->client
.y
= wwin
->frame_y
- wwin
->client
.height
309 + wwin
->frame
->top_width
;
310 wWindowSynthConfigureNotify(wwin
);
313 wClientSetState(wwin, IconicState, None);
317 wGNOMEUpdateClientStateHint(wwin
, False
);
320 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
321 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
323 /* update window list to reflect shaded state */
324 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
327 if (!wwin
->screen_ptr
->flags
.startup
) {
328 /* Look at processEvents() for reason of this code. */
330 processEvents(XPending(dpy
));
337 wUnshadeWindow(WWindow
*wwin
)
339 time_t time0
= time(NULL
);
342 #endif /* ANIMATIONS */
345 if (!wwin
->flags
.shaded
)
348 wwin
->flags
.shaded
= 0;
349 wwin
->flags
.mapped
= 1;
350 XMapWindow(dpy
, wwin
->client_win
);
353 wSoundPlay(WMSOUND_UNSHADE
);
357 if (!wPreferences
.no_animations
&& !wwin
->flags
.skip_next_animation
) {
358 /* do the shading animation */
359 h
= wwin
->frame
->top_width
+ wwin
->frame
->bottom_width
;
360 y
= wwin
->frame
->top_width
- wwin
->client
.height
;
361 s
= abs(y
)/SHADE_STEPS
;
363 w
= wwin
->frame
->core
->width
;
364 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
366 while (h
< wwin
->client
.height
+ wwin
->frame
->top_width
367 + wwin
->frame
->bottom_width
) {
368 XResizeWindow(dpy
, wwin
->frame
->core
->window
, w
, h
);
369 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
372 wusleep(SHADE_DELAY
*2000L/3);
376 if (time(NULL
)-time0
> MAX_ANIMATION_TIME
)
380 XMoveWindow(dpy
, wwin
->client_win
, 0, wwin
->frame
->top_width
);
382 #endif /* ANIMATIONS */
384 wwin
->flags
.skip_next_animation
= 0;
385 wFrameWindowResize(wwin
->frame
, wwin
->frame
->core
->width
,
386 wwin
->frame
->top_width
+ wwin
->client
.height
387 + wwin
->frame
->bottom_width
);
389 wwin
->client
.y
= wwin
->frame_y
+ wwin
->frame
->top_width
;
390 wWindowSynthConfigureNotify(wwin
);
393 wClientSetState(wwin, NormalState, None);
395 /* if the window is focused, set the focus again as it was disabled during
397 if (wwin
->flags
.focused
)
398 wSetFocusTo(wwin
->screen_ptr
, wwin
);
401 wGNOMEUpdateClientStateHint(wwin
, False
);
404 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
405 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
408 /* update window list to reflect unshaded state */
409 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
415 wMaximizeWindow(WWindow
*wwin
, int directions
)
417 int new_width
, new_height
, new_x
, new_y
;
418 WArea usableArea
= wwin
->screen_ptr
->totalUsableArea
;
421 if (WFLAGP(wwin
, no_resizable
))
425 if (WFLAGP(wwin
, full_maximize
)) {
428 usableArea
.x2
= wwin
->screen_ptr
->scr_width
;
429 usableArea
.y2
= wwin
->screen_ptr
->scr_height
;
432 if (wwin
->flags
.shaded
) {
433 wwin
->flags
.skip_next_animation
= 1;
434 wUnshadeWindow(wwin
);
436 wwin
->flags
.maximized
= directions
;
437 wwin
->old_geometry
.width
= wwin
->client
.width
;
438 wwin
->old_geometry
.height
= wwin
->client
.height
;
439 wwin
->old_geometry
.x
= wwin
->frame_x
;
440 wwin
->old_geometry
.y
= wwin
->frame_y
;
443 wKWMUpdateClientGeometryRestore(wwin
);
446 if (directions
& MAX_HORIZONTAL
) {
448 new_width
= (usableArea
.x2
-usableArea
.x1
)-FRAME_BORDER_WIDTH
*2;
449 new_x
= usableArea
.x1
;
453 new_x
= wwin
->frame_x
;
454 new_width
= wwin
->frame
->core
->width
;
458 if (directions
& MAX_VERTICAL
) {
460 new_height
= (usableArea
.y2
-usableArea
.y1
)-FRAME_BORDER_WIDTH
*2;
461 new_y
= usableArea
.y1
;
462 if (WFLAGP(wwin
, full_maximize
))
463 new_y
-= wwin
->frame
->top_width
;
467 new_y
= wwin
->frame_y
;
468 new_height
= wwin
->frame
->core
->height
;
472 if (!WFLAGP(wwin
, full_maximize
)) {
473 new_height
-= wwin
->frame
->top_width
+wwin
->frame
->bottom_width
;
476 wWindowConstrainSize(wwin
, &new_width
, &new_height
);
477 wWindowConfigure(wwin
, new_x
, new_y
, new_width
, new_height
);
480 wGNOMEUpdateClientStateHint(wwin
, False
);
483 wKWMUpdateClientStateHint(wwin
, KWMMaximizedFlag
);
484 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
488 wSoundPlay(WMSOUND_MAXIMIZE
);
494 wUnmaximizeWindow(WWindow
*wwin
)
496 int restore_x
, restore_y
;
498 if (!wwin
->flags
.maximized
)
501 if (wwin
->flags
.shaded
) {
502 wwin
->flags
.skip_next_animation
= 1;
503 wUnshadeWindow(wwin
);
505 restore_x
= (wwin
->flags
.maximized
& MAX_HORIZONTAL
) ?
506 wwin
->old_geometry
.x
: wwin
->frame_x
;
507 restore_y
= (wwin
->flags
.maximized
& MAX_VERTICAL
) ?
508 wwin
->old_geometry
.y
: wwin
->frame_y
;
509 wwin
->flags
.maximized
= 0;
510 wWindowConfigure(wwin
, restore_x
, restore_y
,
511 wwin
->old_geometry
.width
, wwin
->old_geometry
.height
);
514 wGNOMEUpdateClientStateHint(wwin
, False
);
517 wKWMUpdateClientStateHint(wwin
, KWMMaximizedFlag
);
518 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
522 wSoundPlay(WMSOUND_UNMAXIMIZE
);
528 animateResizeFlip(WScreen
*scr
, int x
, int y
, int w
, int h
,
529 int fx
, int fy
, int fw
, int fh
, int steps
)
531 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_F)
532 float cx
, cy
, cw
, ch
;
533 float xstep
, ystep
, wstep
, hstep
;
536 float angle
, final_angle
, delta
;
538 xstep
= (float)(fx
-x
)/steps
;
539 ystep
= (float)(fy
-y
)/steps
;
540 wstep
= (float)(fw
-w
)/steps
;
541 hstep
= (float)(fh
-h
)/steps
;
548 final_angle
= 2*WM_PI
*MINIATURIZE_ANIMATION_TWIST_F
;
549 delta
= (float)(final_angle
/FRAMES
);
550 for (angle
=0;; angle
+=delta
) {
551 if (angle
> final_angle
)
554 dx
= (cw
/10) - ((cw
/5) * sin(angle
));
555 dch
= (ch
/2) * cos(angle
);
558 points
[0].x
= cx
+ dx
; points
[0].y
= midy
- dch
;
559 points
[1].x
= cx
+ cw
- dx
; points
[1].y
= points
[0].y
;
560 points
[2].x
= cx
+ cw
+ dx
; points
[2].y
= midy
+ dch
;
561 points
[3].x
= cx
- dx
; points
[3].y
= points
[2].y
;
562 points
[4].x
= points
[0].x
; points
[4].y
= points
[0].y
;
565 XDrawLines(dpy
,scr
->root_win
,scr
->frame_gc
,points
, 5, CoordModeOrigin
);
567 #if (MINIATURIZE_ANIMATION_DELAY_F > 0)
568 wusleep(MINIATURIZE_ANIMATION_DELAY_F
);
571 XDrawLines(dpy
,scr
->root_win
,scr
->frame_gc
,points
, 5, CoordModeOrigin
);
577 if (angle
>= final_angle
)
587 animateResizeTwist(WScreen
*scr
, int x
, int y
, int w
, int h
,
588 int fx
, int fy
, int fw
, int fh
, int steps
)
590 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_T)
591 float cx
, cy
, cw
, ch
;
592 float xstep
, ystep
, wstep
, hstep
;
594 float angle
, final_angle
, a
, d
, delta
;
601 xstep
= (float)(fx
-x
)/steps
;
602 ystep
= (float)(fy
-y
)/steps
;
603 wstep
= (float)(fw
-w
)/steps
;
604 hstep
= (float)(fh
-h
)/steps
;
611 final_angle
= 2*WM_PI
*MINIATURIZE_ANIMATION_TWIST_T
;
612 delta
= (float)(final_angle
/FRAMES
);
613 for (angle
=0;; angle
+=delta
) {
614 if (angle
> final_angle
)
618 d
= sqrt((cw
/2)*(cw
/2)+(ch
/2)*(ch
/2));
620 points
[0].x
= cx
+cos(angle
-a
)*d
;
621 points
[0].y
= cy
+sin(angle
-a
)*d
;
622 points
[1].x
= cx
+cos(angle
+a
)*d
;
623 points
[1].y
= cy
+sin(angle
+a
)*d
;
624 points
[2].x
= cx
+cos(angle
-a
+WM_PI
)*d
;
625 points
[2].y
= cy
+sin(angle
-a
+WM_PI
)*d
;
626 points
[3].x
= cx
+cos(angle
+a
+WM_PI
)*d
;
627 points
[3].y
= cy
+sin(angle
+a
+WM_PI
)*d
;
628 points
[4].x
= cx
+cos(angle
-a
)*d
;
629 points
[4].y
= cy
+sin(angle
-a
)*d
;
631 XDrawLines(dpy
, scr
->root_win
, scr
->frame_gc
, points
, 5, CoordModeOrigin
);
633 #if (MINIATURIZE_ANIMATION_DELAY_T > 0)
634 wusleep(MINIATURIZE_ANIMATION_DELAY_T
);
637 XDrawLines(dpy
, scr
->root_win
, scr
->frame_gc
, points
, 5, CoordModeOrigin
);
643 if (angle
>= final_angle
)
653 animateResizeZoom(WScreen
*scr
, int x
, int y
, int w
, int h
,
654 int fx
, int fy
, int fw
, int fh
, int steps
)
656 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_Z)
657 float cx
[FRAMES
], cy
[FRAMES
], cw
[FRAMES
], ch
[FRAMES
];
658 float xstep
, ystep
, wstep
, hstep
;
661 xstep
= (float)(fx
-x
)/steps
;
662 ystep
= (float)(fy
-y
)/steps
;
663 wstep
= (float)(fw
-w
)/steps
;
664 hstep
= (float)(fh
-h
)/steps
;
666 for (j
=0; j
<FRAMES
; j
++) {
673 for (i
=0; i
<steps
; i
++) {
674 for (j
=0; j
<FRAMES
; j
++) {
675 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
676 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
679 #if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
680 wusleep(MINIATURIZE_ANIMATION_DELAY_Z
);
682 for (j
=0; j
<FRAMES
; j
++) {
683 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
684 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
699 for (j
=0; j
<FRAMES
; j
++) {
700 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
701 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
704 #if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
705 wusleep(MINIATURIZE_ANIMATION_DELAY_Z
);
707 for (j
=0; j
<FRAMES
; j
++) {
708 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
709 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
718 animateResize(WScreen
*scr
, int x
, int y
, int w
, int h
,
719 int fx
, int fy
, int fw
, int fh
, int hiding
)
721 int style
= wPreferences
.iconification_style
; /* Catch the value */
724 if (style
== WIS_NONE
)
727 if (style
== WIS_RANDOM
) {
731 k
= (hiding
? 2 : 3);
734 steps
= (MINIATURIZE_ANIMATION_STEPS_T
* k
)/3;
736 animateResizeTwist(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
739 steps
= (MINIATURIZE_ANIMATION_STEPS_F
* k
)/3;
741 animateResizeFlip(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
745 steps
= (MINIATURIZE_ANIMATION_STEPS_Z
* k
)/3;
747 animateResizeZoom(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
751 #endif /* ANIMATIONS */
759 while (XCheckTypedEvent(dpy
, Expose
, &tmpev
))
760 WMHandleEvent(&tmpev
);
765 unmapTransientsFor(WWindow
*wwin
)
770 tmp
= wwin
->screen_ptr
->focused_window
;
772 /* unmap the transients for this transient */
773 if (tmp
!=wwin
&& tmp
->transient_for
== wwin
->client_win
774 && (tmp
->flags
.mapped
|| wwin
->screen_ptr
->flags
.startup
775 || tmp
->flags
.shaded
)) {
776 unmapTransientsFor(tmp
);
777 tmp
->flags
.miniaturized
= 1;
778 if (!tmp
->flags
.shaded
) {
781 XUnmapWindow(dpy
, tmp
->frame
->core
->window
);
784 if (!tmp->flags.shaded)
786 wClientSetState(tmp
, IconicState
, None
);
788 wKWMUpdateClientStateHint(tmp
, KWMIconifiedFlag
);
789 wKWMSendEventMessage(tmp
, WKWMRemoveWindow
);
790 tmp
->flags
.kwm_hidden_for_modules
= 1;
793 UpdateSwitchMenu(wwin
->screen_ptr
, tmp
, ACTION_CHANGE_STATE
);
802 mapTransientsFor(WWindow
*wwin
)
806 tmp
= wwin
->screen_ptr
->focused_window
;
808 /* recursively map the transients for this transient */
809 if (tmp
!=wwin
&& tmp
->transient_for
== wwin
->client_win
810 && /*!tmp->flags.mapped*/ tmp
->flags
.miniaturized
811 && tmp
->icon
==NULL
) {
812 mapTransientsFor(tmp
);
813 tmp
->flags
.miniaturized
= 0;
814 if (!tmp
->flags
.shaded
) {
817 XMapWindow(dpy
, tmp
->frame
->core
->window
);
819 tmp
->flags
.semi_focused
= 0;
821 if (!tmp->flags.shaded)
823 wClientSetState(tmp
, NormalState
, None
);
825 wKWMUpdateClientStateHint(tmp
, KWMIconifiedFlag
);
826 if (tmp
->flags
.kwm_hidden_for_modules
) {
827 wKWMSendEventMessage(tmp
, WKWMAddWindow
);
828 tmp
->flags
.kwm_hidden_for_modules
= 0;
832 UpdateSwitchMenu(wwin
->screen_ptr
, tmp
, ACTION_CHANGE_STATE
);
841 setupIconGrabs(WIcon
*icon
)
843 /* setup passive grabs on the icon */
844 XGrabButton(dpy
, Button1
, AnyModifier
, icon
->core
->window
, True
,
845 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
846 XGrabButton(dpy
, Button2
, AnyModifier
, icon
->core
->window
, True
,
847 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
848 XGrabButton(dpy
, Button3
, AnyModifier
, icon
->core
->window
, True
,
849 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
855 recursiveTransientFor(WWindow
*wwin
)
862 /* hackish way to detect transient_for cycle */
863 i
= wwin
->screen_ptr
->window_count
+1;
865 while (wwin
&& wwin
->transient_for
!= None
&& i
>0) {
866 wwin
= wWindowFor(wwin
->transient_for
);
870 wwarning("%s has a severely broken WM_TRANSIENT_FOR hint.",
880 removeIconGrabs(WIcon
*icon
)
882 /* remove passive grabs on the icon */
883 XUngrabButton(dpy
, Button1
, AnyModifier
, icon
->core
->window
);
884 XUngrabButton(dpy
, Button2
, AnyModifier
, icon
->core
->window
);
885 XUngrabButton(dpy
, Button3
, AnyModifier
, icon
->core
->window
);
892 wIconifyWindow(WWindow
*wwin
)
894 XWindowAttributes attribs
;
898 if (!XGetWindowAttributes(dpy
, wwin
->client_win
, &attribs
)) {
899 /* the window doesn't exist anymore */
903 if (wwin
->flags
.miniaturized
) {
908 if (wwin
->transient_for
!=None
) {
909 WWindow
*owner
= wWindowFor(wwin
->transient_for
);
911 if (owner
&& owner
->flags
.miniaturized
)
915 present
= wwin
->frame
->workspace
==wwin
->screen_ptr
->current_workspace
;
917 /* if the window is in another workspace, simplify process */
919 /* icon creation may take a while */
920 XGrabPointer(dpy
, wwin
->screen_ptr
->root_win
, False
,
921 ButtonMotionMask
|ButtonReleaseMask
, GrabModeAsync
,
922 GrabModeAsync
, None
, None
, CurrentTime
);
925 if (!wPreferences
.disable_miniwindows
) {
926 if (!wwin
->flags
.icon_moved
) {
927 PlaceIcon(wwin
->screen_ptr
, &wwin
->icon_x
, &wwin
->icon_y
);
929 wwin
->icon
= wIconCreate(wwin
);
931 wwin
->icon
->mapped
= 1;
934 wwin
->flags
.miniaturized
= 1;
935 wwin
->flags
.mapped
= 0;
937 /* unmap transients */
939 unmapTransientsFor(wwin
);
943 wSoundPlay(WMSOUND_ICONIFY
);
946 XUngrabPointer(dpy
, CurrentTime
);
948 /* let all Expose events arrive so that we can repaint
949 * something before the animation starts (and the server is grabbed) */
952 if (wPreferences
.disable_miniwindows
)
953 wClientSetState(wwin
, IconicState
, None
);
955 wClientSetState(wwin
, IconicState
, wwin
->icon
->icon_win
);
959 if (!wwin
->screen_ptr
->flags
.startup
&& !wwin
->flags
.skip_next_animation
960 && !wPreferences
.no_animations
) {
963 if (!wPreferences
.disable_miniwindows
) {
966 iw
= wwin
->icon
->core
->width
;
967 ih
= wwin
->icon
->core
->height
;
972 if (wKWMGetIconGeometry(wwin
, &area
)) {
978 #endif /* KWM_HINTS */
982 iw
= wwin
->screen_ptr
->scr_width
;
983 ih
= wwin
->screen_ptr
->scr_height
;
986 animateResize(wwin
->screen_ptr
, wwin
->frame_x
, wwin
->frame_y
,
987 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
988 ix
, iy
, iw
, ih
, False
);
993 wwin
->flags
.skip_next_animation
= 0;
995 if (!wPreferences
.disable_miniwindows
) {
997 if (wwin
->screen_ptr
->current_workspace
==wwin
->frame
->workspace
||
998 IS_OMNIPRESENT(wwin
) || wPreferences
.sticky_icons
)
1000 XMapWindow(dpy
, wwin
->icon
->core
->window
);
1002 AddToStackList(wwin
->icon
->core
);
1004 wLowerFrame(wwin
->icon
->core
);
1008 WWindow
*owner
= recursiveTransientFor(wwin
->screen_ptr
->focused_window
);
1011 * It doesn't seem to be working and causes button event hangup
1012 * when deiconifying a transient window.
1013 setupIconGrabs(wwin->icon);
1015 if ((wwin
->flags
.focused
1016 || (owner
&& wwin
->client_win
== owner
->client_win
))
1017 && wPreferences
.focus_mode
==WKF_CLICK
) {
1022 if (!WFLAGP(tmp
, no_focusable
)
1023 && !(tmp
->flags
.hidden
||tmp
->flags
.miniaturized
)
1024 && (wwin
->frame
->workspace
== tmp
->frame
->workspace
))
1028 wSetFocusTo(wwin
->screen_ptr
, tmp
);
1029 } else if (wPreferences
.focus_mode
!=WKF_CLICK
) {
1030 wSetFocusTo(wwin
->screen_ptr
, NULL
);
1034 if (!wwin
->screen_ptr
->flags
.startup
) {
1035 Window clientwin
= wwin
->client_win
;
1038 processEvents(XPending(dpy
));
1040 /* the window can disappear while doing the processEvents() */
1041 if (!wWindowFor(clientwin
))
1048 if (wwin
->flags
.selected
&& !wPreferences
.disable_miniwindows
)
1049 wIconSelect(wwin
->icon
);
1052 wGNOMEUpdateClientStateHint(wwin
, False
);
1055 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
1056 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
1059 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1066 wDeiconifyWindow(WWindow
*wwin
)
1068 wWindowChangeWorkspace(wwin
, wwin
->screen_ptr
->current_workspace
);
1070 if (!wwin
->flags
.miniaturized
)
1073 if (wwin
->transient_for
!= None
1074 && wwin
->transient_for
!= wwin
->screen_ptr
->root_win
) {
1075 WWindow
*owner
= recursiveTransientFor(wwin
);
1077 if (owner
&& owner
->flags
.miniaturized
) {
1078 wDeiconifyWindow(owner
);
1079 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1080 wRaiseFrame(wwin
->frame
->core
);
1085 wwin
->flags
.miniaturized
= 0;
1086 if (!wwin
->flags
.shaded
)
1087 wwin
->flags
.mapped
= 1;
1089 if (!wPreferences
.disable_miniwindows
) {
1090 if (wwin
->icon
->selected
)
1091 wIconSelect(wwin
->icon
);
1093 XUnmapWindow(dpy
, wwin
->icon
->core
->window
);
1097 wSoundPlay(WMSOUND_DEICONIFY
);
1100 /* if the window is in another workspace, do it silently */
1102 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
1103 && !wwin
->flags
.skip_next_animation
) {
1106 if (!wPreferences
.disable_miniwindows
) {
1109 iw
= wwin
->icon
->core
->width
;
1110 ih
= wwin
->icon
->core
->height
;
1115 if (wKWMGetIconGeometry(wwin
, &area
)) {
1121 #endif /* KWM_HINTS */
1125 iw
= wwin
->screen_ptr
->scr_width
;
1126 ih
= wwin
->screen_ptr
->scr_height
;
1129 animateResize(wwin
->screen_ptr
, ix
, iy
, iw
, ih
,
1130 wwin
->frame_x
, wwin
->frame_y
,
1131 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1134 #endif /* ANIMATIONS */
1135 wwin
->flags
.skip_next_animation
= 0;
1137 if (!wwin
->flags
.shaded
) {
1138 XMapWindow(dpy
, wwin
->client_win
);
1140 XMapWindow(dpy
, wwin
->frame
->core
->window
);
1141 wRaiseFrame(wwin
->frame
->core
);
1142 if (!wwin
->flags
.shaded
) {
1143 wClientSetState(wwin
, NormalState
, None
);
1145 mapTransientsFor(wwin
);
1147 if (!wPreferences
.disable_miniwindows
) {
1148 RemoveFromStackList(wwin
->icon
->core
);
1149 /* removeIconGrabs(wwin->icon);*/
1150 wIconDestroy(wwin
->icon
);
1155 if (wPreferences
.focus_mode
==WKF_CLICK
)
1156 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1159 if (!wwin
->screen_ptr
->flags
.startup
) {
1160 Window clientwin
= wwin
->client_win
;
1163 processEvents(XPending(dpy
));
1165 if (!wWindowFor(clientwin
))
1170 if (wPreferences
.auto_arrange_icons
) {
1171 wArrangeIcons(wwin
->screen_ptr
, True
);
1175 wGNOMEUpdateClientStateHint(wwin
, False
);
1178 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
1179 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
1182 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1188 hideWindow(WIcon
*icon
, int icon_x
, int icon_y
, WWindow
*wwin
, int animate
)
1190 if (wwin
->flags
.miniaturized
) {
1192 XUnmapWindow(dpy
, wwin
->icon
->core
->window
);
1193 wwin
->icon
->mapped
= 0;
1195 wwin
->flags
.hidden
= 1;
1197 wGNOMEUpdateClientStateHint(wwin
, False
);
1200 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1205 if (wwin
->flags
.inspector_open
) {
1206 WWindow
*pwin
= wwin
->inspector
->frame
;
1209 pwin
->flags
.hidden
= 1;
1211 wClientSetState(pwin
, IconicState
, icon
->icon_win
);
1214 wwin
->flags
.hidden
= 1;
1217 wClientSetState(wwin
, IconicState
, icon
->icon_win
);
1220 wSoundPlay(WMSOUND_HIDE
);
1223 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
&&
1224 !wwin
->flags
.skip_next_animation
&& animate
) {
1225 animateResize(wwin
->screen_ptr
, wwin
->frame_x
, wwin
->frame_y
,
1226 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1227 icon_x
, icon_y
, icon
->core
->width
, icon
->core
->height
,
1231 wwin
->flags
.skip_next_animation
= 0;
1234 wGNOMEUpdateClientStateHint(wwin
, False
);
1237 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1243 wHideOtherApplications(WWindow
*awin
)
1247 #ifdef REDUCE_APPICONS
1248 char *tinstance
, *tclass
;
1249 unsigned int brokenwin
= 0, match
= 0;
1254 wwin
= awin
->screen_ptr
->focused_window
;
1256 #ifdef REDUCE_APPICONS
1257 if (awin
->wm_instance
== NULL
|| awin
->wm_class
== NULL
)
1263 && wwin
->frame
->workspace
== awin
->screen_ptr
->current_workspace
1264 && !(wwin
->flags
.miniaturized
||wwin
->flags
.hidden
)
1265 && !wwin
->flags
.internal_window
1266 && (!wwin
->flags
.inspector_open
|| wwin
->inspector
->frame
!=awin
)
1267 && !WFLAGP(wwin
, no_hide_others
)) {
1269 #ifdef REDUCE_APPICONS
1272 if ((tinstance
= wwin
->wm_instance
) == NULL
)
1274 if ((tclass
= wwin
->wm_class
) == NULL
)
1276 if ((strcmp(awin
->wm_instance
, tinstance
) == 0) &&
1277 (strcmp(awin
->wm_class
, tclass
) == 0) )
1282 if (wwin
->main_window
==None
|| WFLAGP(wwin
, no_appicon
)) {
1283 if (!WFLAGP(wwin
, no_miniaturizable
)) {
1284 wwin
->flags
.skip_next_animation
= 1;
1285 wIconifyWindow(wwin
);
1287 } else if (wwin
->main_window
!=None
1288 #ifndef REDUCE_APPICONS
1289 && awin
->main_window
!= wwin
->main_window
) {
1291 && (awin
->main_window
!= wwin
->main_window
&& !match
)) {
1293 tapp
= wApplicationOf(wwin
->main_window
);
1295 tapp
->flags
.skip_next_animation
= 1;
1296 wHideApplication(tapp
);
1298 if (!WFLAGP(wwin
, no_miniaturizable
)) {
1299 wwin
->flags
.skip_next_animation
= 1;
1300 wIconifyWindow(wwin
);
1308 wSetFocusTo(awin->screen_ptr, awin);
1315 wHideApplication(WApplication
*wapp
)
1317 #ifdef REDUCE_APPICONS
1319 char *tinstance
, *tclass
;
1320 unsigned int nowmhints
= 0, matchwmhints
= 0, matchworkspace
= 0;
1327 wwarning("trying to hide a non grouped window");
1330 if (!wapp
->main_window_desc
) {
1331 wwarning("group leader not found for window group");
1334 #ifdef REDUCE_APPICONS
1335 if ((wapp
->main_window_desc
->wm_instance
== NULL
) ||
1336 (wapp
->main_window_desc
->wm_class
== NULL
))
1339 scr
= wapp
->main_window_desc
->screen_ptr
;
1341 wlist
= scr
->focused_window
;
1345 if (wlist
->main_window
== wapp
->main_window
)
1346 wapp
->last_focused
= wlist
;
1348 wapp
->last_focused
= NULL
;
1350 #ifdef REDUCE_APPICONS
1351 matchwmhints
= matchworkspace
= 0;
1353 tapp
= wApplicationOf(wlist
->main_window
);
1354 tinstance
= tclass
= NULL
;
1356 if (tapp
->main_window_desc
) {
1357 tinstance
= tapp
->main_window_desc
->wm_instance
;
1358 tclass
= tapp
->main_window_desc
->wm_class
;
1361 if (tapp
== NULL
|| tinstance
== NULL
|| tclass
== NULL
) {
1362 /* Should never reach here */
1366 if ((strcmp(tinstance
, wapp
->main_window_desc
->wm_instance
) == 0) &&
1367 (strcmp(tclass
, wapp
->main_window_desc
->wm_class
) == 0) )
1371 if (wlist
->frame
->workspace
== wapp
->main_window_desc
->screen_ptr
->current_workspace
)
1374 if ((wlist
->main_window
== wapp
->main_window
|| matchwmhints
) &&
1380 if (wlist
->main_window
== wapp
->main_window
) {
1382 if (wlist
->flags
.focused
) {
1386 hideWindow(wapp
->app_icon
->icon
, wapp
->app_icon
->x_pos
,
1387 wapp
->app_icon
->y_pos
, wlist
,
1388 !wapp
->flags
.skip_next_animation
);
1390 wlist
= wlist
->prev
;
1393 wapp
->flags
.skip_next_animation
= 0;
1396 if (wPreferences
.focus_mode
==WKF_CLICK
) {
1397 wlist
= scr
->focused_window
;
1399 if (!WFLAGP(wlist
, no_focusable
) && !wlist
->flags
.hidden
1400 && (wlist
->flags
.mapped
|| wlist
->flags
.shaded
))
1402 wlist
= wlist
->prev
;
1404 wSetFocusTo(scr
, wlist
);
1406 wSetFocusTo(scr
, NULL
);
1410 wapp
->flags
.hidden
= 1;
1412 if(wPreferences
.auto_arrange_icons
) {
1413 wArrangeIcons(scr
, True
);
1417 wAppIconPaint(wapp
->app_icon
);
1425 unhideWindow(WIcon
*icon
, int icon_x
, int icon_y
, WWindow
*wwin
, int animate
,
1426 int bringToCurrentWS
)
1428 if (bringToCurrentWS
)
1429 wWindowChangeWorkspace(wwin
, wwin
->screen_ptr
->current_workspace
);
1431 wwin
->flags
.hidden
=0;
1432 wwin
->flags
.mapped
=1;
1435 wSoundPlay(WMSOUND_UNHIDE
);
1438 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
1440 animateResize(wwin
->screen_ptr
, icon_x
, icon_y
,
1441 icon
->core
->width
, icon
->core
->height
,
1442 wwin
->frame_x
, wwin
->frame_y
,
1443 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1447 wwin
->flags
.skip_next_animation
= 0;
1448 XMapWindow(dpy
, wwin
->client_win
);
1449 XMapWindow(dpy
, wwin
->frame
->core
->window
);
1450 wClientSetState(wwin
, NormalState
, None
);
1451 wRaiseFrame(wwin
->frame
->core
);
1452 if (wwin
->flags
.inspector_open
) {
1453 WWindow
*pwin
= wwin
->inspector
->frame
;
1455 pwin
->flags
.hidden
= 0;
1456 pwin
->flags
.mapped
= 1;
1457 XMapWindow(dpy
, pwin
->client_win
);
1458 XMapWindow(dpy
, pwin
->frame
->core
->window
);
1459 wClientSetState(pwin
, NormalState
, None
);
1463 wGNOMEUpdateClientStateHint(wwin
, False
);
1466 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1472 wUnhideApplication(WApplication
*wapp
, Bool miniwindows
, Bool bringToCurrentWS
)
1475 WWindow
*wlist
, *next
;
1476 WWindow
*focused
=NULL
;
1477 #ifdef REDUCE_APPICONS
1478 char *tinstance
, *tclass
;
1479 unsigned int nowmhints
= 0, matchwmhints
= 0, matchworkspace
= 0;
1486 #ifdef REDUCE_APPICONS
1487 if ((wapp
->main_window_desc
->wm_class
== NULL
) ||
1488 (wapp
->main_window_desc
->wm_instance
== NULL
))
1492 scr
= wapp
->main_window_desc
->screen_ptr
;
1493 wlist
= scr
->focused_window
;
1495 /* goto beginning of list */
1497 wlist
= wlist
->prev
;
1502 #ifndef REDUCE_APPICONS
1503 if (wlist
->main_window
== wapp
->main_window
) {
1505 matchwmhints
= matchworkspace
= 0;
1507 if ((tinstance
= wlist
->wm_instance
) == NULL
)
1509 if ((tclass
= wlist
->wm_class
) == NULL
)
1511 if ((strcmp(tinstance
, wapp
->main_window_desc
->wm_instance
) == 0)
1512 && (strcmp(tclass
, wapp
->main_window_desc
->wm_class
) == 0) )
1516 if (wlist
->frame
->workspace
== wapp
->main_window_desc
->screen_ptr
->current_workspace
)
1520 if ((wlist
->main_window
== wapp
->main_window
|| matchwmhints
) &&
1523 if (wlist
->flags
.focused
)
1525 else if (!focused
|| !focused
->flags
.focused
)
1528 if (wlist
->flags
.miniaturized
&& wlist
->icon
) {
1529 if (bringToCurrentWS
|| wPreferences
.sticky_icons
1530 || wlist
->frame
->workspace
== scr
->current_workspace
) {
1531 if (!wlist
->icon
->mapped
) {
1532 XMapWindow(dpy
, wlist
->icon
->core
->window
);
1533 wlist
->icon
->mapped
= 1;
1535 wlist
->flags
.hidden
= 0;
1537 UpdateSwitchMenu(scr
, wlist
, ACTION_CHANGE_STATE
);
1539 if (wlist
->frame
->workspace
!= scr
->current_workspace
)
1540 wWindowChangeWorkspace(wlist
, scr
->current_workspace
);
1543 wDeiconifyWindow(wlist
);
1545 } else if (wlist
->flags
.hidden
) {
1546 unhideWindow(wapp
->app_icon
->icon
, wapp
->app_icon
->x_pos
,
1547 wapp
->app_icon
->y_pos
, wlist
,
1548 !wapp
->flags
.skip_next_animation
,
1551 if (bringToCurrentWS
1552 && wlist
->frame
->workspace
!= scr
->current_workspace
) {
1553 wWindowChangeWorkspace(wlist
, scr
->current_workspace
);
1555 wRaiseFrame(wlist
->frame
->core
);
1561 wapp
->flags
.skip_next_animation
= 0;
1562 wapp
->flags
.hidden
= 0;
1565 wSetFocusTo(scr
, focused
);
1566 else if (wapp
->last_focused
&& wapp
->last_focused
->flags
.mapped
)
1567 wSetFocusTo(scr
, wapp
->last_focused
);
1568 wapp
->last_focused
= NULL
;
1569 if (wPreferences
.auto_arrange_icons
) {
1570 wArrangeIcons(scr
, True
);
1573 wAppIconPaint(wapp
->app_icon
);
1580 wShowAllWindows(WScreen
*scr
)
1582 WWindow
*wwin
, *old_foc
;
1585 old_foc
= wwin
= scr
->focused_window
;
1587 if (!wwin
->flags
.internal_window
&&
1588 (scr
->current_workspace
== wwin
->frame
->workspace
1589 || IS_OMNIPRESENT(wwin
))) {
1590 if (wwin
->flags
.miniaturized
) {
1591 wwin
->flags
.skip_next_animation
= 1;
1592 wDeiconifyWindow(wwin
);
1593 } else if (wwin
->flags
.hidden
) {
1594 wapp
= wApplicationOf(wwin
->main_window
);
1596 wUnhideApplication(wapp
, False
, False
);
1598 wwin
->flags
.skip_next_animation
= 1;
1599 wDeiconifyWindow(wwin
);
1605 wSetFocusTo(scr
, old_foc
);
1606 /*wRaiseFrame(old_foc->frame->core);*/
1611 wRefreshDesktop(WScreen
*scr
)
1614 XSetWindowAttributes attr
;
1616 attr
.backing_store
= NotUseful
;
1617 attr
.save_under
= False
;
1618 win
= XCreateWindow(dpy
, scr
->root_win
, 0, 0, scr
->scr_width
,
1619 scr
->scr_height
, 0, CopyFromParent
, CopyFromParent
,
1620 (Visual
*)CopyFromParent
, CWBackingStore
|CWSaveUnder
,
1622 XMapRaised(dpy
, win
);
1623 XDestroyWindow(dpy
, win
);
1629 wArrangeIcons(WScreen
*scr
, Bool arrangeAll
)
1633 int pf
; /* primary axis */
1634 int sf
; /* secondary axis */
1638 int sx1
, sx2
, sy1
, sy2
; /* screen boundary */
1642 int isize
= wPreferences
.icon_size
;
1645 * Find out screen boundaries.
1649 sx2
= scr
->scr_width
;
1650 sy2
= scr
->scr_height
;
1652 if (scr
->dock
->on_right_side
)
1653 sx2
-= isize
+ DOCK_EXTRA_SPACE
;
1655 sx1
+= isize
+ DOCK_EXTRA_SPACE
;
1658 sw
= isize
* (scr
->scr_width
/isize
);
1659 sh
= isize
* (scr
->scr_height
/isize
);
1660 fullW
= (sx2
-sx1
)/isize
;
1661 fullH
= (sy2
-sy1
)/isize
;
1663 /* icon yard boundaries */
1664 if (wPreferences
.icon_yard
& IY_VERT
) {
1671 if (wPreferences
.icon_yard
& IY_RIGHT
) {
1678 if (wPreferences
.icon_yard
& IY_TOP
) {
1686 /* arrange icons putting the most recently focused window
1687 * as the last icon */
1688 #define X ((wPreferences.icon_yard & IY_VERT) ? xo + xs*(si*isize)\
1689 : xo + xs*(pi*isize))
1690 #define Y ((wPreferences.icon_yard & IY_VERT) ? yo + ys*(pi*isize)\
1691 : yo + ys*(si*isize))
1693 /* arrange application icons */
1694 aicon
= scr
->app_icon_list
;
1695 /* reverse them to avoid unnecessarily sliding of icons */
1696 while (aicon
&& aicon
->next
)
1697 aicon
= aicon
->next
;
1702 if (!aicon
->docked
) {
1703 if (aicon
->x_pos
!= X
|| aicon
->y_pos
!= Y
) {
1705 if (!wPreferences
.no_animations
) {
1706 SlideWindow(aicon
->icon
->core
->window
, aicon
->x_pos
, aicon
->y_pos
,
1709 #endif /* ANIMATIONS */
1711 wAppIconMove(aicon
, X
, Y
);
1714 /* we reversed the order so we use prev */
1715 aicon
= aicon
->prev
;
1722 /* arrange miniwindows */
1724 wwin
= scr
->focused_window
;
1725 /* reverse them to avoid unnecessarily shuffling */
1726 while (wwin
&& wwin
->prev
)
1730 if (wwin
->icon
&& wwin
->flags
.miniaturized
&&/*!wwin->flags.hidden &&*/
1731 (wwin
->frame
->workspace
==scr
->current_workspace
||
1732 IS_OMNIPRESENT(wwin
) || wPreferences
.sticky_icons
)) {
1734 if (arrangeAll
|| !wwin
->flags
.icon_moved
) {
1735 if (wwin
->icon_x
!= X
|| wwin
->icon_y
!= Y
) {
1737 if (wPreferences
.no_animations
) {
1738 XMoveWindow(dpy
, wwin
->icon
->core
->window
, X
, Y
);
1740 SlideWindow(wwin
->icon
->core
->window
, wwin
->icon_x
,
1741 wwin
->icon_y
, X
, Y
);
1744 XMoveWindow(dpy
, wwin
->icon
->core
->window
, X
, Y
);
1745 #endif /* ANIMATIONS */
1753 wwin
->flags
.icon_moved
= 0;
1755 /* we reversed the order, so we use next */
1766 wSelectWindow(WWindow
*wwin
, Bool flag
)
1768 WScreen
*scr
= wwin
->screen_ptr
;
1770 wwin
->flags
.selected
= 1;
1771 XSetWindowBorder(dpy
, wwin
->frame
->core
->window
, scr
->white_pixel
);
1772 scr
->selected_windows
= list_cons(wwin
, scr
->selected_windows
);
1774 wwin
->flags
.selected
= 0;
1775 XSetWindowBorder(dpy
, wwin
->frame
->core
->window
,
1776 scr
->frame_border_pixel
);
1777 scr
->selected_windows
= list_remove_elem(scr
->selected_windows
, wwin
);
1783 wMakeWindowVisible(WWindow
*wwin
)
1785 if (wwin
->frame
->workspace
!= wwin
->screen_ptr
->current_workspace
)
1786 wWorkspaceChange(wwin
->screen_ptr
, wwin
->frame
->workspace
);
1788 if (wwin
->flags
.shaded
) {
1789 wUnshadeWindow(wwin
);
1791 if (wwin
->flags
.hidden
) {
1794 app
= wApplicationOf(wwin
->main_window
);
1796 wUnhideApplication(app
, False
, False
);
1797 } else if (wwin
->flags
.miniaturized
) {
1798 wDeiconifyWindow(wwin
);
1800 if (!WFLAGP(wwin
, no_focusable
))
1801 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1802 wRaiseFrame(wwin
->frame
->core
);