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 (WFLAGP(wwin
, no_focusable
))
181 if (wwin
->flags
.mapped
/*&& !WFLAGP(wwin, no_focusable)*/) {
182 /* install colormap if colormap mode is lock mode */
183 if (wPreferences
.colormap_mode
==WKF_CLICK
)
184 wColormapInstallForWindow(scr
, wwin
);
186 /* set input focus */
187 switch (wwin
->focus_mode
) {
189 XSetInputFocus(dpy
, scr
->no_focus_win
, RevertToParent
, timestamp
);
193 case WFM_LOCALLY_ACTIVE
:
194 XSetInputFocus(dpy
, wwin
->client_win
, RevertToParent
, timestamp
);
197 case WFM_GLOBALLY_ACTIVE
:
201 if (wwin
->protocols
.TAKE_FOCUS
) {
202 wClientSendProtocol(wwin
, _XA_WM_TAKE_FOCUS
, timestamp
);
206 XSetInputFocus(dpy
, scr
->no_focus_win
, RevertToParent
, timestamp
);
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
) {
234 wAppMenuMap(napp
->menu
, wwin
);
236 wApplicationActivate(napp
);
240 wKWMUpdateActiveWindowHint(scr
);
241 wKWMSendEventMessage(wwin
, WKWMFocusWindow
);
248 wShadeWindow(WWindow
*wwin
)
250 time_t time0
= time(NULL
);
255 if (wwin
->flags
.shaded
)
258 XLowerWindow(dpy
, wwin
->client_win
);
261 wSoundPlay(WMSOUND_SHADE
);
265 if (!wwin
->screen_ptr
->flags
.startup
&& !wwin
->flags
.skip_next_animation
266 && !wPreferences
.no_animations
) {
267 /* do the shading animation */
268 h
= wwin
->frame
->core
->height
;
271 w
= wwin
->frame
->core
->width
;
272 y
= wwin
->frame
->top_width
;
273 while (h
>wwin
->frame
->top_width
+1) {
274 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
275 XResizeWindow(dpy
, wwin
->frame
->core
->window
, w
, h
);
278 if (time(NULL
)-time0
> MAX_ANIMATION_TIME
)
282 wusleep(SHADE_DELAY
*1000L);
286 XMoveWindow(dpy
, wwin
->client_win
, 0, wwin
->frame
->top_width
);
288 #endif /* ANIMATIONS */
290 wwin
->flags
.skip_next_animation
= 0;
291 wwin
->flags
.shaded
= 1;
292 wwin
->flags
.mapped
= 0;
293 /* prevent window withdrawal when getting UnmapNotify */
294 XSelectInput(dpy
, wwin
->client_win
,
295 wwin
->event_mask
& ~StructureNotifyMask
);
296 XUnmapWindow(dpy
, wwin
->client_win
);
297 XSelectInput(dpy
, wwin
->client_win
, wwin
->event_mask
);
299 /* for the client it's just like iconification */
300 wFrameWindowResize(wwin
->frame
, wwin
->frame
->core
->width
,
301 wwin
->frame
->top_width
- 1);
303 wwin
->client
.y
= wwin
->frame_y
- wwin
->client
.height
304 + wwin
->frame
->top_width
;
305 wWindowSynthConfigureNotify(wwin
);
308 wClientSetState(wwin, IconicState, None);
312 wGNOMEUpdateClientStateHint(wwin
, False
);
315 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
316 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
318 /* update window list to reflect shaded state */
319 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
322 if (!wwin
->screen_ptr
->flags
.startup
) {
323 /* Look at processEvents() for reason of this code. */
325 processEvents(XPending(dpy
));
332 wUnshadeWindow(WWindow
*wwin
)
334 time_t time0
= time(NULL
);
337 #endif /* ANIMATIONS */
340 if (!wwin
->flags
.shaded
)
343 wwin
->flags
.shaded
= 0;
344 wwin
->flags
.mapped
= 1;
345 XMapWindow(dpy
, wwin
->client_win
);
348 wSoundPlay(WMSOUND_UNSHADE
);
352 if (!wPreferences
.no_animations
&& !wwin
->flags
.skip_next_animation
) {
353 /* do the shading animation */
354 h
= wwin
->frame
->top_width
+ wwin
->frame
->bottom_width
;
355 y
= wwin
->frame
->top_width
- wwin
->client
.height
;
356 s
= abs(y
)/SHADE_STEPS
;
358 w
= wwin
->frame
->core
->width
;
359 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
361 while (h
< wwin
->client
.height
+ wwin
->frame
->top_width
362 + wwin
->frame
->bottom_width
) {
363 XResizeWindow(dpy
, wwin
->frame
->core
->window
, w
, h
);
364 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
367 wusleep(SHADE_DELAY
*2000L/3);
371 if (time(NULL
)-time0
> MAX_ANIMATION_TIME
)
375 XMoveWindow(dpy
, wwin
->client_win
, 0, wwin
->frame
->top_width
);
377 #endif /* ANIMATIONS */
379 wwin
->flags
.skip_next_animation
= 0;
380 wFrameWindowResize(wwin
->frame
, wwin
->frame
->core
->width
,
381 wwin
->frame
->top_width
+ wwin
->client
.height
382 + wwin
->frame
->bottom_width
);
384 wwin
->client
.y
= wwin
->frame_y
+ wwin
->frame
->top_width
;
385 wWindowSynthConfigureNotify(wwin
);
388 wClientSetState(wwin, NormalState, None);
390 /* if the window is focused, set the focus again as it was disabled during
392 if (wwin
->flags
.focused
)
393 wSetFocusTo(wwin
->screen_ptr
, wwin
);
396 wGNOMEUpdateClientStateHint(wwin
, False
);
399 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
400 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
403 /* update window list to reflect unshaded state */
404 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
410 wMaximizeWindow(WWindow
*wwin
, int directions
)
412 int new_width
, new_height
, new_x
, new_y
;
413 WArea usableArea
= wwin
->screen_ptr
->totalUsableArea
;
416 if (WFLAGP(wwin
, no_resizable
))
420 if (WFLAGP(wwin
, full_maximize
)) {
423 usableArea
.x2
= wwin
->screen_ptr
->scr_width
;
424 usableArea
.y2
= wwin
->screen_ptr
->scr_height
;
427 if (wwin
->flags
.shaded
) {
428 wwin
->flags
.skip_next_animation
= 1;
429 wUnshadeWindow(wwin
);
431 wwin
->flags
.maximized
= directions
;
432 wwin
->old_geometry
.width
= wwin
->client
.width
;
433 wwin
->old_geometry
.height
= wwin
->client
.height
;
434 wwin
->old_geometry
.x
= wwin
->frame_x
;
435 wwin
->old_geometry
.y
= wwin
->frame_y
;
438 wKWMUpdateClientGeometryRestore(wwin
);
441 if (directions
& MAX_HORIZONTAL
) {
443 new_width
= (usableArea
.x2
-usableArea
.x1
)-FRAME_BORDER_WIDTH
*2;
444 new_x
= usableArea
.x1
;
448 new_x
= wwin
->frame_x
;
449 new_width
= wwin
->frame
->core
->width
;
453 if (directions
& MAX_VERTICAL
) {
455 new_height
= (usableArea
.y2
-usableArea
.y1
)-FRAME_BORDER_WIDTH
*2;
456 new_y
= usableArea
.y1
;
457 if (WFLAGP(wwin
, full_maximize
))
458 new_y
-= wwin
->frame
->top_width
;
462 new_y
= wwin
->frame_y
;
463 new_height
= wwin
->frame
->core
->height
;
467 if (!WFLAGP(wwin
, full_maximize
)) {
468 new_height
-= wwin
->frame
->top_width
+wwin
->frame
->bottom_width
;
471 wWindowConstrainSize(wwin
, &new_width
, &new_height
);
472 wWindowConfigure(wwin
, new_x
, new_y
, new_width
, new_height
);
475 wGNOMEUpdateClientStateHint(wwin
, False
);
478 wKWMUpdateClientStateHint(wwin
, KWMMaximizedFlag
);
479 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
483 wSoundPlay(WMSOUND_MAXIMIZE
);
489 wUnmaximizeWindow(WWindow
*wwin
)
491 int restore_x
, restore_y
;
493 if (!wwin
->flags
.maximized
)
496 if (wwin
->flags
.shaded
) {
497 wwin
->flags
.skip_next_animation
= 1;
498 wUnshadeWindow(wwin
);
500 restore_x
= (wwin
->flags
.maximized
& MAX_HORIZONTAL
) ?
501 wwin
->old_geometry
.x
: wwin
->frame_x
;
502 restore_y
= (wwin
->flags
.maximized
& MAX_VERTICAL
) ?
503 wwin
->old_geometry
.y
: wwin
->frame_y
;
504 wwin
->flags
.maximized
= 0;
505 wWindowConfigure(wwin
, restore_x
, restore_y
,
506 wwin
->old_geometry
.width
, wwin
->old_geometry
.height
);
509 wGNOMEUpdateClientStateHint(wwin
, False
);
512 wKWMUpdateClientStateHint(wwin
, KWMMaximizedFlag
);
513 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
517 wSoundPlay(WMSOUND_UNMAXIMIZE
);
523 animateResizeFlip(WScreen
*scr
, int x
, int y
, int w
, int h
,
524 int fx
, int fy
, int fw
, int fh
, int steps
)
526 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_F)
527 float cx
, cy
, cw
, ch
;
528 float xstep
, ystep
, wstep
, hstep
;
531 float angle
, final_angle
, delta
;
533 xstep
= (float)(fx
-x
)/steps
;
534 ystep
= (float)(fy
-y
)/steps
;
535 wstep
= (float)(fw
-w
)/steps
;
536 hstep
= (float)(fh
-h
)/steps
;
543 final_angle
= 2*WM_PI
*MINIATURIZE_ANIMATION_TWIST_F
;
544 delta
= (float)(final_angle
/FRAMES
);
545 for (angle
=0;; angle
+=delta
) {
546 if (angle
> final_angle
)
549 dx
= (cw
/10) - ((cw
/5) * sin(angle
));
550 dch
= (ch
/2) * cos(angle
);
553 points
[0].x
= cx
+ dx
; points
[0].y
= midy
- dch
;
554 points
[1].x
= cx
+ cw
- dx
; points
[1].y
= points
[0].y
;
555 points
[2].x
= cx
+ cw
+ dx
; points
[2].y
= midy
+ dch
;
556 points
[3].x
= cx
- dx
; points
[3].y
= points
[2].y
;
557 points
[4].x
= points
[0].x
; points
[4].y
= points
[0].y
;
560 XDrawLines(dpy
,scr
->root_win
,scr
->frame_gc
,points
, 5, CoordModeOrigin
);
562 #if (MINIATURIZE_ANIMATION_DELAY_F > 0)
563 wusleep(MINIATURIZE_ANIMATION_DELAY_F
);
566 XDrawLines(dpy
,scr
->root_win
,scr
->frame_gc
,points
, 5, CoordModeOrigin
);
572 if (angle
>= final_angle
)
582 animateResizeTwist(WScreen
*scr
, int x
, int y
, int w
, int h
,
583 int fx
, int fy
, int fw
, int fh
, int steps
)
585 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_T)
586 float cx
, cy
, cw
, ch
;
587 float xstep
, ystep
, wstep
, hstep
;
589 float angle
, final_angle
, a
, d
, delta
;
596 xstep
= (float)(fx
-x
)/steps
;
597 ystep
= (float)(fy
-y
)/steps
;
598 wstep
= (float)(fw
-w
)/steps
;
599 hstep
= (float)(fh
-h
)/steps
;
606 final_angle
= 2*WM_PI
*MINIATURIZE_ANIMATION_TWIST_T
;
607 delta
= (float)(final_angle
/FRAMES
);
608 for (angle
=0;; angle
+=delta
) {
609 if (angle
> final_angle
)
613 d
= sqrt((cw
/2)*(cw
/2)+(ch
/2)*(ch
/2));
615 points
[0].x
= cx
+cos(angle
-a
)*d
;
616 points
[0].y
= cy
+sin(angle
-a
)*d
;
617 points
[1].x
= cx
+cos(angle
+a
)*d
;
618 points
[1].y
= cy
+sin(angle
+a
)*d
;
619 points
[2].x
= cx
+cos(angle
-a
+WM_PI
)*d
;
620 points
[2].y
= cy
+sin(angle
-a
+WM_PI
)*d
;
621 points
[3].x
= cx
+cos(angle
+a
+WM_PI
)*d
;
622 points
[3].y
= cy
+sin(angle
+a
+WM_PI
)*d
;
623 points
[4].x
= cx
+cos(angle
-a
)*d
;
624 points
[4].y
= cy
+sin(angle
-a
)*d
;
626 XDrawLines(dpy
, scr
->root_win
, scr
->frame_gc
, points
, 5, CoordModeOrigin
);
628 #if (MINIATURIZE_ANIMATION_DELAY_T > 0)
629 wusleep(MINIATURIZE_ANIMATION_DELAY_T
);
632 XDrawLines(dpy
, scr
->root_win
, scr
->frame_gc
, points
, 5, CoordModeOrigin
);
638 if (angle
>= final_angle
)
648 animateResizeZoom(WScreen
*scr
, int x
, int y
, int w
, int h
,
649 int fx
, int fy
, int fw
, int fh
, int steps
)
651 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_Z)
652 float cx
[FRAMES
], cy
[FRAMES
], cw
[FRAMES
], ch
[FRAMES
];
653 float xstep
, ystep
, wstep
, hstep
;
656 xstep
= (float)(fx
-x
)/steps
;
657 ystep
= (float)(fy
-y
)/steps
;
658 wstep
= (float)(fw
-w
)/steps
;
659 hstep
= (float)(fh
-h
)/steps
;
661 for (j
=0; j
<FRAMES
; j
++) {
668 for (i
=0; i
<steps
; i
++) {
669 for (j
=0; j
<FRAMES
; j
++) {
670 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
671 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
674 #if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
675 wusleep(MINIATURIZE_ANIMATION_DELAY_Z
);
677 for (j
=0; j
<FRAMES
; j
++) {
678 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
679 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
694 for (j
=0; j
<FRAMES
; j
++) {
695 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
696 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
699 #if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
700 wusleep(MINIATURIZE_ANIMATION_DELAY_Z
);
702 for (j
=0; j
<FRAMES
; j
++) {
703 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
704 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
713 animateResize(WScreen
*scr
, int x
, int y
, int w
, int h
,
714 int fx
, int fy
, int fw
, int fh
, int hiding
)
716 int style
= wPreferences
.iconification_style
; /* Catch the value */
719 if (style
== WIS_NONE
)
722 if (style
== WIS_RANDOM
) {
726 k
= (hiding
? 2 : 3);
729 steps
= (MINIATURIZE_ANIMATION_STEPS_T
* k
)/3;
731 animateResizeTwist(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
734 steps
= (MINIATURIZE_ANIMATION_STEPS_F
* k
)/3;
736 animateResizeFlip(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
740 steps
= (MINIATURIZE_ANIMATION_STEPS_Z
* k
)/3;
742 animateResizeZoom(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
746 #endif /* ANIMATIONS */
754 while (XCheckTypedEvent(dpy
, Expose
, &tmpev
))
755 WMHandleEvent(&tmpev
);
760 unmapTransientsFor(WWindow
*wwin
)
765 tmp
= wwin
->screen_ptr
->focused_window
;
767 /* unmap the transients for this transient */
768 if (tmp
!=wwin
&& tmp
->transient_for
== wwin
->client_win
769 && (tmp
->flags
.mapped
|| wwin
->screen_ptr
->flags
.startup
770 || tmp
->flags
.shaded
)) {
771 unmapTransientsFor(tmp
);
772 tmp
->flags
.miniaturized
= 1;
773 if (!tmp
->flags
.shaded
) {
776 XUnmapWindow(dpy
, tmp
->frame
->core
->window
);
779 if (!tmp->flags.shaded)
781 wClientSetState(tmp
, IconicState
, None
);
783 wKWMUpdateClientStateHint(tmp
, KWMIconifiedFlag
);
784 wKWMSendEventMessage(tmp
, WKWMRemoveWindow
);
785 tmp
->flags
.kwm_hidden_for_modules
= 1;
788 UpdateSwitchMenu(wwin
->screen_ptr
, tmp
, ACTION_CHANGE_STATE
);
797 mapTransientsFor(WWindow
*wwin
)
801 tmp
= wwin
->screen_ptr
->focused_window
;
803 /* recursively map the transients for this transient */
804 if (tmp
!=wwin
&& tmp
->transient_for
== wwin
->client_win
805 && /*!tmp->flags.mapped*/ tmp
->flags
.miniaturized
806 && tmp
->icon
==NULL
) {
807 mapTransientsFor(tmp
);
808 tmp
->flags
.miniaturized
= 0;
809 if (!tmp
->flags
.shaded
) {
812 XMapWindow(dpy
, tmp
->frame
->core
->window
);
814 tmp
->flags
.semi_focused
= 0;
816 if (!tmp->flags.shaded)
818 wClientSetState(tmp
, NormalState
, None
);
820 wKWMUpdateClientStateHint(tmp
, KWMIconifiedFlag
);
821 if (tmp
->flags
.kwm_hidden_for_modules
) {
822 wKWMSendEventMessage(tmp
, WKWMAddWindow
);
823 tmp
->flags
.kwm_hidden_for_modules
= 0;
827 UpdateSwitchMenu(wwin
->screen_ptr
, tmp
, ACTION_CHANGE_STATE
);
836 setupIconGrabs(WIcon
*icon
)
838 /* setup passive grabs on the icon */
839 XGrabButton(dpy
, Button1
, AnyModifier
, icon
->core
->window
, True
,
840 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
841 XGrabButton(dpy
, Button2
, AnyModifier
, icon
->core
->window
, True
,
842 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
843 XGrabButton(dpy
, Button3
, AnyModifier
, icon
->core
->window
, True
,
844 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
850 recursiveTransientFor(WWindow
*wwin
)
857 /* hackish way to detect transient_for cycle */
858 i
= wwin
->screen_ptr
->window_count
+1;
860 while (wwin
&& wwin
->transient_for
!= None
&& i
>0) {
861 wwin
= wWindowFor(wwin
->transient_for
);
865 wwarning("%s has a severely broken WM_TRANSIENT_FOR hint.",
875 removeIconGrabs(WIcon
*icon
)
877 /* remove passive grabs on the icon */
878 XUngrabButton(dpy
, Button1
, AnyModifier
, icon
->core
->window
);
879 XUngrabButton(dpy
, Button2
, AnyModifier
, icon
->core
->window
);
880 XUngrabButton(dpy
, Button3
, AnyModifier
, icon
->core
->window
);
887 wIconifyWindow(WWindow
*wwin
)
889 XWindowAttributes attribs
;
893 if (!XGetWindowAttributes(dpy
, wwin
->client_win
, &attribs
)) {
894 /* the window doesn't exist anymore */
898 if (wwin
->flags
.miniaturized
) {
903 if (wwin
->transient_for
!=None
) {
904 WWindow
*owner
= wWindowFor(wwin
->transient_for
);
906 if (owner
&& owner
->flags
.miniaturized
)
910 present
= wwin
->frame
->workspace
==wwin
->screen_ptr
->current_workspace
;
912 /* if the window is in another workspace, simplify process */
914 /* icon creation may take a while */
915 XGrabPointer(dpy
, wwin
->screen_ptr
->root_win
, False
,
916 ButtonMotionMask
|ButtonReleaseMask
, GrabModeAsync
,
917 GrabModeAsync
, None
, None
, CurrentTime
);
920 if (!wwin
->flags
.icon_moved
) {
921 PlaceIcon(wwin
->screen_ptr
, &wwin
->icon_x
, &wwin
->icon_y
);
923 wwin
->icon
= wIconCreate(wwin
);
925 wwin
->flags
.miniaturized
= 1;
926 wwin
->flags
.mapped
= 0;
928 /* unmap transients */
930 unmapTransientsFor(wwin
);
934 wSoundPlay(WMSOUND_ICONIFY
);
937 XUngrabPointer(dpy
, CurrentTime
);
939 /* let all Expose events arrive so that we can repaint
940 * something before the animation starts (and the server is grabbed) */
942 wClientSetState(wwin
, IconicState
, wwin
->icon
->icon_win
);
945 if (!wwin
->screen_ptr
->flags
.startup
&& !wwin
->flags
.skip_next_animation
946 && !wPreferences
.no_animations
) {
947 animateResize(wwin
->screen_ptr
, wwin
->frame_x
, wwin
->frame_y
,
948 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
949 wwin
->icon_x
, wwin
->icon_y
,
950 wwin
->icon
->core
->width
, wwin
->icon
->core
->height
,
956 wwin
->flags
.skip_next_animation
= 0;
957 if (wwin
->screen_ptr
->current_workspace
==wwin
->frame
->workspace
||
958 IS_OMNIPRESENT(wwin
) || wPreferences
.sticky_icons
)
960 XMapWindow(dpy
, wwin
->icon
->core
->window
);
961 AddToStackList(wwin
->icon
->core
);
963 wLowerFrame(wwin
->icon
->core
);
966 WWindow
*owner
= recursiveTransientFor(wwin
->screen_ptr
->focused_window
);
969 * It doesn't seem to be working and causes button event hangup
970 * when deiconifying a transient window.
971 setupIconGrabs(wwin->icon);
973 if ((wwin
->flags
.focused
974 || (owner
&& wwin
->client_win
== owner
->client_win
))
975 && wPreferences
.focus_mode
==WKF_CLICK
) {
980 if (!WFLAGP(tmp
, no_focusable
)
981 && !(tmp
->flags
.hidden
||tmp
->flags
.miniaturized
))
985 wSetFocusTo(wwin
->screen_ptr
, tmp
);
986 } else if (wPreferences
.focus_mode
!=WKF_CLICK
) {
987 wSetFocusTo(wwin
->screen_ptr
, NULL
);
991 if (!wwin
->screen_ptr
->flags
.startup
) {
992 Window clientwin
= wwin
->client_win
;
995 processEvents(XPending(dpy
));
997 /* the window can disappear while doing the processEvents() */
998 if (!wWindowFor(clientwin
))
1005 if (wwin
->flags
.selected
)
1006 wIconSelect(wwin
->icon
);
1009 wGNOMEUpdateClientStateHint(wwin
, False
);
1012 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
1013 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
1016 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1022 wDeiconifyWindow(WWindow
*wwin
)
1024 wWindowChangeWorkspace(wwin
, wwin
->screen_ptr
->current_workspace
);
1026 if (!wwin
->flags
.miniaturized
)
1029 if (wwin
->transient_for
!= None
1030 && wwin
->transient_for
!= wwin
->screen_ptr
->root_win
) {
1031 WWindow
*owner
= recursiveTransientFor(wwin
);
1033 if (owner
&& owner
->flags
.miniaturized
) {
1034 wDeiconifyWindow(owner
);
1035 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1036 wRaiseFrame(wwin
->frame
->core
);
1041 wwin
->flags
.miniaturized
= 0;
1042 if (!wwin
->flags
.shaded
)
1043 wwin
->flags
.mapped
= 1;
1045 if (wwin
->icon
->selected
)
1046 wIconSelect(wwin
->icon
);
1048 XUnmapWindow(dpy
, wwin
->icon
->core
->window
);
1051 wSoundPlay(WMSOUND_DEICONIFY
);
1054 /* if the window is in another workspace, do it silently */
1056 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
1057 && !wwin
->flags
.skip_next_animation
) {
1058 animateResize(wwin
->screen_ptr
, wwin
->icon_x
, wwin
->icon_y
,
1059 wwin
->icon
->core
->width
, wwin
->icon
->core
->height
,
1060 wwin
->frame_x
, wwin
->frame_y
,
1061 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1064 #endif /* ANIMATIONS */
1065 wwin
->flags
.skip_next_animation
= 0;
1067 if (!wwin
->flags
.shaded
) {
1068 XMapWindow(dpy
, wwin
->client_win
);
1070 XMapWindow(dpy
, wwin
->frame
->core
->window
);
1071 wRaiseFrame(wwin
->frame
->core
);
1072 if (!wwin
->flags
.shaded
) {
1073 wClientSetState(wwin
, NormalState
, None
);
1075 mapTransientsFor(wwin
);
1076 RemoveFromStackList(wwin
->icon
->core
);
1077 /* removeIconGrabs(wwin->icon);*/
1078 wIconDestroy(wwin
->icon
);
1082 if (wPreferences
.focus_mode
==WKF_CLICK
1083 || wPreferences
.focus_mode
==WKF_SLOPPY
)
1084 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1087 if (!wwin
->screen_ptr
->flags
.startup
) {
1088 Window clientwin
= wwin
->client_win
;
1091 processEvents(XPending(dpy
));
1093 if (!wWindowFor(clientwin
))
1098 if (wPreferences
.auto_arrange_icons
) {
1099 wArrangeIcons(wwin
->screen_ptr
, True
);
1103 wGNOMEUpdateClientStateHint(wwin
, False
);
1106 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
1107 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
1110 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1116 hideWindow(WIcon
*icon
, int icon_x
, int icon_y
, WWindow
*wwin
, int animate
)
1118 if (wwin
->flags
.miniaturized
) {
1119 /* XXX wrong fix, can cause side effects, must remove 'if' */
1121 XUnmapWindow(dpy
, wwin
->icon
->core
->window
);
1122 wwin
->icon
->mapped
= 0;
1124 wwin
->flags
.hidden
= 1;
1126 wGNOMEUpdateClientStateHint(wwin
, False
);
1129 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1134 if (wwin
->flags
.inspector_open
) {
1135 WWindow
*pwin
= wwin
->inspector
->frame
;
1138 pwin
->flags
.hidden
= 1;
1140 wClientSetState(pwin
, IconicState
, icon
->icon_win
);
1143 wwin
->flags
.hidden
= 1;
1146 wClientSetState(wwin
, IconicState
, icon
->icon_win
);
1149 wSoundPlay(WMSOUND_HIDE
);
1152 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
&&
1153 !wwin
->flags
.skip_next_animation
&& animate
) {
1154 animateResize(wwin
->screen_ptr
, wwin
->frame_x
, wwin
->frame_y
,
1155 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1156 icon_x
, icon_y
, icon
->core
->width
, icon
->core
->height
,
1160 wwin
->flags
.skip_next_animation
= 0;
1163 wGNOMEUpdateClientStateHint(wwin
, False
);
1166 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1172 wHideOtherApplications(WWindow
*awin
)
1176 #ifdef REDUCE_APPICONS
1177 char *tinstance
, *tclass
;
1178 unsigned int brokenwin
= 0, match
= 0;
1183 wwin
= awin
->screen_ptr
->focused_window
;
1185 #ifdef REDUCE_APPICONS
1186 if (awin
->wm_instance
== NULL
|| awin
->wm_class
== NULL
)
1192 && wwin
->frame
->workspace
== awin
->screen_ptr
->current_workspace
1193 && !(wwin
->flags
.miniaturized
||wwin
->flags
.hidden
)
1194 && !wwin
->flags
.internal_window
1195 && (!wwin
->flags
.inspector_open
|| wwin
->inspector
->frame
!=awin
)
1196 && !WFLAGP(wwin
, no_hide_others
)) {
1198 #ifdef REDUCE_APPICONS
1201 if ((tinstance
= wwin
->wm_instance
) == NULL
)
1203 if ((tclass
= wwin
->wm_class
) == NULL
)
1205 if ((strcmp(awin
->wm_instance
, tinstance
) == 0) &&
1206 (strcmp(awin
->wm_class
, tclass
) == 0) )
1211 if (wwin
->main_window
==None
|| WFLAGP(wwin
, no_appicon
)) {
1212 if (!WFLAGP(wwin
, no_miniaturizable
)) {
1213 wwin
->flags
.skip_next_animation
= 1;
1214 wIconifyWindow(wwin
);
1216 } else if (wwin
->main_window
!=None
1217 #ifndef REDUCE_APPICONS
1218 && awin
->main_window
!= wwin
->main_window
) {
1220 && (awin
->main_window
!= wwin
->main_window
&& !match
)) {
1222 tapp
= wApplicationOf(wwin
->main_window
);
1224 tapp
->flags
.skip_next_animation
= 1;
1225 wHideApplication(tapp
);
1227 if (!WFLAGP(wwin
, no_miniaturizable
)) {
1228 wwin
->flags
.skip_next_animation
= 1;
1229 wIconifyWindow(wwin
);
1237 wSetFocusTo(awin->screen_ptr, awin);
1244 wHideApplication(WApplication
*wapp
)
1246 #ifdef REDUCE_APPICONS
1248 char *tinstance
, *tclass
;
1249 unsigned int nowmhints
= 0, matchwmhints
= 0, matchworkspace
= 0;
1256 wwarning("trying to hide a non grouped window");
1259 if (!wapp
->main_window_desc
) {
1260 wwarning("group leader not found for window group");
1263 #ifdef REDUCE_APPICONS
1264 if ((wapp
->main_window_desc
->wm_instance
== NULL
) ||
1265 (wapp
->main_window_desc
->wm_class
== NULL
))
1268 scr
= wapp
->main_window_desc
->screen_ptr
;
1270 wlist
= scr
->focused_window
;
1274 if (wlist
->main_window
== wapp
->main_window
)
1275 wapp
->last_focused
= wlist
;
1277 wapp
->last_focused
= NULL
;
1279 #ifdef REDUCE_APPICONS
1280 matchwmhints
= matchworkspace
= 0;
1282 tapp
= wApplicationOf(wlist
->main_window
);
1283 tinstance
= tclass
= NULL
;
1285 if (tapp
->main_window_desc
) {
1286 tinstance
= tapp
->main_window_desc
->wm_instance
;
1287 tclass
= tapp
->main_window_desc
->wm_class
;
1290 if (tapp
== NULL
|| tinstance
== NULL
|| tclass
== NULL
) {
1291 /* Should never reach here */
1295 if ((strcmp(tinstance
, wapp
->main_window_desc
->wm_instance
) == 0) &&
1296 (strcmp(tclass
, wapp
->main_window_desc
->wm_class
) == 0) )
1300 if (wlist
->frame
->workspace
== wapp
->main_window_desc
->screen_ptr
->current_workspace
)
1303 if ((wlist
->main_window
== wapp
->main_window
|| matchwmhints
) &&
1309 if (wlist
->main_window
== wapp
->main_window
) {
1311 if (wlist
->flags
.focused
) {
1315 hideWindow(wapp
->app_icon
->icon
, wapp
->app_icon
->x_pos
,
1316 wapp
->app_icon
->y_pos
, wlist
,
1317 !wapp
->flags
.skip_next_animation
);
1319 wlist
= wlist
->prev
;
1322 wapp
->flags
.skip_next_animation
= 0;
1325 if (wPreferences
.focus_mode
==WKF_CLICK
) {
1326 wlist
= scr
->focused_window
;
1328 if (!WFLAGP(wlist
, no_focusable
) && !wlist
->flags
.hidden
1329 && (wlist
->flags
.mapped
|| wlist
->flags
.shaded
))
1331 wlist
= wlist
->prev
;
1333 wSetFocusTo(scr
, wlist
);
1335 wSetFocusTo(scr
, NULL
);
1339 wapp
->flags
.hidden
= 1;
1341 if(wPreferences
.auto_arrange_icons
) {
1342 wArrangeIcons(scr
, True
);
1345 wAppIconPaint(wapp
->app_icon
);
1353 unhideWindow(WIcon
*icon
, int icon_x
, int icon_y
, WWindow
*wwin
, int animate
,
1354 int bringToCurrentWS
)
1356 if (bringToCurrentWS
)
1357 wWindowChangeWorkspace(wwin
, wwin
->screen_ptr
->current_workspace
);
1359 wwin
->flags
.hidden
=0;
1360 wwin
->flags
.mapped
=1;
1363 wSoundPlay(WMSOUND_UNHIDE
);
1366 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
1368 animateResize(wwin
->screen_ptr
, icon_x
, icon_y
,
1369 icon
->core
->width
, icon
->core
->height
,
1370 wwin
->frame_x
, wwin
->frame_y
,
1371 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1375 wwin
->flags
.skip_next_animation
= 0;
1376 XMapWindow(dpy
, wwin
->client_win
);
1377 XMapWindow(dpy
, wwin
->frame
->core
->window
);
1378 wClientSetState(wwin
, NormalState
, None
);
1379 wRaiseFrame(wwin
->frame
->core
);
1380 if (wwin
->flags
.inspector_open
) {
1381 WWindow
*pwin
= wwin
->inspector
->frame
;
1383 pwin
->flags
.hidden
= 0;
1384 pwin
->flags
.mapped
= 1;
1385 XMapWindow(dpy
, pwin
->client_win
);
1386 XMapWindow(dpy
, pwin
->frame
->core
->window
);
1387 wClientSetState(pwin
, NormalState
, None
);
1391 wGNOMEUpdateClientStateHint(wwin
, False
);
1394 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1400 wUnhideApplication(WApplication
*wapp
, Bool miniwindows
, Bool bringToCurrentWS
)
1403 WWindow
*wlist
, *next
;
1404 WWindow
*focused
=NULL
;
1405 #ifdef REDUCE_APPICONS
1406 char *tinstance
, *tclass
;
1407 unsigned int nowmhints
= 0, matchwmhints
= 0, matchworkspace
= 0;
1414 #ifdef REDUCE_APPICONS
1415 if ((wapp
->main_window_desc
->wm_class
== NULL
) ||
1416 (wapp
->main_window_desc
->wm_instance
== NULL
))
1420 scr
= wapp
->main_window_desc
->screen_ptr
;
1421 wlist
= scr
->focused_window
;
1423 /* goto beginning of list */
1425 wlist
= wlist
->prev
;
1430 #ifndef REDUCE_APPICONS
1431 if (wlist
->main_window
== wapp
->main_window
) {
1433 matchwmhints
= matchworkspace
= 0;
1435 if ((tinstance
= wlist
->wm_instance
) == NULL
)
1437 if ((tclass
= wlist
->wm_class
) == NULL
)
1439 if ((strcmp(tinstance
, wapp
->main_window_desc
->wm_instance
) == 0)
1440 && (strcmp(tclass
, wapp
->main_window_desc
->wm_class
) == 0) )
1444 if (wlist
->frame
->workspace
== wapp
->main_window_desc
->screen_ptr
->current_workspace
)
1448 if ((wlist
->main_window
== wapp
->main_window
|| matchwmhints
) &&
1451 if (wlist
->flags
.focused
)
1453 else if (!focused
|| !focused
->flags
.focused
)
1456 if (wlist
->flags
.miniaturized
&& wlist
->icon
) {
1457 if (bringToCurrentWS
|| wPreferences
.sticky_icons
1458 || wlist
->frame
->workspace
== scr
->current_workspace
) {
1459 if (!wlist
->icon
->mapped
) {
1460 XMapWindow(dpy
, wlist
->icon
->core
->window
);
1461 wlist
->icon
->mapped
= 1;
1463 wlist
->flags
.hidden
= 0;
1465 UpdateSwitchMenu(scr
, wlist
, ACTION_CHANGE_STATE
);
1467 if (wlist
->frame
->workspace
!= scr
->current_workspace
)
1468 wWindowChangeWorkspace(wlist
, scr
->current_workspace
);
1471 wDeiconifyWindow(wlist
);
1473 } else if (wlist
->flags
.hidden
) {
1474 unhideWindow(wapp
->app_icon
->icon
, wapp
->app_icon
->x_pos
,
1475 wapp
->app_icon
->y_pos
, wlist
,
1476 !wapp
->flags
.skip_next_animation
,
1479 if (bringToCurrentWS
1480 && wlist
->frame
->workspace
!= scr
->current_workspace
) {
1481 wWindowChangeWorkspace(wlist
, scr
->current_workspace
);
1483 wRaiseFrame(wlist
->frame
->core
);
1489 wapp
->flags
.skip_next_animation
= 0;
1490 wapp
->flags
.hidden
= 0;
1493 wSetFocusTo(scr
, focused
);
1494 else if (wapp
->last_focused
&& wapp
->last_focused
->flags
.mapped
)
1495 wSetFocusTo(scr
, wapp
->last_focused
);
1496 wapp
->last_focused
= NULL
;
1497 if (wPreferences
.auto_arrange_icons
) {
1498 wArrangeIcons(scr
, True
);
1501 wAppIconPaint(wapp
->app_icon
);
1508 wShowAllWindows(WScreen
*scr
)
1510 WWindow
*wwin
, *old_foc
;
1513 old_foc
= wwin
= scr
->focused_window
;
1515 if (!wwin
->flags
.internal_window
&&
1516 (scr
->current_workspace
== wwin
->frame
->workspace
1517 || IS_OMNIPRESENT(wwin
))) {
1518 if (wwin
->flags
.miniaturized
) {
1519 wwin
->flags
.skip_next_animation
= 1;
1520 wDeiconifyWindow(wwin
);
1521 } else if (wwin
->flags
.hidden
) {
1522 wapp
= wApplicationOf(wwin
->main_window
);
1524 wUnhideApplication(wapp
, False
, False
);
1526 wwin
->flags
.skip_next_animation
= 1;
1527 wDeiconifyWindow(wwin
);
1533 wSetFocusTo(scr
, old_foc
);
1534 /*wRaiseFrame(old_foc->frame->core);*/
1539 wRefreshDesktop(WScreen
*scr
)
1542 XSetWindowAttributes attr
;
1544 attr
.backing_store
= NotUseful
;
1545 attr
.save_under
= False
;
1546 win
= XCreateWindow(dpy
, scr
->root_win
, 0, 0, scr
->scr_width
,
1547 scr
->scr_height
, 0, CopyFromParent
, CopyFromParent
,
1548 (Visual
*)CopyFromParent
, CWBackingStore
|CWSaveUnder
,
1550 XMapRaised(dpy
, win
);
1551 XDestroyWindow(dpy
, win
);
1557 wArrangeIcons(WScreen
*scr
, Bool arrangeAll
)
1561 int pf
; /* primary axis */
1562 int sf
; /* secondary axis */
1566 int sx1
, sx2
, sy1
, sy2
; /* screen boundary */
1570 int isize
= wPreferences
.icon_size
;
1573 * Find out screen boundaries.
1577 sx2
= scr
->scr_width
;
1578 sy2
= scr
->scr_height
;
1580 if (scr
->dock
->on_right_side
)
1581 sx2
-= isize
+ DOCK_EXTRA_SPACE
;
1583 sx1
+= isize
+ DOCK_EXTRA_SPACE
;
1586 sw
= isize
* (scr
->scr_width
/isize
);
1587 sh
= isize
* (scr
->scr_height
/isize
);
1588 fullW
= (sx2
-sx1
)/isize
;
1589 fullH
= (sy2
-sy1
)/isize
;
1591 /* icon yard boundaries */
1592 if (wPreferences
.icon_yard
& IY_VERT
) {
1599 if (wPreferences
.icon_yard
& IY_RIGHT
) {
1606 if (wPreferences
.icon_yard
& IY_TOP
) {
1614 /* arrange icons putting the most recently focused window
1615 * as the last icon */
1616 #define X ((wPreferences.icon_yard & IY_VERT) ? xo + xs*(si*isize)\
1617 : xo + xs*(pi*isize))
1618 #define Y ((wPreferences.icon_yard & IY_VERT) ? yo + ys*(pi*isize)\
1619 : yo + ys*(si*isize))
1621 /* arrange application icons */
1622 aicon
= scr
->app_icon_list
;
1623 /* reverse them to avoid unnecessarily sliding of icons */
1624 while (aicon
&& aicon
->next
)
1625 aicon
= aicon
->next
;
1630 if (!aicon
->docked
) {
1631 if (aicon
->x_pos
!= X
|| aicon
->y_pos
!= Y
) {
1633 if (!wPreferences
.no_animations
) {
1634 SlideWindow(aicon
->icon
->core
->window
, aicon
->x_pos
, aicon
->y_pos
,
1637 #endif /* ANIMATIONS */
1639 wAppIconMove(aicon
, X
, Y
);
1642 /* we reversed the order so we use prev */
1643 aicon
= aicon
->prev
;
1650 /* arrange miniwindows */
1652 wwin
= scr
->focused_window
;
1653 /* reverse them to avoid unnecessarily shuffling */
1654 while (wwin
&& wwin
->prev
)
1658 if (wwin
->icon
&& wwin
->flags
.miniaturized
&&/*!wwin->flags.hidden &&*/
1659 (wwin
->frame
->workspace
==scr
->current_workspace
||
1660 IS_OMNIPRESENT(wwin
) || wPreferences
.sticky_icons
)) {
1662 if (arrangeAll
|| !wwin
->flags
.icon_moved
) {
1663 if (wwin
->icon_x
!= X
|| wwin
->icon_y
!= Y
) {
1665 if (wPreferences
.no_animations
) {
1666 XMoveWindow(dpy
, wwin
->icon
->core
->window
, X
, Y
);
1668 SlideWindow(wwin
->icon
->core
->window
, wwin
->icon_x
,
1669 wwin
->icon_y
, X
, Y
);
1672 XMoveWindow(dpy
, wwin
->icon
->core
->window
, X
, Y
);
1673 #endif /* ANIMATIONS */
1681 wwin
->flags
.icon_moved
= 0;
1683 /* we reversed the order, so we use next */
1694 wSelectWindow(WWindow
*wwin
, Bool flag
)
1696 WScreen
*scr
= wwin
->screen_ptr
;
1698 wwin
->flags
.selected
= 1;
1699 XSetWindowBorder(dpy
, wwin
->frame
->core
->window
, scr
->white_pixel
);
1700 scr
->selected_windows
= list_cons(wwin
, scr
->selected_windows
);
1702 wwin
->flags
.selected
= 0;
1703 XSetWindowBorder(dpy
, wwin
->frame
->core
->window
,
1704 scr
->frame_border_pixel
);
1705 scr
->selected_windows
= list_remove_elem(scr
->selected_windows
, wwin
);
1711 wMakeWindowVisible(WWindow
*wwin
)
1713 wWorkspaceChange(wwin
->screen_ptr
, wwin
->frame
->workspace
);
1715 if (wwin
->flags
.shaded
) {
1716 wUnshadeWindow(wwin
);
1718 if (wwin
->flags
.hidden
) {
1721 app
= wApplicationOf(wwin
->main_window
);
1723 wUnhideApplication(app
, False
, False
);
1724 } else if (wwin
->flags
.miniaturized
) {
1725 wDeiconifyWindow(wwin
);
1727 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1728 wRaiseFrame(wwin
->frame
->core
);