1 /* action.c- misc. window commands (miniaturize, hide etc.)
3 * Window Maker window manager
5 * Copyright (c) 1997, 1998 Alfredo K. Kojima
6 * Copyright (c) 1998 Dan Pascu
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
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 wAppMenuMap(napp
->menu
, wwin
);
240 wApplicationActivate(napp
);
244 wKWMUpdateActiveWindowHint(scr
);
245 wKWMSendEventMessage(wwin
, WKWMFocusWindow
);
252 wShadeWindow(WWindow
*wwin
)
254 time_t time0
= time(NULL
);
259 if (wwin
->flags
.shaded
)
262 XLowerWindow(dpy
, wwin
->client_win
);
265 wSoundPlay(WMSOUND_SHADE
);
269 if (!wwin
->screen_ptr
->flags
.startup
&& !wwin
->flags
.skip_next_animation
270 && !wPreferences
.no_animations
) {
271 /* do the shading animation */
272 h
= wwin
->frame
->core
->height
;
275 w
= wwin
->frame
->core
->width
;
276 y
= wwin
->frame
->top_width
;
277 while (h
>wwin
->frame
->top_width
+1) {
278 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
279 XResizeWindow(dpy
, wwin
->frame
->core
->window
, w
, h
);
282 if (time(NULL
)-time0
> MAX_ANIMATION_TIME
)
286 wusleep(SHADE_DELAY
*1000L);
290 XMoveWindow(dpy
, wwin
->client_win
, 0, wwin
->frame
->top_width
);
292 #endif /* ANIMATIONS */
294 wwin
->flags
.skip_next_animation
= 0;
295 wwin
->flags
.shaded
= 1;
296 wwin
->flags
.mapped
= 0;
297 /* prevent window withdrawal when getting UnmapNotify */
298 XSelectInput(dpy
, wwin
->client_win
,
299 wwin
->event_mask
& ~StructureNotifyMask
);
300 XUnmapWindow(dpy
, wwin
->client_win
);
301 XSelectInput(dpy
, wwin
->client_win
, wwin
->event_mask
);
303 /* for the client it's just like iconification */
304 wFrameWindowResize(wwin
->frame
, wwin
->frame
->core
->width
,
305 wwin
->frame
->top_width
- 1);
307 wwin
->client
.y
= wwin
->frame_y
- wwin
->client
.height
308 + wwin
->frame
->top_width
;
309 wWindowSynthConfigureNotify(wwin
);
312 wClientSetState(wwin, IconicState, None);
316 wGNOMEUpdateClientStateHint(wwin
, False
);
319 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
320 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
322 /* update window list to reflect shaded state */
323 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
326 if (!wwin
->screen_ptr
->flags
.startup
) {
327 /* Look at processEvents() for reason of this code. */
329 processEvents(XPending(dpy
));
336 wUnshadeWindow(WWindow
*wwin
)
338 time_t time0
= time(NULL
);
341 #endif /* ANIMATIONS */
344 if (!wwin
->flags
.shaded
)
347 wwin
->flags
.shaded
= 0;
348 wwin
->flags
.mapped
= 1;
349 XMapWindow(dpy
, wwin
->client_win
);
352 wSoundPlay(WMSOUND_UNSHADE
);
356 if (!wPreferences
.no_animations
&& !wwin
->flags
.skip_next_animation
) {
357 /* do the shading animation */
358 h
= wwin
->frame
->top_width
+ wwin
->frame
->bottom_width
;
359 y
= wwin
->frame
->top_width
- wwin
->client
.height
;
360 s
= abs(y
)/SHADE_STEPS
;
362 w
= wwin
->frame
->core
->width
;
363 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
365 while (h
< wwin
->client
.height
+ wwin
->frame
->top_width
366 + wwin
->frame
->bottom_width
) {
367 XResizeWindow(dpy
, wwin
->frame
->core
->window
, w
, h
);
368 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
371 wusleep(SHADE_DELAY
*2000L/3);
375 if (time(NULL
)-time0
> MAX_ANIMATION_TIME
)
379 XMoveWindow(dpy
, wwin
->client_win
, 0, wwin
->frame
->top_width
);
381 #endif /* ANIMATIONS */
383 wwin
->flags
.skip_next_animation
= 0;
384 wFrameWindowResize(wwin
->frame
, wwin
->frame
->core
->width
,
385 wwin
->frame
->top_width
+ wwin
->client
.height
386 + wwin
->frame
->bottom_width
);
388 wwin
->client
.y
= wwin
->frame_y
+ wwin
->frame
->top_width
;
389 wWindowSynthConfigureNotify(wwin
);
392 wClientSetState(wwin, NormalState, None);
394 /* if the window is focused, set the focus again as it was disabled during
396 if (wwin
->flags
.focused
)
397 wSetFocusTo(wwin
->screen_ptr
, wwin
);
400 wGNOMEUpdateClientStateHint(wwin
, False
);
403 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
404 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
407 /* update window list to reflect unshaded state */
408 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
414 wMaximizeWindow(WWindow
*wwin
, int directions
)
416 int new_width
, new_height
, new_x
, new_y
;
417 WArea usableArea
= wwin
->screen_ptr
->totalUsableArea
;
420 if (WFLAGP(wwin
, no_resizable
))
424 if (WFLAGP(wwin
, full_maximize
)) {
427 usableArea
.x2
= wwin
->screen_ptr
->scr_width
;
428 usableArea
.y2
= wwin
->screen_ptr
->scr_height
;
431 if (wwin
->flags
.shaded
) {
432 wwin
->flags
.skip_next_animation
= 1;
433 wUnshadeWindow(wwin
);
435 wwin
->flags
.maximized
= directions
;
436 wwin
->old_geometry
.width
= wwin
->client
.width
;
437 wwin
->old_geometry
.height
= wwin
->client
.height
;
438 wwin
->old_geometry
.x
= wwin
->frame_x
;
439 wwin
->old_geometry
.y
= wwin
->frame_y
;
442 wKWMUpdateClientGeometryRestore(wwin
);
445 if (directions
& MAX_HORIZONTAL
) {
447 new_width
= (usableArea
.x2
-usableArea
.x1
)-FRAME_BORDER_WIDTH
*2;
448 new_x
= usableArea
.x1
;
452 new_x
= wwin
->frame_x
;
453 new_width
= wwin
->frame
->core
->width
;
457 if (directions
& MAX_VERTICAL
) {
459 new_height
= (usableArea
.y2
-usableArea
.y1
)-FRAME_BORDER_WIDTH
*2;
460 new_y
= usableArea
.y1
;
461 if (WFLAGP(wwin
, full_maximize
))
462 new_y
-= wwin
->frame
->top_width
;
466 new_y
= wwin
->frame_y
;
467 new_height
= wwin
->frame
->core
->height
;
471 if (!WFLAGP(wwin
, full_maximize
)) {
472 new_height
-= wwin
->frame
->top_width
+wwin
->frame
->bottom_width
;
475 wWindowConstrainSize(wwin
, &new_width
, &new_height
);
476 wWindowConfigure(wwin
, new_x
, new_y
, new_width
, new_height
);
479 wGNOMEUpdateClientStateHint(wwin
, False
);
482 wKWMUpdateClientStateHint(wwin
, KWMMaximizedFlag
);
483 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
487 wSoundPlay(WMSOUND_MAXIMIZE
);
493 wUnmaximizeWindow(WWindow
*wwin
)
495 int restore_x
, restore_y
;
497 if (!wwin
->flags
.maximized
)
500 if (wwin
->flags
.shaded
) {
501 wwin
->flags
.skip_next_animation
= 1;
502 wUnshadeWindow(wwin
);
504 restore_x
= (wwin
->flags
.maximized
& MAX_HORIZONTAL
) ?
505 wwin
->old_geometry
.x
: wwin
->frame_x
;
506 restore_y
= (wwin
->flags
.maximized
& MAX_VERTICAL
) ?
507 wwin
->old_geometry
.y
: wwin
->frame_y
;
508 wwin
->flags
.maximized
= 0;
509 wWindowConfigure(wwin
, restore_x
, restore_y
,
510 wwin
->old_geometry
.width
, wwin
->old_geometry
.height
);
513 wGNOMEUpdateClientStateHint(wwin
, False
);
516 wKWMUpdateClientStateHint(wwin
, KWMMaximizedFlag
);
517 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
521 wSoundPlay(WMSOUND_UNMAXIMIZE
);
527 animateResizeFlip(WScreen
*scr
, int x
, int y
, int w
, int h
,
528 int fx
, int fy
, int fw
, int fh
, int steps
)
530 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_F)
531 float cx
, cy
, cw
, ch
;
532 float xstep
, ystep
, wstep
, hstep
;
535 float angle
, final_angle
, delta
;
537 xstep
= (float)(fx
-x
)/steps
;
538 ystep
= (float)(fy
-y
)/steps
;
539 wstep
= (float)(fw
-w
)/steps
;
540 hstep
= (float)(fh
-h
)/steps
;
547 final_angle
= 2*WM_PI
*MINIATURIZE_ANIMATION_TWIST_F
;
548 delta
= (float)(final_angle
/FRAMES
);
549 for (angle
=0;; angle
+=delta
) {
550 if (angle
> final_angle
)
553 dx
= (cw
/10) - ((cw
/5) * sin(angle
));
554 dch
= (ch
/2) * cos(angle
);
557 points
[0].x
= cx
+ dx
; points
[0].y
= midy
- dch
;
558 points
[1].x
= cx
+ cw
- dx
; points
[1].y
= points
[0].y
;
559 points
[2].x
= cx
+ cw
+ dx
; points
[2].y
= midy
+ dch
;
560 points
[3].x
= cx
- dx
; points
[3].y
= points
[2].y
;
561 points
[4].x
= points
[0].x
; points
[4].y
= points
[0].y
;
564 XDrawLines(dpy
,scr
->root_win
,scr
->frame_gc
,points
, 5, CoordModeOrigin
);
566 #if (MINIATURIZE_ANIMATION_DELAY_F > 0)
567 wusleep(MINIATURIZE_ANIMATION_DELAY_F
);
570 XDrawLines(dpy
,scr
->root_win
,scr
->frame_gc
,points
, 5, CoordModeOrigin
);
576 if (angle
>= final_angle
)
586 animateResizeTwist(WScreen
*scr
, int x
, int y
, int w
, int h
,
587 int fx
, int fy
, int fw
, int fh
, int steps
)
589 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_T)
590 float cx
, cy
, cw
, ch
;
591 float xstep
, ystep
, wstep
, hstep
;
593 float angle
, final_angle
, a
, d
, delta
;
600 xstep
= (float)(fx
-x
)/steps
;
601 ystep
= (float)(fy
-y
)/steps
;
602 wstep
= (float)(fw
-w
)/steps
;
603 hstep
= (float)(fh
-h
)/steps
;
610 final_angle
= 2*WM_PI
*MINIATURIZE_ANIMATION_TWIST_T
;
611 delta
= (float)(final_angle
/FRAMES
);
612 for (angle
=0;; angle
+=delta
) {
613 if (angle
> final_angle
)
617 d
= sqrt((cw
/2)*(cw
/2)+(ch
/2)*(ch
/2));
619 points
[0].x
= cx
+cos(angle
-a
)*d
;
620 points
[0].y
= cy
+sin(angle
-a
)*d
;
621 points
[1].x
= cx
+cos(angle
+a
)*d
;
622 points
[1].y
= cy
+sin(angle
+a
)*d
;
623 points
[2].x
= cx
+cos(angle
-a
+WM_PI
)*d
;
624 points
[2].y
= cy
+sin(angle
-a
+WM_PI
)*d
;
625 points
[3].x
= cx
+cos(angle
+a
+WM_PI
)*d
;
626 points
[3].y
= cy
+sin(angle
+a
+WM_PI
)*d
;
627 points
[4].x
= cx
+cos(angle
-a
)*d
;
628 points
[4].y
= cy
+sin(angle
-a
)*d
;
630 XDrawLines(dpy
, scr
->root_win
, scr
->frame_gc
, points
, 5, CoordModeOrigin
);
632 #if (MINIATURIZE_ANIMATION_DELAY_T > 0)
633 wusleep(MINIATURIZE_ANIMATION_DELAY_T
);
636 XDrawLines(dpy
, scr
->root_win
, scr
->frame_gc
, points
, 5, CoordModeOrigin
);
642 if (angle
>= final_angle
)
652 animateResizeZoom(WScreen
*scr
, int x
, int y
, int w
, int h
,
653 int fx
, int fy
, int fw
, int fh
, int steps
)
655 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_Z)
656 float cx
[FRAMES
], cy
[FRAMES
], cw
[FRAMES
], ch
[FRAMES
];
657 float xstep
, ystep
, wstep
, hstep
;
660 xstep
= (float)(fx
-x
)/steps
;
661 ystep
= (float)(fy
-y
)/steps
;
662 wstep
= (float)(fw
-w
)/steps
;
663 hstep
= (float)(fh
-h
)/steps
;
665 for (j
=0; j
<FRAMES
; j
++) {
672 for (i
=0; i
<steps
; i
++) {
673 for (j
=0; j
<FRAMES
; j
++) {
674 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
675 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
678 #if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
679 wusleep(MINIATURIZE_ANIMATION_DELAY_Z
);
681 for (j
=0; j
<FRAMES
; j
++) {
682 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
683 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
698 for (j
=0; j
<FRAMES
; j
++) {
699 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
700 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
703 #if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
704 wusleep(MINIATURIZE_ANIMATION_DELAY_Z
);
706 for (j
=0; j
<FRAMES
; j
++) {
707 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
708 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
717 animateResize(WScreen
*scr
, int x
, int y
, int w
, int h
,
718 int fx
, int fy
, int fw
, int fh
, int hiding
)
720 int style
= wPreferences
.iconification_style
; /* Catch the value */
723 if (style
== WIS_NONE
)
726 if (style
== WIS_RANDOM
) {
730 k
= (hiding
? 2 : 3);
733 steps
= (MINIATURIZE_ANIMATION_STEPS_T
* k
)/3;
735 animateResizeTwist(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
738 steps
= (MINIATURIZE_ANIMATION_STEPS_F
* k
)/3;
740 animateResizeFlip(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
744 steps
= (MINIATURIZE_ANIMATION_STEPS_Z
* k
)/3;
746 animateResizeZoom(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
750 #endif /* ANIMATIONS */
758 while (XCheckTypedEvent(dpy
, Expose
, &tmpev
))
759 WMHandleEvent(&tmpev
);
764 unmapTransientsFor(WWindow
*wwin
)
769 tmp
= wwin
->screen_ptr
->focused_window
;
771 /* unmap the transients for this transient */
772 if (tmp
!=wwin
&& tmp
->transient_for
== wwin
->client_win
773 && (tmp
->flags
.mapped
|| wwin
->screen_ptr
->flags
.startup
774 || tmp
->flags
.shaded
)) {
775 unmapTransientsFor(tmp
);
776 tmp
->flags
.miniaturized
= 1;
777 if (!tmp
->flags
.shaded
) {
780 XUnmapWindow(dpy
, tmp
->frame
->core
->window
);
783 if (!tmp->flags.shaded)
785 wClientSetState(tmp
, IconicState
, None
);
787 wKWMUpdateClientStateHint(tmp
, KWMIconifiedFlag
);
788 wKWMSendEventMessage(tmp
, WKWMRemoveWindow
);
789 tmp
->flags
.kwm_hidden_for_modules
= 1;
792 UpdateSwitchMenu(wwin
->screen_ptr
, tmp
, ACTION_CHANGE_STATE
);
801 mapTransientsFor(WWindow
*wwin
)
805 tmp
= wwin
->screen_ptr
->focused_window
;
807 /* recursively map the transients for this transient */
808 if (tmp
!=wwin
&& tmp
->transient_for
== wwin
->client_win
809 && /*!tmp->flags.mapped*/ tmp
->flags
.miniaturized
810 && tmp
->icon
==NULL
) {
811 mapTransientsFor(tmp
);
812 tmp
->flags
.miniaturized
= 0;
813 if (!tmp
->flags
.shaded
) {
816 XMapWindow(dpy
, tmp
->frame
->core
->window
);
818 tmp
->flags
.semi_focused
= 0;
820 if (!tmp->flags.shaded)
822 wClientSetState(tmp
, NormalState
, None
);
824 wKWMUpdateClientStateHint(tmp
, KWMIconifiedFlag
);
825 if (tmp
->flags
.kwm_hidden_for_modules
) {
826 wKWMSendEventMessage(tmp
, WKWMAddWindow
);
827 tmp
->flags
.kwm_hidden_for_modules
= 0;
831 UpdateSwitchMenu(wwin
->screen_ptr
, tmp
, ACTION_CHANGE_STATE
);
840 setupIconGrabs(WIcon
*icon
)
842 /* setup passive grabs on the icon */
843 XGrabButton(dpy
, Button1
, AnyModifier
, icon
->core
->window
, True
,
844 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
845 XGrabButton(dpy
, Button2
, AnyModifier
, icon
->core
->window
, True
,
846 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
847 XGrabButton(dpy
, Button3
, AnyModifier
, icon
->core
->window
, True
,
848 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
854 recursiveTransientFor(WWindow
*wwin
)
861 /* hackish way to detect transient_for cycle */
862 i
= wwin
->screen_ptr
->window_count
+1;
864 while (wwin
&& wwin
->transient_for
!= None
&& i
>0) {
865 wwin
= wWindowFor(wwin
->transient_for
);
869 wwarning("%s has a severely broken WM_TRANSIENT_FOR hint.",
879 removeIconGrabs(WIcon
*icon
)
881 /* remove passive grabs on the icon */
882 XUngrabButton(dpy
, Button1
, AnyModifier
, icon
->core
->window
);
883 XUngrabButton(dpy
, Button2
, AnyModifier
, icon
->core
->window
);
884 XUngrabButton(dpy
, Button3
, AnyModifier
, icon
->core
->window
);
891 wIconifyWindow(WWindow
*wwin
)
893 XWindowAttributes attribs
;
897 if (!XGetWindowAttributes(dpy
, wwin
->client_win
, &attribs
)) {
898 /* the window doesn't exist anymore */
902 if (wwin
->flags
.miniaturized
) {
907 if (wwin
->transient_for
!=None
) {
908 WWindow
*owner
= wWindowFor(wwin
->transient_for
);
910 if (owner
&& owner
->flags
.miniaturized
)
914 present
= wwin
->frame
->workspace
==wwin
->screen_ptr
->current_workspace
;
916 /* if the window is in another workspace, simplify process */
918 /* icon creation may take a while */
919 XGrabPointer(dpy
, wwin
->screen_ptr
->root_win
, False
,
920 ButtonMotionMask
|ButtonReleaseMask
, GrabModeAsync
,
921 GrabModeAsync
, None
, None
, CurrentTime
);
924 if (!wPreferences
.disable_miniwindows
) {
925 if (!wwin
->flags
.icon_moved
) {
926 PlaceIcon(wwin
->screen_ptr
, &wwin
->icon_x
, &wwin
->icon_y
);
928 wwin
->icon
= wIconCreate(wwin
);
930 wwin
->icon
->mapped
= 1;
933 wwin
->flags
.miniaturized
= 1;
934 wwin
->flags
.mapped
= 0;
936 /* unmap transients */
938 unmapTransientsFor(wwin
);
942 wSoundPlay(WMSOUND_ICONIFY
);
945 XUngrabPointer(dpy
, CurrentTime
);
947 /* let all Expose events arrive so that we can repaint
948 * something before the animation starts (and the server is grabbed) */
951 if (wPreferences
.disable_miniwindows
)
952 wClientSetState(wwin
, IconicState
, None
);
954 wClientSetState(wwin
, IconicState
, wwin
->icon
->icon_win
);
958 if (!wwin
->screen_ptr
->flags
.startup
&& !wwin
->flags
.skip_next_animation
959 && !wPreferences
.no_animations
) {
962 if (!wPreferences
.disable_miniwindows
) {
965 iw
= wwin
->icon
->core
->width
;
966 ih
= wwin
->icon
->core
->height
;
971 if (wKWMGetIconGeometry(wwin
, &area
)) {
977 #endif /* KWM_HINTS */
981 iw
= wwin
->screen_ptr
->scr_width
;
982 ih
= wwin
->screen_ptr
->scr_height
;
985 animateResize(wwin
->screen_ptr
, wwin
->frame_x
, wwin
->frame_y
,
986 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
987 ix
, iy
, iw
, ih
, False
);
992 wwin
->flags
.skip_next_animation
= 0;
994 if (!wPreferences
.disable_miniwindows
) {
996 if (wwin
->screen_ptr
->current_workspace
==wwin
->frame
->workspace
||
997 IS_OMNIPRESENT(wwin
) || wPreferences
.sticky_icons
)
999 XMapWindow(dpy
, wwin
->icon
->core
->window
);
1001 AddToStackList(wwin
->icon
->core
);
1003 wLowerFrame(wwin
->icon
->core
);
1007 WWindow
*owner
= recursiveTransientFor(wwin
->screen_ptr
->focused_window
);
1010 * It doesn't seem to be working and causes button event hangup
1011 * when deiconifying a transient window.
1012 setupIconGrabs(wwin->icon);
1014 if ((wwin
->flags
.focused
1015 || (owner
&& wwin
->client_win
== owner
->client_win
))
1016 && wPreferences
.focus_mode
==WKF_CLICK
) {
1021 if (!WFLAGP(tmp
, no_focusable
)
1022 && !(tmp
->flags
.hidden
||tmp
->flags
.miniaturized
)
1023 && (wwin
->frame
->workspace
== tmp
->frame
->workspace
))
1027 wSetFocusTo(wwin
->screen_ptr
, tmp
);
1028 } else if (wPreferences
.focus_mode
!=WKF_CLICK
) {
1029 wSetFocusTo(wwin
->screen_ptr
, NULL
);
1033 if (!wwin
->screen_ptr
->flags
.startup
) {
1034 Window clientwin
= wwin
->client_win
;
1037 processEvents(XPending(dpy
));
1039 /* the window can disappear while doing the processEvents() */
1040 if (!wWindowFor(clientwin
))
1047 if (wwin
->flags
.selected
&& !wPreferences
.disable_miniwindows
)
1048 wIconSelect(wwin
->icon
);
1051 wGNOMEUpdateClientStateHint(wwin
, False
);
1054 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
1055 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
1058 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1065 wDeiconifyWindow(WWindow
*wwin
)
1067 wWindowChangeWorkspace(wwin
, wwin
->screen_ptr
->current_workspace
);
1069 if (!wwin
->flags
.miniaturized
)
1072 if (wwin
->transient_for
!= None
1073 && wwin
->transient_for
!= wwin
->screen_ptr
->root_win
) {
1074 WWindow
*owner
= recursiveTransientFor(wwin
);
1076 if (owner
&& owner
->flags
.miniaturized
) {
1077 wDeiconifyWindow(owner
);
1078 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1079 wRaiseFrame(wwin
->frame
->core
);
1084 wwin
->flags
.miniaturized
= 0;
1085 if (!wwin
->flags
.shaded
)
1086 wwin
->flags
.mapped
= 1;
1088 if (!wPreferences
.disable_miniwindows
) {
1089 if (wwin
->icon
->selected
)
1090 wIconSelect(wwin
->icon
);
1092 XUnmapWindow(dpy
, wwin
->icon
->core
->window
);
1096 wSoundPlay(WMSOUND_DEICONIFY
);
1099 /* if the window is in another workspace, do it silently */
1101 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
1102 && !wwin
->flags
.skip_next_animation
) {
1105 if (!wPreferences
.disable_miniwindows
) {
1108 iw
= wwin
->icon
->core
->width
;
1109 ih
= wwin
->icon
->core
->height
;
1114 if (wKWMGetIconGeometry(wwin
, &area
)) {
1120 #endif /* KWM_HINTS */
1124 iw
= wwin
->screen_ptr
->scr_width
;
1125 ih
= wwin
->screen_ptr
->scr_height
;
1128 animateResize(wwin
->screen_ptr
, ix
, iy
, iw
, ih
,
1129 wwin
->frame_x
, wwin
->frame_y
,
1130 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1133 #endif /* ANIMATIONS */
1134 wwin
->flags
.skip_next_animation
= 0;
1136 if (!wwin
->flags
.shaded
) {
1137 XMapWindow(dpy
, wwin
->client_win
);
1139 XMapWindow(dpy
, wwin
->frame
->core
->window
);
1140 wRaiseFrame(wwin
->frame
->core
);
1141 if (!wwin
->flags
.shaded
) {
1142 wClientSetState(wwin
, NormalState
, None
);
1144 mapTransientsFor(wwin
);
1146 if (!wPreferences
.disable_miniwindows
) {
1147 RemoveFromStackList(wwin
->icon
->core
);
1148 /* removeIconGrabs(wwin->icon);*/
1149 wIconDestroy(wwin
->icon
);
1154 if (wPreferences
.focus_mode
==WKF_CLICK
)
1155 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1158 if (!wwin
->screen_ptr
->flags
.startup
) {
1159 Window clientwin
= wwin
->client_win
;
1162 processEvents(XPending(dpy
));
1164 if (!wWindowFor(clientwin
))
1169 if (wPreferences
.auto_arrange_icons
) {
1170 wArrangeIcons(wwin
->screen_ptr
, True
);
1174 wGNOMEUpdateClientStateHint(wwin
, False
);
1177 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
1178 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
1181 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1187 hideWindow(WIcon
*icon
, int icon_x
, int icon_y
, WWindow
*wwin
, int animate
)
1189 if (wwin
->flags
.miniaturized
) {
1191 XUnmapWindow(dpy
, wwin
->icon
->core
->window
);
1192 wwin
->icon
->mapped
= 0;
1194 wwin
->flags
.hidden
= 1;
1196 wGNOMEUpdateClientStateHint(wwin
, False
);
1199 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1204 if (wwin
->flags
.inspector_open
) {
1205 WWindow
*pwin
= wwin
->inspector
->frame
;
1208 pwin
->flags
.hidden
= 1;
1210 wClientSetState(pwin
, IconicState
, icon
->icon_win
);
1213 wwin
->flags
.hidden
= 1;
1216 wClientSetState(wwin
, IconicState
, icon
->icon_win
);
1219 wSoundPlay(WMSOUND_HIDE
);
1222 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
&&
1223 !wwin
->flags
.skip_next_animation
&& animate
) {
1224 animateResize(wwin
->screen_ptr
, wwin
->frame_x
, wwin
->frame_y
,
1225 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1226 icon_x
, icon_y
, icon
->core
->width
, icon
->core
->height
,
1230 wwin
->flags
.skip_next_animation
= 0;
1233 wGNOMEUpdateClientStateHint(wwin
, False
);
1236 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1242 wHideOtherApplications(WWindow
*awin
)
1246 #ifdef REDUCE_APPICONS
1247 char *tinstance
, *tclass
;
1248 unsigned int brokenwin
= 0, match
= 0;
1253 wwin
= awin
->screen_ptr
->focused_window
;
1255 #ifdef REDUCE_APPICONS
1256 if (awin
->wm_instance
== NULL
|| awin
->wm_class
== NULL
)
1262 && wwin
->frame
->workspace
== awin
->screen_ptr
->current_workspace
1263 && !(wwin
->flags
.miniaturized
||wwin
->flags
.hidden
)
1264 && !wwin
->flags
.internal_window
1265 && (!wwin
->flags
.inspector_open
|| wwin
->inspector
->frame
!=awin
)
1266 && !WFLAGP(wwin
, no_hide_others
)) {
1268 #ifdef REDUCE_APPICONS
1271 if ((tinstance
= wwin
->wm_instance
) == NULL
)
1273 if ((tclass
= wwin
->wm_class
) == NULL
)
1275 if ((strcmp(awin
->wm_instance
, tinstance
) == 0) &&
1276 (strcmp(awin
->wm_class
, tclass
) == 0) )
1281 if (wwin
->main_window
==None
|| WFLAGP(wwin
, no_appicon
)) {
1282 if (!WFLAGP(wwin
, no_miniaturizable
)) {
1283 wwin
->flags
.skip_next_animation
= 1;
1284 wIconifyWindow(wwin
);
1286 } else if (wwin
->main_window
!=None
1287 #ifndef REDUCE_APPICONS
1288 && awin
->main_window
!= wwin
->main_window
) {
1290 && (awin
->main_window
!= wwin
->main_window
&& !match
)) {
1292 tapp
= wApplicationOf(wwin
->main_window
);
1294 tapp
->flags
.skip_next_animation
= 1;
1295 wHideApplication(tapp
);
1297 if (!WFLAGP(wwin
, no_miniaturizable
)) {
1298 wwin
->flags
.skip_next_animation
= 1;
1299 wIconifyWindow(wwin
);
1307 wSetFocusTo(awin->screen_ptr, awin);
1314 wHideApplication(WApplication
*wapp
)
1316 #ifdef REDUCE_APPICONS
1318 char *tinstance
, *tclass
;
1319 unsigned int nowmhints
= 0, matchwmhints
= 0, matchworkspace
= 0;
1326 wwarning("trying to hide a non grouped window");
1329 if (!wapp
->main_window_desc
) {
1330 wwarning("group leader not found for window group");
1333 #ifdef REDUCE_APPICONS
1334 if ((wapp
->main_window_desc
->wm_instance
== NULL
) ||
1335 (wapp
->main_window_desc
->wm_class
== NULL
))
1338 scr
= wapp
->main_window_desc
->screen_ptr
;
1340 wlist
= scr
->focused_window
;
1344 if (wlist
->main_window
== wapp
->main_window
)
1345 wapp
->last_focused
= wlist
;
1347 wapp
->last_focused
= NULL
;
1349 #ifdef REDUCE_APPICONS
1350 matchwmhints
= matchworkspace
= 0;
1352 tapp
= wApplicationOf(wlist
->main_window
);
1353 tinstance
= tclass
= NULL
;
1355 if (tapp
->main_window_desc
) {
1356 tinstance
= tapp
->main_window_desc
->wm_instance
;
1357 tclass
= tapp
->main_window_desc
->wm_class
;
1360 if (tapp
== NULL
|| tinstance
== NULL
|| tclass
== NULL
) {
1361 /* Should never reach here */
1365 if ((strcmp(tinstance
, wapp
->main_window_desc
->wm_instance
) == 0) &&
1366 (strcmp(tclass
, wapp
->main_window_desc
->wm_class
) == 0) )
1370 if (wlist
->frame
->workspace
== wapp
->main_window_desc
->screen_ptr
->current_workspace
)
1373 if ((wlist
->main_window
== wapp
->main_window
|| matchwmhints
) &&
1379 if (wlist
->main_window
== wapp
->main_window
) {
1381 if (wlist
->flags
.focused
) {
1385 hideWindow(wapp
->app_icon
->icon
, wapp
->app_icon
->x_pos
,
1386 wapp
->app_icon
->y_pos
, wlist
,
1387 !wapp
->flags
.skip_next_animation
);
1389 wlist
= wlist
->prev
;
1392 wapp
->flags
.skip_next_animation
= 0;
1395 if (wPreferences
.focus_mode
==WKF_CLICK
) {
1396 wlist
= scr
->focused_window
;
1398 if (!WFLAGP(wlist
, no_focusable
) && !wlist
->flags
.hidden
1399 && (wlist
->flags
.mapped
|| wlist
->flags
.shaded
))
1401 wlist
= wlist
->prev
;
1403 wSetFocusTo(scr
, wlist
);
1405 wSetFocusTo(scr
, NULL
);
1409 wapp
->flags
.hidden
= 1;
1411 if(wPreferences
.auto_arrange_icons
) {
1412 wArrangeIcons(scr
, True
);
1416 wAppIconPaint(wapp
->app_icon
);
1424 unhideWindow(WIcon
*icon
, int icon_x
, int icon_y
, WWindow
*wwin
, int animate
,
1425 int bringToCurrentWS
)
1427 if (bringToCurrentWS
)
1428 wWindowChangeWorkspace(wwin
, wwin
->screen_ptr
->current_workspace
);
1430 wwin
->flags
.hidden
=0;
1431 wwin
->flags
.mapped
=1;
1434 wSoundPlay(WMSOUND_UNHIDE
);
1437 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
1439 animateResize(wwin
->screen_ptr
, icon_x
, icon_y
,
1440 icon
->core
->width
, icon
->core
->height
,
1441 wwin
->frame_x
, wwin
->frame_y
,
1442 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1446 wwin
->flags
.skip_next_animation
= 0;
1447 XMapWindow(dpy
, wwin
->client_win
);
1448 XMapWindow(dpy
, wwin
->frame
->core
->window
);
1449 wClientSetState(wwin
, NormalState
, None
);
1450 wRaiseFrame(wwin
->frame
->core
);
1451 if (wwin
->flags
.inspector_open
) {
1452 WWindow
*pwin
= wwin
->inspector
->frame
;
1454 pwin
->flags
.hidden
= 0;
1455 pwin
->flags
.mapped
= 1;
1456 XMapWindow(dpy
, pwin
->client_win
);
1457 XMapWindow(dpy
, pwin
->frame
->core
->window
);
1458 wClientSetState(pwin
, NormalState
, None
);
1462 wGNOMEUpdateClientStateHint(wwin
, False
);
1465 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1471 wUnhideApplication(WApplication
*wapp
, Bool miniwindows
, Bool bringToCurrentWS
)
1474 WWindow
*wlist
, *next
;
1475 WWindow
*focused
=NULL
;
1476 #ifdef REDUCE_APPICONS
1477 char *tinstance
, *tclass
;
1478 unsigned int nowmhints
= 0, matchwmhints
= 0, matchworkspace
= 0;
1485 #ifdef REDUCE_APPICONS
1486 if ((wapp
->main_window_desc
->wm_class
== NULL
) ||
1487 (wapp
->main_window_desc
->wm_instance
== NULL
))
1491 scr
= wapp
->main_window_desc
->screen_ptr
;
1492 wlist
= scr
->focused_window
;
1494 /* goto beginning of list */
1496 wlist
= wlist
->prev
;
1501 #ifndef REDUCE_APPICONS
1502 if (wlist
->main_window
== wapp
->main_window
) {
1504 matchwmhints
= matchworkspace
= 0;
1506 if ((tinstance
= wlist
->wm_instance
) == NULL
)
1508 if ((tclass
= wlist
->wm_class
) == NULL
)
1510 if ((strcmp(tinstance
, wapp
->main_window_desc
->wm_instance
) == 0)
1511 && (strcmp(tclass
, wapp
->main_window_desc
->wm_class
) == 0) )
1515 if (wlist
->frame
->workspace
== wapp
->main_window_desc
->screen_ptr
->current_workspace
)
1519 if ((wlist
->main_window
== wapp
->main_window
|| matchwmhints
) &&
1522 if (wlist
->flags
.focused
)
1524 else if (!focused
|| !focused
->flags
.focused
)
1527 if (wlist
->flags
.miniaturized
&& wlist
->icon
) {
1528 if (bringToCurrentWS
|| wPreferences
.sticky_icons
1529 || wlist
->frame
->workspace
== scr
->current_workspace
) {
1530 if (!wlist
->icon
->mapped
) {
1531 XMapWindow(dpy
, wlist
->icon
->core
->window
);
1532 wlist
->icon
->mapped
= 1;
1534 wlist
->flags
.hidden
= 0;
1536 UpdateSwitchMenu(scr
, wlist
, ACTION_CHANGE_STATE
);
1538 if (wlist
->frame
->workspace
!= scr
->current_workspace
)
1539 wWindowChangeWorkspace(wlist
, scr
->current_workspace
);
1542 wDeiconifyWindow(wlist
);
1544 } else if (wlist
->flags
.hidden
) {
1545 unhideWindow(wapp
->app_icon
->icon
, wapp
->app_icon
->x_pos
,
1546 wapp
->app_icon
->y_pos
, wlist
,
1547 !wapp
->flags
.skip_next_animation
,
1550 if (bringToCurrentWS
1551 && wlist
->frame
->workspace
!= scr
->current_workspace
) {
1552 wWindowChangeWorkspace(wlist
, scr
->current_workspace
);
1554 wRaiseFrame(wlist
->frame
->core
);
1560 wapp
->flags
.skip_next_animation
= 0;
1561 wapp
->flags
.hidden
= 0;
1564 wSetFocusTo(scr
, focused
);
1565 else if (wapp
->last_focused
&& wapp
->last_focused
->flags
.mapped
)
1566 wSetFocusTo(scr
, wapp
->last_focused
);
1567 wapp
->last_focused
= NULL
;
1568 if (wPreferences
.auto_arrange_icons
) {
1569 wArrangeIcons(scr
, True
);
1572 wAppIconPaint(wapp
->app_icon
);
1579 wShowAllWindows(WScreen
*scr
)
1581 WWindow
*wwin
, *old_foc
;
1584 old_foc
= wwin
= scr
->focused_window
;
1586 if (!wwin
->flags
.internal_window
&&
1587 (scr
->current_workspace
== wwin
->frame
->workspace
1588 || IS_OMNIPRESENT(wwin
))) {
1589 if (wwin
->flags
.miniaturized
) {
1590 wwin
->flags
.skip_next_animation
= 1;
1591 wDeiconifyWindow(wwin
);
1592 } else if (wwin
->flags
.hidden
) {
1593 wapp
= wApplicationOf(wwin
->main_window
);
1595 wUnhideApplication(wapp
, False
, False
);
1597 wwin
->flags
.skip_next_animation
= 1;
1598 wDeiconifyWindow(wwin
);
1604 wSetFocusTo(scr
, old_foc
);
1605 /*wRaiseFrame(old_foc->frame->core);*/
1610 wRefreshDesktop(WScreen
*scr
)
1613 XSetWindowAttributes attr
;
1615 attr
.backing_store
= NotUseful
;
1616 attr
.save_under
= False
;
1617 win
= XCreateWindow(dpy
, scr
->root_win
, 0, 0, scr
->scr_width
,
1618 scr
->scr_height
, 0, CopyFromParent
, CopyFromParent
,
1619 (Visual
*)CopyFromParent
, CWBackingStore
|CWSaveUnder
,
1621 XMapRaised(dpy
, win
);
1622 XDestroyWindow(dpy
, win
);
1628 wArrangeIcons(WScreen
*scr
, Bool arrangeAll
)
1632 int pf
; /* primary axis */
1633 int sf
; /* secondary axis */
1637 int sx1
, sx2
, sy1
, sy2
; /* screen boundary */
1641 int isize
= wPreferences
.icon_size
;
1644 * Find out screen boundaries.
1648 sx2
= scr
->scr_width
;
1649 sy2
= scr
->scr_height
;
1651 if (scr
->dock
->on_right_side
)
1652 sx2
-= isize
+ DOCK_EXTRA_SPACE
;
1654 sx1
+= isize
+ DOCK_EXTRA_SPACE
;
1657 sw
= isize
* (scr
->scr_width
/isize
);
1658 sh
= isize
* (scr
->scr_height
/isize
);
1659 fullW
= (sx2
-sx1
)/isize
;
1660 fullH
= (sy2
-sy1
)/isize
;
1662 /* icon yard boundaries */
1663 if (wPreferences
.icon_yard
& IY_VERT
) {
1670 if (wPreferences
.icon_yard
& IY_RIGHT
) {
1677 if (wPreferences
.icon_yard
& IY_TOP
) {
1685 /* arrange icons putting the most recently focused window
1686 * as the last icon */
1687 #define X ((wPreferences.icon_yard & IY_VERT) ? xo + xs*(si*isize)\
1688 : xo + xs*(pi*isize))
1689 #define Y ((wPreferences.icon_yard & IY_VERT) ? yo + ys*(pi*isize)\
1690 : yo + ys*(si*isize))
1692 /* arrange application icons */
1693 aicon
= scr
->app_icon_list
;
1694 /* reverse them to avoid unnecessarily sliding of icons */
1695 while (aicon
&& aicon
->next
)
1696 aicon
= aicon
->next
;
1701 if (!aicon
->docked
) {
1702 if (aicon
->x_pos
!= X
|| aicon
->y_pos
!= Y
) {
1704 if (!wPreferences
.no_animations
) {
1705 SlideWindow(aicon
->icon
->core
->window
, aicon
->x_pos
, aicon
->y_pos
,
1708 #endif /* ANIMATIONS */
1710 wAppIconMove(aicon
, X
, Y
);
1713 /* we reversed the order so we use prev */
1714 aicon
= aicon
->prev
;
1721 /* arrange miniwindows */
1723 wwin
= scr
->focused_window
;
1724 /* reverse them to avoid unnecessarily shuffling */
1725 while (wwin
&& wwin
->prev
)
1729 if (wwin
->icon
&& wwin
->flags
.miniaturized
&&/*!wwin->flags.hidden &&*/
1730 (wwin
->frame
->workspace
==scr
->current_workspace
||
1731 IS_OMNIPRESENT(wwin
) || wPreferences
.sticky_icons
)) {
1733 if (arrangeAll
|| !wwin
->flags
.icon_moved
) {
1734 if (wwin
->icon_x
!= X
|| wwin
->icon_y
!= Y
) {
1736 if (wPreferences
.no_animations
) {
1737 XMoveWindow(dpy
, wwin
->icon
->core
->window
, X
, Y
);
1739 SlideWindow(wwin
->icon
->core
->window
, wwin
->icon_x
,
1740 wwin
->icon_y
, X
, Y
);
1743 XMoveWindow(dpy
, wwin
->icon
->core
->window
, X
, Y
);
1744 #endif /* ANIMATIONS */
1752 wwin
->flags
.icon_moved
= 0;
1754 /* we reversed the order, so we use next */
1765 wSelectWindow(WWindow
*wwin
, Bool flag
)
1767 WScreen
*scr
= wwin
->screen_ptr
;
1769 wwin
->flags
.selected
= 1;
1770 XSetWindowBorder(dpy
, wwin
->frame
->core
->window
, scr
->white_pixel
);
1771 scr
->selected_windows
= list_cons(wwin
, scr
->selected_windows
);
1773 wwin
->flags
.selected
= 0;
1774 XSetWindowBorder(dpy
, wwin
->frame
->core
->window
,
1775 scr
->frame_border_pixel
);
1776 scr
->selected_windows
= list_remove_elem(scr
->selected_windows
, wwin
);
1782 wMakeWindowVisible(WWindow
*wwin
)
1784 if (wwin
->frame
->workspace
!= wwin
->screen_ptr
->current_workspace
)
1785 wWorkspaceChange(wwin
->screen_ptr
, wwin
->frame
->workspace
);
1787 if (wwin
->flags
.shaded
) {
1788 wUnshadeWindow(wwin
);
1790 if (wwin
->flags
.hidden
) {
1793 app
= wApplicationOf(wwin
->main_window
);
1795 wUnhideApplication(app
, False
, False
);
1796 } else if (wwin
->flags
.miniaturized
) {
1797 wDeiconifyWindow(wwin
);
1799 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1800 wRaiseFrame(wwin
->frame
->core
);