1 /* action.c- misc. window commands (miniaturize, hide etc.)
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,
27 #include <X11/Xutil.h>
34 #include "WindowMaker.h"
41 #include "application.h"
47 #include "winspector.h"
49 #include "workspace.h"
63 /****** Global Variables ******/
64 extern Time LastTimestamp
;
65 extern Time LastFocusChange
;
67 extern Cursor wCursor
[WCUR_LAST
];
69 extern WPreferences wPreferences
;
71 extern Atom _XA_WM_TAKE_FOCUS
;
74 /******* Local Variables *******/
79 {SHADE_STEPS_UF
, SHADE_DELAY_UF
},
80 {SHADE_STEPS_F
, SHADE_DELAY_F
},
81 {SHADE_STEPS_M
, SHADE_DELAY_M
},
82 {SHADE_STEPS_S
, SHADE_DELAY_S
},
83 {SHADE_STEPS_U
, SHADE_DELAY_U
}};
85 #define SHADE_STEPS shadePars[(int)wPreferences.shade_speed].steps
86 #define SHADE_DELAY shadePars[(int)wPreferences.shade_speed].delay
89 static int ignoreTimestamp
=0;
94 processEvents(int event_count
)
99 * This is a hack. When animations are enabled, processing of
100 * events ocurred during a animation are delayed until it's end.
101 * Calls that consider the TimeStamp, like XSetInputFocus(), will
102 * fail because the TimeStamp is too old. Then, for example, if
103 * the user changes window focus while a miniaturize animation is
104 * in course, the window will not get focus properly after the end
105 * of the animation. This tries to workaround it by passing CurrentTime
106 * as the TimeStamp for XSetInputFocus() for all events ocurred during
110 while (XPending(dpy
) && event_count
--) {
111 WMNextEvent(dpy
, &event
);
112 WMHandleEvent(&event
);
116 #endif /* ANIMATIONS */
121 *----------------------------------------------------------------------
123 * Changes the window focus to the one passed as argument.
124 * If the window to focus is not already focused, it will be brought
125 * to the head of the list of windows. Previously focused window is
129 * Window list may be reordered and the window focus is changed.
131 *----------------------------------------------------------------------
134 wSetFocusTo(WScreen
*scr
, WWindow
*wwin
)
136 WWindow
*focused
=scr
->focused_window
;
137 int timestamp
=LastTimestamp
;
138 WApplication
*oapp
=NULL
, *napp
=NULL
;
141 LastFocusChange
= timestamp
;
144 * This is a hack, because XSetInputFocus() should have a proper
145 * timestamp instead of CurrentTime but it seems that some times
146 * clients will not receive focus properly that way.
149 timestamp
= CurrentTime
;
152 oapp
= wApplicationOf(focused
->main_window
);
155 XSetInputFocus(dpy
, scr
->no_focus_win
, RevertToParent
, timestamp
);
157 wWindowUnfocus(focused
);
160 wAppMenuUnmap(oapp
->menu
);
162 wApplicationDeactivate(oapp
);
166 wKWMUpdateActiveWindowHint(scr
);
167 wKWMSendEventMessage(NULL
, WKWMFocusWindow
);
171 wasfocused
= wwin
->flags
.focused
;
172 napp
= wApplicationOf(wwin
->main_window
);
174 /* remember last workspace where the app has been */
176 napp
->last_workspace
= wwin
->screen_ptr
->current_workspace
;
178 if (wwin
->flags
.mapped
&& !WFLAGP(wwin
, no_focusable
)) {
179 /* install colormap if colormap mode is lock mode */
180 if (wPreferences
.colormap_mode
==WKF_CLICK
)
181 wColormapInstallForWindow(scr
, wwin
);
183 /* set input focus */
184 switch (wwin
->focus_mode
) {
186 XSetInputFocus(dpy
, scr
->no_focus_win
, RevertToParent
, timestamp
);
190 case WFM_LOCALLY_ACTIVE
:
191 XSetInputFocus(dpy
, wwin
->client_win
, RevertToParent
, timestamp
);
194 case WFM_GLOBALLY_ACTIVE
:
198 if (wwin
->protocols
.TAKE_FOCUS
) {
199 wClientSendProtocol(wwin
, _XA_WM_TAKE_FOCUS
, timestamp
);
203 XSetInputFocus(dpy
, scr
->no_focus_win
, RevertToParent
, timestamp
);
205 if (WFLAGP(wwin
, no_focusable
))
208 /* if this is not the focused window focus it */
210 /* change the focus window list order */
212 wwin
->prev
->next
= wwin
->next
;
215 wwin
->next
->prev
= wwin
->prev
;
217 wwin
->prev
= focused
;
218 focused
->next
= wwin
;
220 scr
->focused_window
= wwin
;
222 if (oapp
&& oapp
!= napp
) {
223 wAppMenuUnmap(oapp
->menu
);
225 wApplicationDeactivate(oapp
);
230 wWindowFocus(wwin
, focused
);
232 if (napp
&& !wasfocused
) {
234 wUserMenuRefreshInstances(napp
->menu
, wwin
);
235 #endif /* USER_MENU */
237 wAppMenuMap(napp
->menu
, wwin
);
239 wApplicationActivate(napp
);
243 wKWMUpdateActiveWindowHint(scr
);
244 wKWMSendEventMessage(wwin
, WKWMFocusWindow
);
251 wShadeWindow(WWindow
*wwin
)
253 time_t time0
= time(NULL
);
258 if (wwin
->flags
.shaded
)
261 XLowerWindow(dpy
, wwin
->client_win
);
264 wSoundPlay(WMSOUND_SHADE
);
268 if (!wwin
->screen_ptr
->flags
.startup
&& !wwin
->flags
.skip_next_animation
269 && !wPreferences
.no_animations
) {
270 /* do the shading animation */
271 h
= wwin
->frame
->core
->height
;
274 w
= wwin
->frame
->core
->width
;
275 y
= wwin
->frame
->top_width
;
276 while (h
>wwin
->frame
->top_width
+1) {
277 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
278 XResizeWindow(dpy
, wwin
->frame
->core
->window
, w
, h
);
281 if (time(NULL
)-time0
> MAX_ANIMATION_TIME
)
285 wusleep(SHADE_DELAY
*1000L);
289 XMoveWindow(dpy
, wwin
->client_win
, 0, wwin
->frame
->top_width
);
291 #endif /* ANIMATIONS */
293 wwin
->flags
.skip_next_animation
= 0;
294 wwin
->flags
.shaded
= 1;
295 wwin
->flags
.mapped
= 0;
296 /* prevent window withdrawal when getting UnmapNotify */
297 XSelectInput(dpy
, wwin
->client_win
,
298 wwin
->event_mask
& ~StructureNotifyMask
);
299 XUnmapWindow(dpy
, wwin
->client_win
);
300 XSelectInput(dpy
, wwin
->client_win
, wwin
->event_mask
);
302 /* for the client it's just like iconification */
303 wFrameWindowResize(wwin
->frame
, wwin
->frame
->core
->width
,
304 wwin
->frame
->top_width
- 1);
306 wwin
->client
.y
= wwin
->frame_y
- wwin
->client
.height
307 + wwin
->frame
->top_width
;
308 wWindowSynthConfigureNotify(wwin
);
311 wClientSetState(wwin, IconicState, None);
315 wGNOMEUpdateClientStateHint(wwin
, False
);
318 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
319 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
321 /* update window list to reflect shaded state */
322 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
325 if (!wwin
->screen_ptr
->flags
.startup
) {
326 /* Look at processEvents() for reason of this code. */
328 processEvents(XPending(dpy
));
335 wUnshadeWindow(WWindow
*wwin
)
337 time_t time0
= time(NULL
);
340 #endif /* ANIMATIONS */
343 if (!wwin
->flags
.shaded
)
346 wwin
->flags
.shaded
= 0;
347 wwin
->flags
.mapped
= 1;
348 XMapWindow(dpy
, wwin
->client_win
);
351 wSoundPlay(WMSOUND_UNSHADE
);
355 if (!wPreferences
.no_animations
&& !wwin
->flags
.skip_next_animation
) {
356 /* do the shading animation */
357 h
= wwin
->frame
->top_width
+ wwin
->frame
->bottom_width
;
358 y
= wwin
->frame
->top_width
- wwin
->client
.height
;
359 s
= abs(y
)/SHADE_STEPS
;
361 w
= wwin
->frame
->core
->width
;
362 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
364 while (h
< wwin
->client
.height
+ wwin
->frame
->top_width
365 + wwin
->frame
->bottom_width
) {
366 XResizeWindow(dpy
, wwin
->frame
->core
->window
, w
, h
);
367 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
370 wusleep(SHADE_DELAY
*2000L/3);
374 if (time(NULL
)-time0
> MAX_ANIMATION_TIME
)
378 XMoveWindow(dpy
, wwin
->client_win
, 0, wwin
->frame
->top_width
);
380 #endif /* ANIMATIONS */
382 wwin
->flags
.skip_next_animation
= 0;
383 wFrameWindowResize(wwin
->frame
, wwin
->frame
->core
->width
,
384 wwin
->frame
->top_width
+ wwin
->client
.height
385 + wwin
->frame
->bottom_width
);
387 wwin
->client
.y
= wwin
->frame_y
+ wwin
->frame
->top_width
;
388 wWindowSynthConfigureNotify(wwin
);
391 wClientSetState(wwin, NormalState, None);
393 /* if the window is focused, set the focus again as it was disabled during
395 if (wwin
->flags
.focused
)
396 wSetFocusTo(wwin
->screen_ptr
, wwin
);
399 wGNOMEUpdateClientStateHint(wwin
, False
);
402 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
403 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
406 /* update window list to reflect unshaded state */
407 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
413 wMaximizeWindow(WWindow
*wwin
, int directions
)
415 int new_width
, new_height
, new_x
, new_y
;
416 WArea usableArea
= wwin
->screen_ptr
->totalUsableArea
;
419 if (WFLAGP(wwin
, no_resizable
))
423 if (WFLAGP(wwin
, full_maximize
)) {
426 usableArea
.x2
= wwin
->screen_ptr
->scr_width
;
427 usableArea
.y2
= wwin
->screen_ptr
->scr_height
;
430 if (wwin
->flags
.shaded
) {
431 wwin
->flags
.skip_next_animation
= 1;
432 wUnshadeWindow(wwin
);
434 wwin
->flags
.maximized
= directions
;
435 wwin
->old_geometry
.width
= wwin
->client
.width
;
436 wwin
->old_geometry
.height
= wwin
->client
.height
;
437 wwin
->old_geometry
.x
= wwin
->frame_x
;
438 wwin
->old_geometry
.y
= wwin
->frame_y
;
441 wKWMUpdateClientGeometryRestore(wwin
);
444 if (directions
& MAX_HORIZONTAL
) {
446 new_width
= (usableArea
.x2
-usableArea
.x1
)-FRAME_BORDER_WIDTH
*2;
447 new_x
= usableArea
.x1
;
451 new_x
= wwin
->frame_x
;
452 new_width
= wwin
->frame
->core
->width
;
456 if (directions
& MAX_VERTICAL
) {
458 new_height
= (usableArea
.y2
-usableArea
.y1
)-FRAME_BORDER_WIDTH
*2;
459 new_y
= usableArea
.y1
;
460 if (WFLAGP(wwin
, full_maximize
))
461 new_y
-= wwin
->frame
->top_width
;
465 new_y
= wwin
->frame_y
;
466 new_height
= wwin
->frame
->core
->height
;
470 if (!WFLAGP(wwin
, full_maximize
)) {
471 new_height
-= wwin
->frame
->top_width
+wwin
->frame
->bottom_width
;
474 wWindowConstrainSize(wwin
, &new_width
, &new_height
);
475 wWindowConfigure(wwin
, new_x
, new_y
, new_width
, new_height
);
478 wGNOMEUpdateClientStateHint(wwin
, False
);
481 wKWMUpdateClientStateHint(wwin
, KWMMaximizedFlag
);
482 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
486 wSoundPlay(WMSOUND_MAXIMIZE
);
492 wUnmaximizeWindow(WWindow
*wwin
)
494 int restore_x
, restore_y
;
496 if (!wwin
->flags
.maximized
)
499 if (wwin
->flags
.shaded
) {
500 wwin
->flags
.skip_next_animation
= 1;
501 wUnshadeWindow(wwin
);
503 restore_x
= (wwin
->flags
.maximized
& MAX_HORIZONTAL
) ?
504 wwin
->old_geometry
.x
: wwin
->frame_x
;
505 restore_y
= (wwin
->flags
.maximized
& MAX_VERTICAL
) ?
506 wwin
->old_geometry
.y
: wwin
->frame_y
;
507 wwin
->flags
.maximized
= 0;
508 wWindowConfigure(wwin
, restore_x
, restore_y
,
509 wwin
->old_geometry
.width
, wwin
->old_geometry
.height
);
512 wGNOMEUpdateClientStateHint(wwin
, False
);
515 wKWMUpdateClientStateHint(wwin
, KWMMaximizedFlag
);
516 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
520 wSoundPlay(WMSOUND_UNMAXIMIZE
);
526 animateResizeFlip(WScreen
*scr
, int x
, int y
, int w
, int h
,
527 int fx
, int fy
, int fw
, int fh
, int steps
)
529 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_F)
530 float cx
, cy
, cw
, ch
;
531 float xstep
, ystep
, wstep
, hstep
;
534 float angle
, final_angle
, delta
;
536 xstep
= (float)(fx
-x
)/steps
;
537 ystep
= (float)(fy
-y
)/steps
;
538 wstep
= (float)(fw
-w
)/steps
;
539 hstep
= (float)(fh
-h
)/steps
;
546 final_angle
= 2*WM_PI
*MINIATURIZE_ANIMATION_TWIST_F
;
547 delta
= (float)(final_angle
/FRAMES
);
548 for (angle
=0;; angle
+=delta
) {
549 if (angle
> final_angle
)
552 dx
= (cw
/10) - ((cw
/5) * sin(angle
));
553 dch
= (ch
/2) * cos(angle
);
556 points
[0].x
= cx
+ dx
; points
[0].y
= midy
- dch
;
557 points
[1].x
= cx
+ cw
- dx
; points
[1].y
= points
[0].y
;
558 points
[2].x
= cx
+ cw
+ dx
; points
[2].y
= midy
+ dch
;
559 points
[3].x
= cx
- dx
; points
[3].y
= points
[2].y
;
560 points
[4].x
= points
[0].x
; points
[4].y
= points
[0].y
;
563 XDrawLines(dpy
,scr
->root_win
,scr
->frame_gc
,points
, 5, CoordModeOrigin
);
565 #if (MINIATURIZE_ANIMATION_DELAY_F > 0)
566 wusleep(MINIATURIZE_ANIMATION_DELAY_F
);
569 XDrawLines(dpy
,scr
->root_win
,scr
->frame_gc
,points
, 5, CoordModeOrigin
);
575 if (angle
>= final_angle
)
585 animateResizeTwist(WScreen
*scr
, int x
, int y
, int w
, int h
,
586 int fx
, int fy
, int fw
, int fh
, int steps
)
588 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_T)
589 float cx
, cy
, cw
, ch
;
590 float xstep
, ystep
, wstep
, hstep
;
592 float angle
, final_angle
, a
, d
, delta
;
599 xstep
= (float)(fx
-x
)/steps
;
600 ystep
= (float)(fy
-y
)/steps
;
601 wstep
= (float)(fw
-w
)/steps
;
602 hstep
= (float)(fh
-h
)/steps
;
609 final_angle
= 2*WM_PI
*MINIATURIZE_ANIMATION_TWIST_T
;
610 delta
= (float)(final_angle
/FRAMES
);
611 for (angle
=0;; angle
+=delta
) {
612 if (angle
> final_angle
)
616 d
= sqrt((cw
/2)*(cw
/2)+(ch
/2)*(ch
/2));
618 points
[0].x
= cx
+cos(angle
-a
)*d
;
619 points
[0].y
= cy
+sin(angle
-a
)*d
;
620 points
[1].x
= cx
+cos(angle
+a
)*d
;
621 points
[1].y
= cy
+sin(angle
+a
)*d
;
622 points
[2].x
= cx
+cos(angle
-a
+WM_PI
)*d
;
623 points
[2].y
= cy
+sin(angle
-a
+WM_PI
)*d
;
624 points
[3].x
= cx
+cos(angle
+a
+WM_PI
)*d
;
625 points
[3].y
= cy
+sin(angle
+a
+WM_PI
)*d
;
626 points
[4].x
= cx
+cos(angle
-a
)*d
;
627 points
[4].y
= cy
+sin(angle
-a
)*d
;
629 XDrawLines(dpy
, scr
->root_win
, scr
->frame_gc
, points
, 5, CoordModeOrigin
);
631 #if (MINIATURIZE_ANIMATION_DELAY_T > 0)
632 wusleep(MINIATURIZE_ANIMATION_DELAY_T
);
635 XDrawLines(dpy
, scr
->root_win
, scr
->frame_gc
, points
, 5, CoordModeOrigin
);
641 if (angle
>= final_angle
)
651 animateResizeZoom(WScreen
*scr
, int x
, int y
, int w
, int h
,
652 int fx
, int fy
, int fw
, int fh
, int steps
)
654 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_Z)
655 float cx
[FRAMES
], cy
[FRAMES
], cw
[FRAMES
], ch
[FRAMES
];
656 float xstep
, ystep
, wstep
, hstep
;
659 xstep
= (float)(fx
-x
)/steps
;
660 ystep
= (float)(fy
-y
)/steps
;
661 wstep
= (float)(fw
-w
)/steps
;
662 hstep
= (float)(fh
-h
)/steps
;
664 for (j
=0; j
<FRAMES
; j
++) {
671 for (i
=0; i
<steps
; i
++) {
672 for (j
=0; j
<FRAMES
; j
++) {
673 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
674 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
677 #if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
678 wusleep(MINIATURIZE_ANIMATION_DELAY_Z
);
680 for (j
=0; j
<FRAMES
; j
++) {
681 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
682 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
697 for (j
=0; j
<FRAMES
; j
++) {
698 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
699 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
702 #if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
703 wusleep(MINIATURIZE_ANIMATION_DELAY_Z
);
705 for (j
=0; j
<FRAMES
; j
++) {
706 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
707 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
716 animateResize(WScreen
*scr
, int x
, int y
, int w
, int h
,
717 int fx
, int fy
, int fw
, int fh
, int hiding
)
719 int style
= wPreferences
.iconification_style
; /* Catch the value */
722 if (style
== WIS_NONE
)
725 if (style
== WIS_RANDOM
) {
729 k
= (hiding
? 2 : 3);
732 steps
= (MINIATURIZE_ANIMATION_STEPS_T
* k
)/3;
734 animateResizeTwist(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
737 steps
= (MINIATURIZE_ANIMATION_STEPS_F
* k
)/3;
739 animateResizeFlip(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
743 steps
= (MINIATURIZE_ANIMATION_STEPS_Z
* k
)/3;
745 animateResizeZoom(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
749 #endif /* ANIMATIONS */
757 while (XCheckTypedEvent(dpy
, Expose
, &tmpev
))
758 WMHandleEvent(&tmpev
);
763 unmapTransientsFor(WWindow
*wwin
)
768 tmp
= wwin
->screen_ptr
->focused_window
;
770 /* unmap the transients for this transient */
771 if (tmp
!=wwin
&& tmp
->transient_for
== wwin
->client_win
772 && (tmp
->flags
.mapped
|| wwin
->screen_ptr
->flags
.startup
773 || tmp
->flags
.shaded
)) {
774 unmapTransientsFor(tmp
);
775 tmp
->flags
.miniaturized
= 1;
776 if (!tmp
->flags
.shaded
) {
779 XUnmapWindow(dpy
, tmp
->frame
->core
->window
);
782 if (!tmp->flags.shaded)
784 wClientSetState(tmp
, IconicState
, None
);
786 wKWMUpdateClientStateHint(tmp
, KWMIconifiedFlag
);
787 wKWMSendEventMessage(tmp
, WKWMRemoveWindow
);
788 tmp
->flags
.kwm_hidden_for_modules
= 1;
791 UpdateSwitchMenu(wwin
->screen_ptr
, tmp
, ACTION_CHANGE_STATE
);
800 mapTransientsFor(WWindow
*wwin
)
804 tmp
= wwin
->screen_ptr
->focused_window
;
806 /* recursively map the transients for this transient */
807 if (tmp
!=wwin
&& tmp
->transient_for
== wwin
->client_win
808 && /*!tmp->flags.mapped*/ tmp
->flags
.miniaturized
809 && tmp
->icon
==NULL
) {
810 mapTransientsFor(tmp
);
811 tmp
->flags
.miniaturized
= 0;
812 if (!tmp
->flags
.shaded
) {
815 XMapWindow(dpy
, tmp
->frame
->core
->window
);
817 tmp
->flags
.semi_focused
= 0;
819 if (!tmp->flags.shaded)
821 wClientSetState(tmp
, NormalState
, None
);
823 wKWMUpdateClientStateHint(tmp
, KWMIconifiedFlag
);
824 if (tmp
->flags
.kwm_hidden_for_modules
) {
825 wKWMSendEventMessage(tmp
, WKWMAddWindow
);
826 tmp
->flags
.kwm_hidden_for_modules
= 0;
830 UpdateSwitchMenu(wwin
->screen_ptr
, tmp
, ACTION_CHANGE_STATE
);
839 setupIconGrabs(WIcon
*icon
)
841 /* setup passive grabs on the icon */
842 XGrabButton(dpy
, Button1
, AnyModifier
, icon
->core
->window
, True
,
843 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
844 XGrabButton(dpy
, Button2
, AnyModifier
, icon
->core
->window
, True
,
845 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
846 XGrabButton(dpy
, Button3
, AnyModifier
, icon
->core
->window
, True
,
847 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
853 recursiveTransientFor(WWindow
*wwin
)
860 /* hackish way to detect transient_for cycle */
861 i
= wwin
->screen_ptr
->window_count
+1;
863 while (wwin
&& wwin
->transient_for
!= None
&& i
>0) {
864 wwin
= wWindowFor(wwin
->transient_for
);
868 wwarning("%s has a severely broken WM_TRANSIENT_FOR hint.",
878 removeIconGrabs(WIcon
*icon
)
880 /* remove passive grabs on the icon */
881 XUngrabButton(dpy
, Button1
, AnyModifier
, icon
->core
->window
);
882 XUngrabButton(dpy
, Button2
, AnyModifier
, icon
->core
->window
);
883 XUngrabButton(dpy
, Button3
, AnyModifier
, icon
->core
->window
);
890 wIconifyWindow(WWindow
*wwin
)
892 XWindowAttributes attribs
;
896 if (!XGetWindowAttributes(dpy
, wwin
->client_win
, &attribs
)) {
897 /* the window doesn't exist anymore */
901 if (wwin
->flags
.miniaturized
) {
906 if (wwin
->transient_for
!=None
) {
907 WWindow
*owner
= wWindowFor(wwin
->transient_for
);
909 if (owner
&& owner
->flags
.miniaturized
)
913 present
= wwin
->frame
->workspace
==wwin
->screen_ptr
->current_workspace
;
915 /* if the window is in another workspace, simplify process */
917 /* icon creation may take a while */
918 XGrabPointer(dpy
, wwin
->screen_ptr
->root_win
, False
,
919 ButtonMotionMask
|ButtonReleaseMask
, GrabModeAsync
,
920 GrabModeAsync
, None
, None
, CurrentTime
);
923 if (!wPreferences
.disable_miniwindows
) {
924 if (!wwin
->flags
.icon_moved
) {
925 PlaceIcon(wwin
->screen_ptr
, &wwin
->icon_x
, &wwin
->icon_y
);
927 wwin
->icon
= wIconCreate(wwin
);
930 wwin
->flags
.miniaturized
= 1;
931 wwin
->flags
.mapped
= 0;
933 /* unmap transients */
935 unmapTransientsFor(wwin
);
939 wSoundPlay(WMSOUND_ICONIFY
);
942 XUngrabPointer(dpy
, CurrentTime
);
944 /* let all Expose events arrive so that we can repaint
945 * something before the animation starts (and the server is grabbed) */
948 if (wPreferences
.disable_miniwindows
)
949 wClientSetState(wwin
, IconicState
, None
);
951 wClientSetState(wwin
, IconicState
, wwin
->icon
->icon_win
);
955 if (!wwin
->screen_ptr
->flags
.startup
&& !wwin
->flags
.skip_next_animation
956 && !wPreferences
.no_animations
) {
959 if (!wPreferences
.disable_miniwindows
) {
962 iw
= wwin
->icon
->core
->width
;
963 ih
= wwin
->icon
->core
->height
;
968 if (wKWMGetIconGeometry(wwin
, &area
)) {
974 #endif /* KWM_HINTS */
978 iw
= wwin
->screen_ptr
->scr_width
;
979 ih
= wwin
->screen_ptr
->scr_height
;
982 animateResize(wwin
->screen_ptr
, wwin
->frame_x
, wwin
->frame_y
,
983 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
984 ix
, iy
, iw
, ih
, False
);
989 wwin
->flags
.skip_next_animation
= 0;
991 if (!wPreferences
.disable_miniwindows
) {
993 if (wwin
->screen_ptr
->current_workspace
==wwin
->frame
->workspace
||
994 IS_OMNIPRESENT(wwin
) || wPreferences
.sticky_icons
)
996 XMapWindow(dpy
, wwin
->icon
->core
->window
);
998 AddToStackList(wwin
->icon
->core
);
1000 wLowerFrame(wwin
->icon
->core
);
1004 WWindow
*owner
= recursiveTransientFor(wwin
->screen_ptr
->focused_window
);
1007 * It doesn't seem to be working and causes button event hangup
1008 * when deiconifying a transient window.
1009 setupIconGrabs(wwin->icon);
1011 if ((wwin
->flags
.focused
1012 || (owner
&& wwin
->client_win
== owner
->client_win
))
1013 && wPreferences
.focus_mode
==WKF_CLICK
) {
1018 if (!WFLAGP(tmp
, no_focusable
)
1019 && !(tmp
->flags
.hidden
||tmp
->flags
.miniaturized
))
1023 wSetFocusTo(wwin
->screen_ptr
, tmp
);
1024 } else if (wPreferences
.focus_mode
!=WKF_CLICK
) {
1025 wSetFocusTo(wwin
->screen_ptr
, NULL
);
1029 if (!wwin
->screen_ptr
->flags
.startup
) {
1030 Window clientwin
= wwin
->client_win
;
1033 processEvents(XPending(dpy
));
1035 /* the window can disappear while doing the processEvents() */
1036 if (!wWindowFor(clientwin
))
1043 if (wwin
->flags
.selected
&& !wPreferences
.disable_miniwindows
)
1044 wIconSelect(wwin
->icon
);
1047 wGNOMEUpdateClientStateHint(wwin
, False
);
1050 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
1051 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
1054 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1061 wDeiconifyWindow(WWindow
*wwin
)
1063 wWindowChangeWorkspace(wwin
, wwin
->screen_ptr
->current_workspace
);
1065 if (!wwin
->flags
.miniaturized
)
1068 if (wwin
->transient_for
!= None
1069 && wwin
->transient_for
!= wwin
->screen_ptr
->root_win
) {
1070 WWindow
*owner
= recursiveTransientFor(wwin
);
1072 if (owner
&& owner
->flags
.miniaturized
) {
1073 wDeiconifyWindow(owner
);
1074 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1075 wRaiseFrame(wwin
->frame
->core
);
1080 wwin
->flags
.miniaturized
= 0;
1081 if (!wwin
->flags
.shaded
)
1082 wwin
->flags
.mapped
= 1;
1084 if (!wPreferences
.disable_miniwindows
) {
1085 if (wwin
->icon
->selected
)
1086 wIconSelect(wwin
->icon
);
1088 XUnmapWindow(dpy
, wwin
->icon
->core
->window
);
1092 wSoundPlay(WMSOUND_DEICONIFY
);
1095 /* if the window is in another workspace, do it silently */
1097 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
1098 && !wwin
->flags
.skip_next_animation
) {
1101 if (!wPreferences
.disable_miniwindows
) {
1104 iw
= wwin
->icon
->core
->width
;
1105 ih
= wwin
->icon
->core
->height
;
1110 if (wKWMGetIconGeometry(wwin
, &area
)) {
1116 #endif /* KWM_HINTS */
1120 iw
= wwin
->screen_ptr
->scr_width
;
1121 ih
= wwin
->screen_ptr
->scr_height
;
1124 animateResize(wwin
->screen_ptr
, ix
, iy
, iw
, ih
,
1125 wwin
->frame_x
, wwin
->frame_y
,
1126 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1129 #endif /* ANIMATIONS */
1130 wwin
->flags
.skip_next_animation
= 0;
1132 if (!wwin
->flags
.shaded
) {
1133 XMapWindow(dpy
, wwin
->client_win
);
1135 XMapWindow(dpy
, wwin
->frame
->core
->window
);
1136 wRaiseFrame(wwin
->frame
->core
);
1137 if (!wwin
->flags
.shaded
) {
1138 wClientSetState(wwin
, NormalState
, None
);
1140 mapTransientsFor(wwin
);
1142 if (!wPreferences
.disable_miniwindows
) {
1143 RemoveFromStackList(wwin
->icon
->core
);
1144 /* removeIconGrabs(wwin->icon);*/
1145 wIconDestroy(wwin
->icon
);
1149 if (wPreferences
.focus_mode
==WKF_CLICK
1150 || wPreferences
.focus_mode
==WKF_SLOPPY
)
1151 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1154 if (!wwin
->screen_ptr
->flags
.startup
) {
1155 Window clientwin
= wwin
->client_win
;
1158 processEvents(XPending(dpy
));
1160 if (!wWindowFor(clientwin
))
1165 if (wPreferences
.auto_arrange_icons
) {
1166 wArrangeIcons(wwin
->screen_ptr
, True
);
1170 wGNOMEUpdateClientStateHint(wwin
, False
);
1173 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
1174 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
1177 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1183 hideWindow(WIcon
*icon
, int icon_x
, int icon_y
, WWindow
*wwin
, int animate
)
1185 if (wwin
->flags
.miniaturized
) {
1187 XUnmapWindow(dpy
, wwin
->icon
->core
->window
);
1188 wwin
->icon
->mapped
= 0;
1190 wwin
->flags
.hidden
= 1;
1192 wGNOMEUpdateClientStateHint(wwin
, False
);
1195 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1200 if (wwin
->flags
.inspector_open
) {
1201 WWindow
*pwin
= wwin
->inspector
->frame
;
1204 pwin
->flags
.hidden
= 1;
1206 wClientSetState(pwin
, IconicState
, icon
->icon_win
);
1209 wwin
->flags
.hidden
= 1;
1212 wClientSetState(wwin
, IconicState
, icon
->icon_win
);
1215 wSoundPlay(WMSOUND_HIDE
);
1218 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
&&
1219 !wwin
->flags
.skip_next_animation
&& animate
) {
1220 animateResize(wwin
->screen_ptr
, wwin
->frame_x
, wwin
->frame_y
,
1221 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1222 icon_x
, icon_y
, icon
->core
->width
, icon
->core
->height
,
1226 wwin
->flags
.skip_next_animation
= 0;
1229 wGNOMEUpdateClientStateHint(wwin
, False
);
1232 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1238 wHideOtherApplications(WWindow
*awin
)
1242 #ifdef REDUCE_APPICONS
1243 char *tinstance
, *tclass
;
1244 unsigned int brokenwin
= 0, match
= 0;
1249 wwin
= awin
->screen_ptr
->focused_window
;
1251 #ifdef REDUCE_APPICONS
1252 if (awin
->wm_instance
== NULL
|| awin
->wm_class
== NULL
)
1258 && wwin
->frame
->workspace
== awin
->screen_ptr
->current_workspace
1259 && !(wwin
->flags
.miniaturized
||wwin
->flags
.hidden
)
1260 && !wwin
->flags
.internal_window
1261 && (!wwin
->flags
.inspector_open
|| wwin
->inspector
->frame
!=awin
)
1262 && !WFLAGP(wwin
, no_hide_others
)) {
1264 #ifdef REDUCE_APPICONS
1267 if ((tinstance
= wwin
->wm_instance
) == NULL
)
1269 if ((tclass
= wwin
->wm_class
) == NULL
)
1271 if ((strcmp(awin
->wm_instance
, tinstance
) == 0) &&
1272 (strcmp(awin
->wm_class
, tclass
) == 0) )
1277 if (wwin
->main_window
==None
|| WFLAGP(wwin
, no_appicon
)) {
1278 if (!WFLAGP(wwin
, no_miniaturizable
)) {
1279 wwin
->flags
.skip_next_animation
= 1;
1280 wIconifyWindow(wwin
);
1282 } else if (wwin
->main_window
!=None
1283 #ifndef REDUCE_APPICONS
1284 && awin
->main_window
!= wwin
->main_window
) {
1286 && (awin
->main_window
!= wwin
->main_window
&& !match
)) {
1288 tapp
= wApplicationOf(wwin
->main_window
);
1290 tapp
->flags
.skip_next_animation
= 1;
1291 wHideApplication(tapp
);
1293 if (!WFLAGP(wwin
, no_miniaturizable
)) {
1294 wwin
->flags
.skip_next_animation
= 1;
1295 wIconifyWindow(wwin
);
1303 wSetFocusTo(awin->screen_ptr, awin);
1310 wHideApplication(WApplication
*wapp
)
1312 #ifdef REDUCE_APPICONS
1314 char *tinstance
, *tclass
;
1315 unsigned int nowmhints
= 0, matchwmhints
= 0, matchworkspace
= 0;
1322 wwarning("trying to hide a non grouped window");
1325 if (!wapp
->main_window_desc
) {
1326 wwarning("group leader not found for window group");
1329 #ifdef REDUCE_APPICONS
1330 if ((wapp
->main_window_desc
->wm_instance
== NULL
) ||
1331 (wapp
->main_window_desc
->wm_class
== NULL
))
1334 scr
= wapp
->main_window_desc
->screen_ptr
;
1336 wlist
= scr
->focused_window
;
1340 if (wlist
->main_window
== wapp
->main_window
)
1341 wapp
->last_focused
= wlist
;
1343 wapp
->last_focused
= NULL
;
1345 #ifdef REDUCE_APPICONS
1346 matchwmhints
= matchworkspace
= 0;
1348 tapp
= wApplicationOf(wlist
->main_window
);
1349 tinstance
= tclass
= NULL
;
1351 if (tapp
->main_window_desc
) {
1352 tinstance
= tapp
->main_window_desc
->wm_instance
;
1353 tclass
= tapp
->main_window_desc
->wm_class
;
1356 if (tapp
== NULL
|| tinstance
== NULL
|| tclass
== NULL
) {
1357 /* Should never reach here */
1361 if ((strcmp(tinstance
, wapp
->main_window_desc
->wm_instance
) == 0) &&
1362 (strcmp(tclass
, wapp
->main_window_desc
->wm_class
) == 0) )
1366 if (wlist
->frame
->workspace
== wapp
->main_window_desc
->screen_ptr
->current_workspace
)
1369 if ((wlist
->main_window
== wapp
->main_window
|| matchwmhints
) &&
1375 if (wlist
->main_window
== wapp
->main_window
) {
1377 if (wlist
->flags
.focused
) {
1381 hideWindow(wapp
->app_icon
->icon
, wapp
->app_icon
->x_pos
,
1382 wapp
->app_icon
->y_pos
, wlist
,
1383 !wapp
->flags
.skip_next_animation
);
1385 wlist
= wlist
->prev
;
1388 wapp
->flags
.skip_next_animation
= 0;
1391 if (wPreferences
.focus_mode
==WKF_CLICK
) {
1392 wlist
= scr
->focused_window
;
1394 if (!WFLAGP(wlist
, no_focusable
) && !wlist
->flags
.hidden
1395 && (wlist
->flags
.mapped
|| wlist
->flags
.shaded
))
1397 wlist
= wlist
->prev
;
1399 wSetFocusTo(scr
, wlist
);
1401 wSetFocusTo(scr
, NULL
);
1405 wapp
->flags
.hidden
= 1;
1407 if(wPreferences
.auto_arrange_icons
) {
1408 wArrangeIcons(scr
, True
);
1412 wAppIconPaint(wapp
->app_icon
);
1420 unhideWindow(WIcon
*icon
, int icon_x
, int icon_y
, WWindow
*wwin
, int animate
,
1421 int bringToCurrentWS
)
1423 if (bringToCurrentWS
)
1424 wWindowChangeWorkspace(wwin
, wwin
->screen_ptr
->current_workspace
);
1426 wwin
->flags
.hidden
=0;
1427 wwin
->flags
.mapped
=1;
1430 wSoundPlay(WMSOUND_UNHIDE
);
1433 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
1435 animateResize(wwin
->screen_ptr
, icon_x
, icon_y
,
1436 icon
->core
->width
, icon
->core
->height
,
1437 wwin
->frame_x
, wwin
->frame_y
,
1438 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1442 wwin
->flags
.skip_next_animation
= 0;
1443 XMapWindow(dpy
, wwin
->client_win
);
1444 XMapWindow(dpy
, wwin
->frame
->core
->window
);
1445 wClientSetState(wwin
, NormalState
, None
);
1446 wRaiseFrame(wwin
->frame
->core
);
1447 if (wwin
->flags
.inspector_open
) {
1448 WWindow
*pwin
= wwin
->inspector
->frame
;
1450 pwin
->flags
.hidden
= 0;
1451 pwin
->flags
.mapped
= 1;
1452 XMapWindow(dpy
, pwin
->client_win
);
1453 XMapWindow(dpy
, pwin
->frame
->core
->window
);
1454 wClientSetState(pwin
, NormalState
, None
);
1458 wGNOMEUpdateClientStateHint(wwin
, False
);
1461 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1467 wUnhideApplication(WApplication
*wapp
, Bool miniwindows
, Bool bringToCurrentWS
)
1470 WWindow
*wlist
, *next
;
1471 WWindow
*focused
=NULL
;
1472 #ifdef REDUCE_APPICONS
1473 char *tinstance
, *tclass
;
1474 unsigned int nowmhints
= 0, matchwmhints
= 0, matchworkspace
= 0;
1481 #ifdef REDUCE_APPICONS
1482 if ((wapp
->main_window_desc
->wm_class
== NULL
) ||
1483 (wapp
->main_window_desc
->wm_instance
== NULL
))
1487 scr
= wapp
->main_window_desc
->screen_ptr
;
1488 wlist
= scr
->focused_window
;
1490 /* goto beginning of list */
1492 wlist
= wlist
->prev
;
1497 #ifndef REDUCE_APPICONS
1498 if (wlist
->main_window
== wapp
->main_window
) {
1500 matchwmhints
= matchworkspace
= 0;
1502 if ((tinstance
= wlist
->wm_instance
) == NULL
)
1504 if ((tclass
= wlist
->wm_class
) == NULL
)
1506 if ((strcmp(tinstance
, wapp
->main_window_desc
->wm_instance
) == 0)
1507 && (strcmp(tclass
, wapp
->main_window_desc
->wm_class
) == 0) )
1511 if (wlist
->frame
->workspace
== wapp
->main_window_desc
->screen_ptr
->current_workspace
)
1515 if ((wlist
->main_window
== wapp
->main_window
|| matchwmhints
) &&
1518 if (wlist
->flags
.focused
)
1520 else if (!focused
|| !focused
->flags
.focused
)
1523 if (wlist
->flags
.miniaturized
&& wlist
->icon
) {
1524 if (bringToCurrentWS
|| wPreferences
.sticky_icons
1525 || wlist
->frame
->workspace
== scr
->current_workspace
) {
1526 if (!wlist
->icon
->mapped
) {
1527 XMapWindow(dpy
, wlist
->icon
->core
->window
);
1528 wlist
->icon
->mapped
= 1;
1530 wlist
->flags
.hidden
= 0;
1532 UpdateSwitchMenu(scr
, wlist
, ACTION_CHANGE_STATE
);
1534 if (wlist
->frame
->workspace
!= scr
->current_workspace
)
1535 wWindowChangeWorkspace(wlist
, scr
->current_workspace
);
1538 wDeiconifyWindow(wlist
);
1540 } else if (wlist
->flags
.hidden
) {
1541 unhideWindow(wapp
->app_icon
->icon
, wapp
->app_icon
->x_pos
,
1542 wapp
->app_icon
->y_pos
, wlist
,
1543 !wapp
->flags
.skip_next_animation
,
1546 if (bringToCurrentWS
1547 && wlist
->frame
->workspace
!= scr
->current_workspace
) {
1548 wWindowChangeWorkspace(wlist
, scr
->current_workspace
);
1550 wRaiseFrame(wlist
->frame
->core
);
1556 wapp
->flags
.skip_next_animation
= 0;
1557 wapp
->flags
.hidden
= 0;
1560 wSetFocusTo(scr
, focused
);
1561 else if (wapp
->last_focused
&& wapp
->last_focused
->flags
.mapped
)
1562 wSetFocusTo(scr
, wapp
->last_focused
);
1563 wapp
->last_focused
= NULL
;
1564 if (wPreferences
.auto_arrange_icons
) {
1565 wArrangeIcons(scr
, True
);
1568 wAppIconPaint(wapp
->app_icon
);
1575 wShowAllWindows(WScreen
*scr
)
1577 WWindow
*wwin
, *old_foc
;
1580 old_foc
= wwin
= scr
->focused_window
;
1582 if (!wwin
->flags
.internal_window
&&
1583 (scr
->current_workspace
== wwin
->frame
->workspace
1584 || IS_OMNIPRESENT(wwin
))) {
1585 if (wwin
->flags
.miniaturized
) {
1586 wwin
->flags
.skip_next_animation
= 1;
1587 wDeiconifyWindow(wwin
);
1588 } else if (wwin
->flags
.hidden
) {
1589 wapp
= wApplicationOf(wwin
->main_window
);
1591 wUnhideApplication(wapp
, False
, False
);
1593 wwin
->flags
.skip_next_animation
= 1;
1594 wDeiconifyWindow(wwin
);
1600 wSetFocusTo(scr
, old_foc
);
1601 /*wRaiseFrame(old_foc->frame->core);*/
1606 wRefreshDesktop(WScreen
*scr
)
1609 XSetWindowAttributes attr
;
1611 attr
.backing_store
= NotUseful
;
1612 attr
.save_under
= False
;
1613 win
= XCreateWindow(dpy
, scr
->root_win
, 0, 0, scr
->scr_width
,
1614 scr
->scr_height
, 0, CopyFromParent
, CopyFromParent
,
1615 (Visual
*)CopyFromParent
, CWBackingStore
|CWSaveUnder
,
1617 XMapRaised(dpy
, win
);
1618 XDestroyWindow(dpy
, win
);
1624 wArrangeIcons(WScreen
*scr
, Bool arrangeAll
)
1628 int pf
; /* primary axis */
1629 int sf
; /* secondary axis */
1633 int sx1
, sx2
, sy1
, sy2
; /* screen boundary */
1637 int isize
= wPreferences
.icon_size
;
1640 * Find out screen boundaries.
1644 sx2
= scr
->scr_width
;
1645 sy2
= scr
->scr_height
;
1647 if (scr
->dock
->on_right_side
)
1648 sx2
-= isize
+ DOCK_EXTRA_SPACE
;
1650 sx1
+= isize
+ DOCK_EXTRA_SPACE
;
1653 sw
= isize
* (scr
->scr_width
/isize
);
1654 sh
= isize
* (scr
->scr_height
/isize
);
1655 fullW
= (sx2
-sx1
)/isize
;
1656 fullH
= (sy2
-sy1
)/isize
;
1658 /* icon yard boundaries */
1659 if (wPreferences
.icon_yard
& IY_VERT
) {
1666 if (wPreferences
.icon_yard
& IY_RIGHT
) {
1673 if (wPreferences
.icon_yard
& IY_TOP
) {
1681 /* arrange icons putting the most recently focused window
1682 * as the last icon */
1683 #define X ((wPreferences.icon_yard & IY_VERT) ? xo + xs*(si*isize)\
1684 : xo + xs*(pi*isize))
1685 #define Y ((wPreferences.icon_yard & IY_VERT) ? yo + ys*(pi*isize)\
1686 : yo + ys*(si*isize))
1688 /* arrange application icons */
1689 aicon
= scr
->app_icon_list
;
1690 /* reverse them to avoid unnecessarily sliding of icons */
1691 while (aicon
&& aicon
->next
)
1692 aicon
= aicon
->next
;
1697 if (!aicon
->docked
) {
1698 if (aicon
->x_pos
!= X
|| aicon
->y_pos
!= Y
) {
1700 if (!wPreferences
.no_animations
) {
1701 SlideWindow(aicon
->icon
->core
->window
, aicon
->x_pos
, aicon
->y_pos
,
1704 #endif /* ANIMATIONS */
1706 wAppIconMove(aicon
, X
, Y
);
1709 /* we reversed the order so we use prev */
1710 aicon
= aicon
->prev
;
1717 /* arrange miniwindows */
1719 wwin
= scr
->focused_window
;
1720 /* reverse them to avoid unnecessarily shuffling */
1721 while (wwin
&& wwin
->prev
)
1725 if (wwin
->icon
&& wwin
->flags
.miniaturized
&&/*!wwin->flags.hidden &&*/
1726 (wwin
->frame
->workspace
==scr
->current_workspace
||
1727 IS_OMNIPRESENT(wwin
) || wPreferences
.sticky_icons
)) {
1729 if (arrangeAll
|| !wwin
->flags
.icon_moved
) {
1730 if (wwin
->icon_x
!= X
|| wwin
->icon_y
!= Y
) {
1732 if (wPreferences
.no_animations
) {
1733 XMoveWindow(dpy
, wwin
->icon
->core
->window
, X
, Y
);
1735 SlideWindow(wwin
->icon
->core
->window
, wwin
->icon_x
,
1736 wwin
->icon_y
, X
, Y
);
1739 XMoveWindow(dpy
, wwin
->icon
->core
->window
, X
, Y
);
1740 #endif /* ANIMATIONS */
1748 wwin
->flags
.icon_moved
= 0;
1750 /* we reversed the order, so we use next */
1761 wSelectWindow(WWindow
*wwin
, Bool flag
)
1763 WScreen
*scr
= wwin
->screen_ptr
;
1765 wwin
->flags
.selected
= 1;
1766 XSetWindowBorder(dpy
, wwin
->frame
->core
->window
, scr
->white_pixel
);
1767 scr
->selected_windows
= list_cons(wwin
, scr
->selected_windows
);
1769 wwin
->flags
.selected
= 0;
1770 XSetWindowBorder(dpy
, wwin
->frame
->core
->window
,
1771 scr
->frame_border_pixel
);
1772 scr
->selected_windows
= list_remove_elem(scr
->selected_windows
, wwin
);
1778 wMakeWindowVisible(WWindow
*wwin
)
1780 wWorkspaceChange(wwin
->screen_ptr
, wwin
->frame
->workspace
);
1782 if (wwin
->flags
.shaded
) {
1783 wUnshadeWindow(wwin
);
1785 if (wwin
->flags
.hidden
) {
1788 app
= wApplicationOf(wwin
->main_window
);
1790 wUnhideApplication(app
, False
, False
);
1791 } else if (wwin
->flags
.miniaturized
) {
1792 wDeiconifyWindow(wwin
);
1794 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1795 wRaiseFrame(wwin
->frame
->core
);