1 /* action.c- misc. window commands (miniaturize, hide etc.)
3 * Window Maker window manager
5 * Copyright (c) 1997, 1998, 1999 Alfredo K. Kojima
6 * Copyright (c) 1998 Dan Pascu
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
28 #include <X11/Xutil.h>
35 #include "WindowMaker.h"
42 #include "application.h"
48 #include "winspector.h"
49 #include "workspace.h"
61 /****** Global Variables ******/
62 extern Time LastTimestamp
;
63 extern Time LastFocusChange
;
65 extern Cursor wCursor
[WCUR_LAST
];
67 extern WPreferences wPreferences
;
69 extern Atom _XA_WM_TAKE_FOCUS
;
72 /******* Local Variables *******/
77 {SHADE_STEPS_UF
, SHADE_DELAY_UF
},
78 {SHADE_STEPS_F
, SHADE_DELAY_F
},
79 {SHADE_STEPS_M
, SHADE_DELAY_M
},
80 {SHADE_STEPS_S
, SHADE_DELAY_S
},
81 {SHADE_STEPS_U
, SHADE_DELAY_U
}};
83 #define SHADE_STEPS shadePars[(int)wPreferences.shade_speed].steps
84 #define SHADE_DELAY shadePars[(int)wPreferences.shade_speed].delay
87 static int ignoreTimestamp
=0;
92 processEvents(int event_count
)
97 * This is a hack. When animations are enabled, processing of
98 * events ocurred during a animation are delayed until it's end.
99 * Calls that consider the TimeStamp, like XSetInputFocus(), will
100 * fail because the TimeStamp is too old. Then, for example, if
101 * the user changes window focus while a miniaturize animation is
102 * in course, the window will not get focus properly after the end
103 * of the animation. This tries to workaround it by passing CurrentTime
104 * as the TimeStamp for XSetInputFocus() for all events ocurred during
108 while (XPending(dpy
) && event_count
--) {
109 WMNextEvent(dpy
, &event
);
110 WMHandleEvent(&event
);
114 #endif /* ANIMATIONS */
119 *----------------------------------------------------------------------
121 * Changes the window focus to the one passed as argument.
122 * If the window to focus is not already focused, it will be brought
123 * to the head of the list of windows. Previously focused window is
127 * Window list may be reordered and the window focus is changed.
129 *----------------------------------------------------------------------
132 wSetFocusTo(WScreen
*scr
, WWindow
*wwin
)
134 static WScreen
*old_scr
=NULL
;
136 WWindow
*old_focused
;
137 WWindow
*focused
=scr
->focused_window
;
138 int timestamp
=LastTimestamp
;
139 WApplication
*oapp
=NULL
, *napp
=NULL
;
144 old_focused
=old_scr
->focused_window
;
146 LastFocusChange
= timestamp
;
149 * This is a hack, because XSetInputFocus() should have a proper
150 * timestamp instead of CurrentTime but it seems that some times
151 * clients will not receive focus properly that way.
154 timestamp
= CurrentTime
;
157 oapp
= wApplicationOf(old_focused
->main_window
);
160 XSetInputFocus(dpy
, scr
->no_focus_win
, RevertToParent
, timestamp
);
162 wWindowUnfocus(old_focused
);
165 wAppMenuUnmap(oapp
->menu
);
167 wApplicationDeactivate(oapp
);
171 wKWMUpdateActiveWindowHint(scr
);
172 wKWMSendEventMessage(NULL
, WKWMFocusWindow
);
175 } else if (old_scr
!= scr
&& old_focused
) {
176 wWindowUnfocus(old_focused
);
179 wasfocused
= wwin
->flags
.focused
;
180 napp
= wApplicationOf(wwin
->main_window
);
182 /* remember last workspace where the app has been */
184 napp
->last_workspace
= wwin
->screen_ptr
->current_workspace
;
186 if (wwin
->flags
.mapped
&& !WFLAGP(wwin
, no_focusable
)) {
187 /* install colormap if colormap mode is lock mode */
188 if (wPreferences
.colormap_mode
==WCM_CLICK
)
189 wColormapInstallForWindow(scr
, wwin
);
191 /* set input focus */
192 switch (wwin
->focus_mode
) {
194 XSetInputFocus(dpy
, scr
->no_focus_win
, RevertToParent
, timestamp
);
198 case WFM_LOCALLY_ACTIVE
:
199 XSetInputFocus(dpy
, wwin
->client_win
, RevertToParent
, timestamp
);
202 case WFM_GLOBALLY_ACTIVE
:
206 if (wwin
->protocols
.TAKE_FOCUS
) {
207 wClientSendProtocol(wwin
, _XA_WM_TAKE_FOCUS
, timestamp
);
211 XSetInputFocus(dpy
, scr
->no_focus_win
, RevertToParent
, timestamp
);
213 if (WFLAGP(wwin
, no_focusable
))
216 /* if this is not the focused window focus it */
218 /* change the focus window list order */
220 wwin
->prev
->next
= wwin
->next
;
223 wwin
->next
->prev
= wwin
->prev
;
225 wwin
->prev
= focused
;
226 focused
->next
= wwin
;
228 scr
->focused_window
= wwin
;
230 if (oapp
&& oapp
!= napp
) {
231 wAppMenuUnmap(oapp
->menu
);
233 wApplicationDeactivate(oapp
);
238 wWindowFocus(wwin
, focused
);
240 if (napp
&& !wasfocused
) {
242 wUserMenuRefreshInstances(napp
->menu
, wwin
);
243 #endif /* USER_MENU */
245 if (wwin
->flags
.mapped
)
246 wAppMenuMap(napp
->menu
, wwin
);
248 wApplicationActivate(napp
);
252 wKWMUpdateActiveWindowHint(scr
);
253 wKWMSendEventMessage(wwin
, WKWMFocusWindow
);
261 wShadeWindow(WWindow
*wwin
)
263 time_t time0
= time(NULL
);
268 if (wwin
->flags
.shaded
)
271 XLowerWindow(dpy
, wwin
->client_win
);
273 wSoundPlay(WSOUND_SHADE
);
276 if (!wwin
->screen_ptr
->flags
.startup
&& !wwin
->flags
.skip_next_animation
277 && !wPreferences
.no_animations
) {
278 /* do the shading animation */
279 h
= wwin
->frame
->core
->height
;
282 w
= wwin
->frame
->core
->width
;
283 y
= wwin
->frame
->top_width
;
284 while (h
>wwin
->frame
->top_width
+1) {
285 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
286 XResizeWindow(dpy
, wwin
->frame
->core
->window
, w
, h
);
289 if (time(NULL
)-time0
> MAX_ANIMATION_TIME
)
293 wusleep(SHADE_DELAY
*1000L);
297 XMoveWindow(dpy
, wwin
->client_win
, 0, wwin
->frame
->top_width
);
299 #endif /* ANIMATIONS */
301 wwin
->flags
.skip_next_animation
= 0;
302 wwin
->flags
.shaded
= 1;
303 wwin
->flags
.mapped
= 0;
304 /* prevent window withdrawal when getting UnmapNotify */
305 XSelectInput(dpy
, wwin
->client_win
,
306 wwin
->event_mask
& ~StructureNotifyMask
);
307 XUnmapWindow(dpy
, wwin
->client_win
);
308 XSelectInput(dpy
, wwin
->client_win
, wwin
->event_mask
);
310 /* for the client it's just like iconification */
311 wFrameWindowResize(wwin
->frame
, wwin
->frame
->core
->width
,
312 wwin
->frame
->top_width
- 1);
314 wwin
->client
.y
= wwin
->frame_y
- wwin
->client
.height
315 + wwin
->frame
->top_width
;
316 wWindowSynthConfigureNotify(wwin
);
319 wClientSetState(wwin, IconicState, None);
323 wGNOMEUpdateClientStateHint(wwin
, False
);
326 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
327 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
329 /* update window list to reflect shaded state */
330 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
333 if (!wwin
->screen_ptr
->flags
.startup
) {
334 /* Look at processEvents() for reason of this code. */
336 processEvents(XPending(dpy
));
343 wUnshadeWindow(WWindow
*wwin
)
345 time_t time0
= time(NULL
);
348 #endif /* ANIMATIONS */
351 if (!wwin
->flags
.shaded
)
354 wwin
->flags
.shaded
= 0;
355 wwin
->flags
.mapped
= 1;
356 XMapWindow(dpy
, wwin
->client_win
);
358 wSoundPlay(WSOUND_UNSHADE
);
361 if (!wPreferences
.no_animations
&& !wwin
->flags
.skip_next_animation
) {
362 /* do the shading animation */
363 h
= wwin
->frame
->top_width
+ wwin
->frame
->bottom_width
;
364 y
= wwin
->frame
->top_width
- wwin
->client
.height
;
365 s
= abs(y
)/SHADE_STEPS
;
367 w
= wwin
->frame
->core
->width
;
368 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
370 while (h
< wwin
->client
.height
+ wwin
->frame
->top_width
371 + wwin
->frame
->bottom_width
) {
372 XResizeWindow(dpy
, wwin
->frame
->core
->window
, w
, h
);
373 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
376 wusleep(SHADE_DELAY
*2000L/3);
380 if (time(NULL
)-time0
> MAX_ANIMATION_TIME
)
384 XMoveWindow(dpy
, wwin
->client_win
, 0, wwin
->frame
->top_width
);
386 #endif /* ANIMATIONS */
388 wwin
->flags
.skip_next_animation
= 0;
389 wFrameWindowResize(wwin
->frame
, wwin
->frame
->core
->width
,
390 wwin
->frame
->top_width
+ wwin
->client
.height
391 + wwin
->frame
->bottom_width
);
393 wwin
->client
.y
= wwin
->frame_y
+ wwin
->frame
->top_width
;
394 wWindowSynthConfigureNotify(wwin
);
397 wClientSetState(wwin, NormalState, None);
399 /* if the window is focused, set the focus again as it was disabled during
401 if (wwin
->flags
.focused
)
402 wSetFocusTo(wwin
->screen_ptr
, wwin
);
405 wGNOMEUpdateClientStateHint(wwin
, False
);
408 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
409 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
412 /* update window list to reflect unshaded state */
413 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
419 wMaximizeWindow(WWindow
*wwin
, int directions
)
421 int new_width
, new_height
, new_x
, new_y
;
422 WArea usableArea
= wwin
->screen_ptr
->totalUsableArea
;
426 if (WFLAGP(wwin
, no_resizable
))
431 totalArea
.x2
= wwin
->screen_ptr
->scr_width
;
432 totalArea
.y2
= wwin
->screen_ptr
->scr_height
;
435 if (wwin
->screen_ptr
->xine_count
> 0
436 && !(directions
& MAX_IGNORE_XINERAMA
)) {
437 WScreen
*scr
= wwin
->screen_ptr
;
440 rect
= wGetRectForHead(scr
, wGetHeadForWindow(wwin
));
441 totalArea
.x1
= rect
.pos
.x
;
442 totalArea
.y1
= rect
.pos
.y
;
443 totalArea
.x2
= totalArea
.x1
+ rect
.size
.width
;
444 totalArea
.y2
= totalArea
.y1
+ rect
.size
.height
;
446 usableArea
.x1
= WMAX(totalArea
.x1
, usableArea
.x1
);
447 usableArea
.y1
= WMAX(totalArea
.y1
, usableArea
.y1
);
448 usableArea
.x2
= WMIN(totalArea
.x2
, usableArea
.x2
);
449 usableArea
.y2
= WMIN(totalArea
.y2
, usableArea
.y2
);
451 #endif /* XINERAMA */
453 if (WFLAGP(wwin
, full_maximize
)) {
454 usableArea
= totalArea
;
457 if (wwin
->flags
.shaded
) {
458 wwin
->flags
.skip_next_animation
= 1;
459 wUnshadeWindow(wwin
);
461 wwin
->flags
.maximized
= directions
;
462 wwin
->old_geometry
.width
= wwin
->client
.width
;
463 wwin
->old_geometry
.height
= wwin
->client
.height
;
464 wwin
->old_geometry
.x
= wwin
->frame_x
;
465 wwin
->old_geometry
.y
= wwin
->frame_y
;
468 wKWMUpdateClientGeometryRestore(wwin
);
471 if (directions
& MAX_HORIZONTAL
) {
473 new_width
= (usableArea
.x2
-usableArea
.x1
)-FRAME_BORDER_WIDTH
*2;
474 new_x
= usableArea
.x1
;
478 new_x
= wwin
->frame_x
;
479 new_width
= wwin
->frame
->core
->width
;
483 if (directions
& MAX_VERTICAL
) {
485 new_height
= (usableArea
.y2
-usableArea
.y1
)-FRAME_BORDER_WIDTH
*2;
486 new_y
= usableArea
.y1
;
487 if (WFLAGP(wwin
, full_maximize
)) {
488 new_y
-= wwin
->frame
->top_width
;
489 new_height
+= wwin
->frame
->bottom_width
- 1;
492 new_y
= wwin
->frame_y
;
493 new_height
= wwin
->frame
->core
->height
;
496 if (!WFLAGP(wwin
, full_maximize
)) {
497 new_height
-= wwin
->frame
->top_width
+wwin
->frame
->bottom_width
;
500 wWindowConstrainSize(wwin
, &new_width
, &new_height
);
501 wWindowConfigure(wwin
, new_x
, new_y
, new_width
, new_height
);
504 wGNOMEUpdateClientStateHint(wwin
, False
);
507 wKWMUpdateClientStateHint(wwin
, KWMMaximizedFlag
);
508 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
511 wSoundPlay(WSOUND_MAXIMIZE
);
516 wUnmaximizeWindow(WWindow
*wwin
)
518 int restore_x
, restore_y
;
520 if (!wwin
->flags
.maximized
)
523 if (wwin
->flags
.shaded
) {
524 wwin
->flags
.skip_next_animation
= 1;
525 wUnshadeWindow(wwin
);
527 restore_x
= (wwin
->flags
.maximized
& MAX_HORIZONTAL
) ?
528 wwin
->old_geometry
.x
: wwin
->frame_x
;
529 restore_y
= (wwin
->flags
.maximized
& MAX_VERTICAL
) ?
530 wwin
->old_geometry
.y
: wwin
->frame_y
;
531 wwin
->flags
.maximized
= 0;
532 wWindowConfigure(wwin
, restore_x
, restore_y
,
533 wwin
->old_geometry
.width
, wwin
->old_geometry
.height
);
536 wGNOMEUpdateClientStateHint(wwin
, False
);
539 wKWMUpdateClientStateHint(wwin
, KWMMaximizedFlag
);
540 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
543 wSoundPlay(WSOUND_UNMAXIMIZE
);
548 animateResizeFlip(WScreen
*scr
, int x
, int y
, int w
, int h
,
549 int fx
, int fy
, int fw
, int fh
, int steps
)
551 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_F)
552 float cx
, cy
, cw
, ch
;
553 float xstep
, ystep
, wstep
, hstep
;
556 float angle
, final_angle
, delta
;
558 xstep
= (float)(fx
-x
)/steps
;
559 ystep
= (float)(fy
-y
)/steps
;
560 wstep
= (float)(fw
-w
)/steps
;
561 hstep
= (float)(fh
-h
)/steps
;
568 final_angle
= 2*WM_PI
*MINIATURIZE_ANIMATION_TWIST_F
;
569 delta
= (float)(final_angle
/FRAMES
);
570 for (angle
=0;; angle
+=delta
) {
571 if (angle
> final_angle
)
574 dx
= (cw
/10) - ((cw
/5) * sin(angle
));
575 dch
= (ch
/2) * cos(angle
);
578 points
[0].x
= cx
+ dx
; points
[0].y
= midy
- dch
;
579 points
[1].x
= cx
+ cw
- dx
; points
[1].y
= points
[0].y
;
580 points
[2].x
= cx
+ cw
+ dx
; points
[2].y
= midy
+ dch
;
581 points
[3].x
= cx
- dx
; points
[3].y
= points
[2].y
;
582 points
[4].x
= points
[0].x
; points
[4].y
= points
[0].y
;
585 XDrawLines(dpy
,scr
->root_win
,scr
->frame_gc
,points
, 5, CoordModeOrigin
);
587 #if (MINIATURIZE_ANIMATION_DELAY_F > 0)
588 wusleep(MINIATURIZE_ANIMATION_DELAY_F
);
591 XDrawLines(dpy
,scr
->root_win
,scr
->frame_gc
,points
, 5, CoordModeOrigin
);
597 if (angle
>= final_angle
)
607 animateResizeTwist(WScreen
*scr
, int x
, int y
, int w
, int h
,
608 int fx
, int fy
, int fw
, int fh
, int steps
)
610 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_T)
611 float cx
, cy
, cw
, ch
;
612 float xstep
, ystep
, wstep
, hstep
;
614 float angle
, final_angle
, a
, d
, delta
;
621 xstep
= (float)(fx
-x
)/steps
;
622 ystep
= (float)(fy
-y
)/steps
;
623 wstep
= (float)(fw
-w
)/steps
;
624 hstep
= (float)(fh
-h
)/steps
;
631 final_angle
= 2*WM_PI
*MINIATURIZE_ANIMATION_TWIST_T
;
632 delta
= (float)(final_angle
/FRAMES
);
633 for (angle
=0;; angle
+=delta
) {
634 if (angle
> final_angle
)
638 d
= sqrt((cw
/2)*(cw
/2)+(ch
/2)*(ch
/2));
640 points
[0].x
= cx
+cos(angle
-a
)*d
;
641 points
[0].y
= cy
+sin(angle
-a
)*d
;
642 points
[1].x
= cx
+cos(angle
+a
)*d
;
643 points
[1].y
= cy
+sin(angle
+a
)*d
;
644 points
[2].x
= cx
+cos(angle
-a
+WM_PI
)*d
;
645 points
[2].y
= cy
+sin(angle
-a
+WM_PI
)*d
;
646 points
[3].x
= cx
+cos(angle
+a
+WM_PI
)*d
;
647 points
[3].y
= cy
+sin(angle
+a
+WM_PI
)*d
;
648 points
[4].x
= cx
+cos(angle
-a
)*d
;
649 points
[4].y
= cy
+sin(angle
-a
)*d
;
651 XDrawLines(dpy
, scr
->root_win
, scr
->frame_gc
, points
, 5, CoordModeOrigin
);
653 #if (MINIATURIZE_ANIMATION_DELAY_T > 0)
654 wusleep(MINIATURIZE_ANIMATION_DELAY_T
);
657 XDrawLines(dpy
, scr
->root_win
, scr
->frame_gc
, points
, 5, CoordModeOrigin
);
663 if (angle
>= final_angle
)
673 animateResizeZoom(WScreen
*scr
, int x
, int y
, int w
, int h
,
674 int fx
, int fy
, int fw
, int fh
, int steps
)
676 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_Z)
677 float cx
[FRAMES
], cy
[FRAMES
], cw
[FRAMES
], ch
[FRAMES
];
678 float xstep
, ystep
, wstep
, hstep
;
681 xstep
= (float)(fx
-x
)/steps
;
682 ystep
= (float)(fy
-y
)/steps
;
683 wstep
= (float)(fw
-w
)/steps
;
684 hstep
= (float)(fh
-h
)/steps
;
686 for (j
=0; j
<FRAMES
; j
++) {
693 for (i
=0; i
<steps
; i
++) {
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
]);
719 for (j
=0; j
<FRAMES
; j
++) {
720 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
721 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
724 #if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
725 wusleep(MINIATURIZE_ANIMATION_DELAY_Z
);
727 for (j
=0; j
<FRAMES
; j
++) {
728 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
729 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
738 animateResize(WScreen
*scr
, int x
, int y
, int w
, int h
,
739 int fx
, int fy
, int fw
, int fh
, int hiding
)
741 int style
= wPreferences
.iconification_style
; /* Catch the value */
744 if (style
== WIS_NONE
)
747 if (style
== WIS_RANDOM
) {
751 k
= (hiding
? 2 : 3);
754 steps
= (MINIATURIZE_ANIMATION_STEPS_T
* k
)/3;
756 animateResizeTwist(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
759 steps
= (MINIATURIZE_ANIMATION_STEPS_F
* k
)/3;
761 animateResizeFlip(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
765 steps
= (MINIATURIZE_ANIMATION_STEPS_Z
* k
)/3;
767 animateResizeZoom(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
771 #endif /* ANIMATIONS */
779 while (XCheckTypedEvent(dpy
, Expose
, &tmpev
))
780 WMHandleEvent(&tmpev
);
785 unmapTransientsFor(WWindow
*wwin
)
790 tmp
= wwin
->screen_ptr
->focused_window
;
792 /* unmap the transients for this transient */
793 if (tmp
!=wwin
&& tmp
->transient_for
== wwin
->client_win
794 && (tmp
->flags
.mapped
|| wwin
->screen_ptr
->flags
.startup
795 || tmp
->flags
.shaded
)) {
796 unmapTransientsFor(tmp
);
797 tmp
->flags
.miniaturized
= 1;
798 if (!tmp
->flags
.shaded
) {
801 XUnmapWindow(dpy
, tmp
->frame
->core
->window
);
804 if (!tmp->flags.shaded)
806 wClientSetState(tmp
, IconicState
, None
);
808 wKWMUpdateClientStateHint(tmp
, KWMIconifiedFlag
);
809 wKWMSendEventMessage(tmp
, WKWMRemoveWindow
);
810 tmp
->flags
.kwm_hidden_for_modules
= 1;
813 UpdateSwitchMenu(wwin
->screen_ptr
, tmp
, ACTION_CHANGE_STATE
);
822 mapTransientsFor(WWindow
*wwin
)
826 tmp
= wwin
->screen_ptr
->focused_window
;
828 /* recursively map the transients for this transient */
829 if (tmp
!=wwin
&& tmp
->transient_for
== wwin
->client_win
830 && /*!tmp->flags.mapped*/ tmp
->flags
.miniaturized
831 && tmp
->icon
==NULL
) {
832 mapTransientsFor(tmp
);
833 tmp
->flags
.miniaturized
= 0;
834 if (!tmp
->flags
.shaded
) {
837 XMapWindow(dpy
, tmp
->frame
->core
->window
);
839 tmp
->flags
.semi_focused
= 0;
841 if (!tmp->flags.shaded)
843 wClientSetState(tmp
, NormalState
, None
);
845 wKWMUpdateClientStateHint(tmp
, KWMIconifiedFlag
);
846 if (tmp
->flags
.kwm_hidden_for_modules
) {
847 wKWMSendEventMessage(tmp
, WKWMAddWindow
);
848 tmp
->flags
.kwm_hidden_for_modules
= 0;
852 UpdateSwitchMenu(wwin
->screen_ptr
, tmp
, ACTION_CHANGE_STATE
);
861 setupIconGrabs(WIcon
*icon
)
863 /* setup passive grabs on the icon */
864 XGrabButton(dpy
, Button1
, AnyModifier
, icon
->core
->window
, True
,
865 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
866 XGrabButton(dpy
, Button2
, AnyModifier
, icon
->core
->window
, True
,
867 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
868 XGrabButton(dpy
, Button3
, AnyModifier
, icon
->core
->window
, True
,
869 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
875 recursiveTransientFor(WWindow
*wwin
)
882 /* hackish way to detect transient_for cycle */
883 i
= wwin
->screen_ptr
->window_count
+1;
885 while (wwin
&& wwin
->transient_for
!= None
&& i
>0) {
886 wwin
= wWindowFor(wwin
->transient_for
);
890 wwarning("%s has a severely broken WM_TRANSIENT_FOR hint.",
900 removeIconGrabs(WIcon
*icon
)
902 /* remove passive grabs on the icon */
903 XUngrabButton(dpy
, Button1
, AnyModifier
, icon
->core
->window
);
904 XUngrabButton(dpy
, Button2
, AnyModifier
, icon
->core
->window
);
905 XUngrabButton(dpy
, Button3
, AnyModifier
, icon
->core
->window
);
912 wIconifyWindow(WWindow
*wwin
)
914 XWindowAttributes attribs
;
918 if (!XGetWindowAttributes(dpy
, wwin
->client_win
, &attribs
)) {
919 /* the window doesn't exist anymore */
923 if (wwin
->flags
.miniaturized
) {
928 if (wwin
->transient_for
!=None
) {
929 WWindow
*owner
= wWindowFor(wwin
->transient_for
);
931 if (owner
&& owner
->flags
.miniaturized
)
935 present
= wwin
->frame
->workspace
==wwin
->screen_ptr
->current_workspace
;
937 /* if the window is in another workspace, simplify process */
939 /* icon creation may take a while */
940 XGrabPointer(dpy
, wwin
->screen_ptr
->root_win
, False
,
941 ButtonMotionMask
|ButtonReleaseMask
, GrabModeAsync
,
942 GrabModeAsync
, None
, None
, CurrentTime
);
945 if (!wPreferences
.disable_miniwindows
) {
946 if (!wwin
->flags
.icon_moved
) {
947 PlaceIcon(wwin
->screen_ptr
, &wwin
->icon_x
, &wwin
->icon_y
);
949 wwin
->icon
= wIconCreate(wwin
);
951 wwin
->icon
->mapped
= 1;
954 wwin
->flags
.miniaturized
= 1;
955 wwin
->flags
.mapped
= 0;
957 /* unmap transients */
959 unmapTransientsFor(wwin
);
962 wSoundPlay(WSOUND_ICONIFY
);
964 XUngrabPointer(dpy
, CurrentTime
);
966 /* let all Expose events arrive so that we can repaint
967 * something before the animation starts (and the server is grabbed) */
970 if (wPreferences
.disable_miniwindows
)
971 wClientSetState(wwin
, IconicState
, None
);
973 wClientSetState(wwin
, IconicState
, wwin
->icon
->icon_win
);
977 if (!wwin
->screen_ptr
->flags
.startup
&& !wwin
->flags
.skip_next_animation
978 && !wPreferences
.no_animations
) {
981 if (!wPreferences
.disable_miniwindows
) {
984 iw
= wwin
->icon
->core
->width
;
985 ih
= wwin
->icon
->core
->height
;
990 if (wKWMGetIconGeometry(wwin
, &area
)) {
996 #endif /* KWM_HINTS */
1000 iw
= wwin
->screen_ptr
->scr_width
;
1001 ih
= wwin
->screen_ptr
->scr_height
;
1004 animateResize(wwin
->screen_ptr
, wwin
->frame_x
, wwin
->frame_y
,
1005 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1006 ix
, iy
, iw
, ih
, False
);
1011 wwin
->flags
.skip_next_animation
= 0;
1013 if (!wPreferences
.disable_miniwindows
) {
1015 if (wwin
->screen_ptr
->current_workspace
==wwin
->frame
->workspace
||
1016 IS_OMNIPRESENT(wwin
) || wPreferences
.sticky_icons
)
1018 XMapWindow(dpy
, wwin
->icon
->core
->window
);
1020 AddToStackList(wwin
->icon
->core
);
1022 wLowerFrame(wwin
->icon
->core
);
1026 WWindow
*owner
= recursiveTransientFor(wwin
->screen_ptr
->focused_window
);
1029 * It doesn't seem to be working and causes button event hangup
1030 * when deiconifying a transient window.
1031 setupIconGrabs(wwin->icon);
1033 if ((wwin
->flags
.focused
1034 || (owner
&& wwin
->client_win
== owner
->client_win
))
1035 && wPreferences
.focus_mode
==WKF_CLICK
) {
1040 if (!WFLAGP(tmp
, no_focusable
)
1041 && !(tmp
->flags
.hidden
||tmp
->flags
.miniaturized
)
1042 && (wwin
->frame
->workspace
== tmp
->frame
->workspace
))
1046 wSetFocusTo(wwin
->screen_ptr
, tmp
);
1047 } else if (wPreferences
.focus_mode
!=WKF_CLICK
) {
1048 wSetFocusTo(wwin
->screen_ptr
, NULL
);
1052 if (!wwin
->screen_ptr
->flags
.startup
) {
1053 Window clientwin
= wwin
->client_win
;
1056 processEvents(XPending(dpy
));
1058 /* the window can disappear while doing the processEvents() */
1059 if (!wWindowFor(clientwin
))
1066 if (wwin
->flags
.selected
&& !wPreferences
.disable_miniwindows
)
1067 wIconSelect(wwin
->icon
);
1070 wGNOMEUpdateClientStateHint(wwin
, False
);
1073 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
1074 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
1077 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1084 wDeiconifyWindow(WWindow
*wwin
)
1086 wWindowChangeWorkspace(wwin
, wwin
->screen_ptr
->current_workspace
);
1088 if (!wwin
->flags
.miniaturized
)
1091 if (wwin
->transient_for
!= None
1092 && wwin
->transient_for
!= wwin
->screen_ptr
->root_win
) {
1093 WWindow
*owner
= recursiveTransientFor(wwin
);
1095 if (owner
&& owner
->flags
.miniaturized
) {
1096 wDeiconifyWindow(owner
);
1097 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1098 wRaiseFrame(wwin
->frame
->core
);
1103 wwin
->flags
.miniaturized
= 0;
1104 if (!wwin
->flags
.shaded
)
1105 wwin
->flags
.mapped
= 1;
1107 if (!wPreferences
.disable_miniwindows
) {
1108 if (wwin
->icon
->selected
)
1109 wIconSelect(wwin
->icon
);
1111 XUnmapWindow(dpy
, wwin
->icon
->core
->window
);
1114 wSoundPlay(WSOUND_DEICONIFY
);
1116 /* if the window is in another workspace, do it silently */
1118 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
1119 && !wwin
->flags
.skip_next_animation
) {
1122 if (!wPreferences
.disable_miniwindows
) {
1125 iw
= wwin
->icon
->core
->width
;
1126 ih
= wwin
->icon
->core
->height
;
1131 if (wKWMGetIconGeometry(wwin
, &area
)) {
1137 #endif /* KWM_HINTS */
1141 iw
= wwin
->screen_ptr
->scr_width
;
1142 ih
= wwin
->screen_ptr
->scr_height
;
1145 animateResize(wwin
->screen_ptr
, ix
, iy
, iw
, ih
,
1146 wwin
->frame_x
, wwin
->frame_y
,
1147 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1150 #endif /* ANIMATIONS */
1151 wwin
->flags
.skip_next_animation
= 0;
1153 if (!wwin
->flags
.shaded
) {
1154 XMapWindow(dpy
, wwin
->client_win
);
1156 XMapWindow(dpy
, wwin
->frame
->core
->window
);
1157 wRaiseFrame(wwin
->frame
->core
);
1158 if (!wwin
->flags
.shaded
) {
1159 wClientSetState(wwin
, NormalState
, None
);
1161 mapTransientsFor(wwin
);
1163 if (!wPreferences
.disable_miniwindows
) {
1164 RemoveFromStackList(wwin
->icon
->core
);
1165 /* removeIconGrabs(wwin->icon);*/
1166 wIconDestroy(wwin
->icon
);
1171 if (wPreferences
.focus_mode
==WKF_CLICK
)
1172 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1175 if (!wwin
->screen_ptr
->flags
.startup
) {
1176 Window clientwin
= wwin
->client_win
;
1179 processEvents(XPending(dpy
));
1181 if (!wWindowFor(clientwin
))
1186 if (wPreferences
.auto_arrange_icons
) {
1187 wArrangeIcons(wwin
->screen_ptr
, True
);
1191 wGNOMEUpdateClientStateHint(wwin
, False
);
1194 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
1195 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
1198 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1204 hideWindow(WIcon
*icon
, int icon_x
, int icon_y
, WWindow
*wwin
, int animate
)
1206 if (wwin
->flags
.miniaturized
) {
1208 XUnmapWindow(dpy
, wwin
->icon
->core
->window
);
1209 wwin
->icon
->mapped
= 0;
1211 wwin
->flags
.hidden
= 1;
1213 wGNOMEUpdateClientStateHint(wwin
, False
);
1216 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1221 if (wwin
->flags
.inspector_open
) {
1222 wHideInspectorForWindow(wwin
);
1225 wwin
->flags
.hidden
= 1;
1228 wClientSetState(wwin
, IconicState
, icon
->icon_win
);
1230 wSoundPlay(WSOUND_HIDE
);
1232 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
&&
1233 !wwin
->flags
.skip_next_animation
&& animate
) {
1234 animateResize(wwin
->screen_ptr
, wwin
->frame_x
, wwin
->frame_y
,
1235 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1236 icon_x
, icon_y
, icon
->core
->width
, icon
->core
->height
,
1240 wwin
->flags
.skip_next_animation
= 0;
1243 wGNOMEUpdateClientStateHint(wwin
, False
);
1246 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1252 wHideOtherApplications(WWindow
*awin
)
1259 wwin
= awin
->screen_ptr
->focused_window
;
1264 && wwin
->frame
->workspace
== awin
->screen_ptr
->current_workspace
1265 && !(wwin
->flags
.miniaturized
||wwin
->flags
.hidden
)
1266 && !wwin
->flags
.internal_window
1267 && wGetWindowOfInspectorForWindow(wwin
) != awin
1268 && !WFLAGP(wwin
, no_hide_others
)) {
1270 if (wwin
->main_window
==None
|| WFLAGP(wwin
, no_appicon
)) {
1271 if (!WFLAGP(wwin
, no_miniaturizable
)) {
1272 wwin
->flags
.skip_next_animation
= 1;
1273 wIconifyWindow(wwin
);
1275 } else if (wwin
->main_window
!=None
1276 && awin
->main_window
!= wwin
->main_window
) {
1277 tapp
= wApplicationOf(wwin
->main_window
);
1279 tapp
->flags
.skip_next_animation
= 1;
1280 wHideApplication(tapp
);
1282 if (!WFLAGP(wwin
, no_miniaturizable
)) {
1283 wwin
->flags
.skip_next_animation
= 1;
1284 wIconifyWindow(wwin
);
1292 wSetFocusTo(awin->screen_ptr, awin);
1299 wHideApplication(WApplication
*wapp
)
1306 wwarning("trying to hide a non grouped window");
1309 if (!wapp
->main_window_desc
) {
1310 wwarning("group leader not found for window group");
1313 scr
= wapp
->main_window_desc
->screen_ptr
;
1315 wlist
= scr
->focused_window
;
1319 if (wlist
->main_window
== wapp
->main_window
)
1320 wapp
->last_focused
= wlist
;
1322 wapp
->last_focused
= NULL
;
1324 if (wlist
->main_window
== wapp
->main_window
) {
1325 if (wlist
->flags
.focused
) {
1329 hideWindow(wapp
->app_icon
->icon
, wapp
->app_icon
->x_pos
,
1330 wapp
->app_icon
->y_pos
, wlist
,
1331 !wapp
->flags
.skip_next_animation
);
1333 wlist
= wlist
->prev
;
1336 wapp
->flags
.skip_next_animation
= 0;
1339 if (wPreferences
.focus_mode
==WKF_CLICK
) {
1340 wlist
= scr
->focused_window
;
1342 if (!WFLAGP(wlist
, no_focusable
) && !wlist
->flags
.hidden
1343 && (wlist
->flags
.mapped
|| wlist
->flags
.shaded
))
1345 wlist
= wlist
->prev
;
1347 wSetFocusTo(scr
, wlist
);
1349 wSetFocusTo(scr
, NULL
);
1353 wapp
->flags
.hidden
= 1;
1355 if(wPreferences
.auto_arrange_icons
) {
1356 wArrangeIcons(scr
, True
);
1360 wAppIconPaint(wapp
->app_icon
);
1368 unhideWindow(WIcon
*icon
, int icon_x
, int icon_y
, WWindow
*wwin
, int animate
,
1369 int bringToCurrentWS
)
1371 if (bringToCurrentWS
)
1372 wWindowChangeWorkspace(wwin
, wwin
->screen_ptr
->current_workspace
);
1374 wwin
->flags
.hidden
=0;
1375 wwin
->flags
.mapped
=1;
1377 wSoundPlay(WSOUND_UNHIDE
);
1379 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
1381 animateResize(wwin
->screen_ptr
, icon_x
, icon_y
,
1382 icon
->core
->width
, icon
->core
->height
,
1383 wwin
->frame_x
, wwin
->frame_y
,
1384 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1388 wwin
->flags
.skip_next_animation
= 0;
1389 XMapWindow(dpy
, wwin
->client_win
);
1390 XMapWindow(dpy
, wwin
->frame
->core
->window
);
1391 wClientSetState(wwin
, NormalState
, None
);
1392 wRaiseFrame(wwin
->frame
->core
);
1393 if (wwin
->flags
.inspector_open
) {
1394 wUnhideInspectorForWindow(wwin
);
1398 wGNOMEUpdateClientStateHint(wwin
, False
);
1401 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1407 wUnhideApplication(WApplication
*wapp
, Bool miniwindows
, Bool bringToCurrentWS
)
1410 WWindow
*wlist
, *next
;
1411 WWindow
*focused
=NULL
;
1416 scr
= wapp
->main_window_desc
->screen_ptr
;
1417 wlist
= scr
->focused_window
;
1419 /* goto beginning of list */
1421 wlist
= wlist
->prev
;
1426 if (wlist
->main_window
== wapp
->main_window
) {
1427 if (wlist
->flags
.focused
)
1429 else if (!focused
|| !focused
->flags
.focused
)
1432 if (wlist
->flags
.miniaturized
&& wlist
->icon
) {
1433 if (bringToCurrentWS
|| wPreferences
.sticky_icons
1434 || wlist
->frame
->workspace
== scr
->current_workspace
) {
1435 if (!wlist
->icon
->mapped
) {
1436 XMapWindow(dpy
, wlist
->icon
->core
->window
);
1437 wlist
->icon
->mapped
= 1;
1439 wlist
->flags
.hidden
= 0;
1441 UpdateSwitchMenu(scr
, wlist
, ACTION_CHANGE_STATE
);
1443 if (wlist
->frame
->workspace
!= scr
->current_workspace
)
1444 wWindowChangeWorkspace(wlist
, scr
->current_workspace
);
1447 wDeiconifyWindow(wlist
);
1449 } else if (wlist
->flags
.hidden
) {
1450 unhideWindow(wapp
->app_icon
->icon
, wapp
->app_icon
->x_pos
,
1451 wapp
->app_icon
->y_pos
, wlist
,
1452 !wapp
->flags
.skip_next_animation
,
1455 if (bringToCurrentWS
1456 && wlist
->frame
->workspace
!= scr
->current_workspace
) {
1457 wWindowChangeWorkspace(wlist
, scr
->current_workspace
);
1459 wRaiseFrame(wlist
->frame
->core
);
1465 wapp
->flags
.skip_next_animation
= 0;
1466 wapp
->flags
.hidden
= 0;
1469 wSetFocusTo(scr
, focused
);
1470 else if (wapp
->last_focused
&& wapp
->last_focused
->flags
.mapped
)
1471 wSetFocusTo(scr
, wapp
->last_focused
);
1472 wapp
->last_focused
= NULL
;
1473 if (wPreferences
.auto_arrange_icons
) {
1474 wArrangeIcons(scr
, True
);
1477 wAppIconPaint(wapp
->app_icon
);
1484 wShowAllWindows(WScreen
*scr
)
1486 WWindow
*wwin
, *old_foc
;
1489 old_foc
= wwin
= scr
->focused_window
;
1491 if (!wwin
->flags
.internal_window
&&
1492 (scr
->current_workspace
== wwin
->frame
->workspace
1493 || IS_OMNIPRESENT(wwin
))) {
1494 if (wwin
->flags
.miniaturized
) {
1495 wwin
->flags
.skip_next_animation
= 1;
1496 wDeiconifyWindow(wwin
);
1497 } else if (wwin
->flags
.hidden
) {
1498 wapp
= wApplicationOf(wwin
->main_window
);
1500 wUnhideApplication(wapp
, False
, False
);
1502 wwin
->flags
.skip_next_animation
= 1;
1503 wDeiconifyWindow(wwin
);
1509 wSetFocusTo(scr
, old_foc
);
1510 /*wRaiseFrame(old_foc->frame->core);*/
1515 wRefreshDesktop(WScreen
*scr
)
1518 XSetWindowAttributes attr
;
1520 attr
.backing_store
= NotUseful
;
1521 attr
.save_under
= False
;
1522 win
= XCreateWindow(dpy
, scr
->root_win
, 0, 0, scr
->scr_width
,
1523 scr
->scr_height
, 0, CopyFromParent
, CopyFromParent
,
1524 (Visual
*)CopyFromParent
, CWBackingStore
|CWSaveUnder
,
1526 XMapRaised(dpy
, win
);
1527 XDestroyWindow(dpy
, win
);
1533 wArrangeIcons(WScreen
*scr
, Bool arrangeAll
)
1537 int pf
; /* primary axis */
1538 int sf
; /* secondary axis */
1542 int sx1
, sx2
, sy1
, sy2
; /* screen boundary */
1546 int isize
= wPreferences
.icon_size
;
1549 * Find out screen boundaries.
1553 sx2
= scr
->scr_width
;
1554 sy2
= scr
->scr_height
;
1556 if (scr
->dock
->on_right_side
)
1557 sx2
-= isize
+ DOCK_EXTRA_SPACE
;
1559 sx1
+= isize
+ DOCK_EXTRA_SPACE
;
1562 sw
= isize
* (scr
->scr_width
/isize
);
1563 sh
= isize
* (scr
->scr_height
/isize
);
1564 fullW
= (sx2
-sx1
)/isize
;
1565 fullH
= (sy2
-sy1
)/isize
;
1567 /* icon yard boundaries */
1568 if (wPreferences
.icon_yard
& IY_VERT
) {
1575 if (wPreferences
.icon_yard
& IY_RIGHT
) {
1582 if (wPreferences
.icon_yard
& IY_TOP
) {
1590 /* arrange icons putting the most recently focused window
1591 * as the last icon */
1592 #define X ((wPreferences.icon_yard & IY_VERT) ? xo + xs*(si*isize)\
1593 : xo + xs*(pi*isize))
1594 #define Y ((wPreferences.icon_yard & IY_VERT) ? yo + ys*(pi*isize)\
1595 : yo + ys*(si*isize))
1597 /* arrange application icons */
1598 aicon
= scr
->app_icon_list
;
1599 /* reverse them to avoid unnecessarily sliding of icons */
1600 while (aicon
&& aicon
->next
)
1601 aicon
= aicon
->next
;
1606 if (!aicon
->docked
&& wAppIconIsFirstInstance(aicon
)) {
1607 if (aicon
->x_pos
!= X
|| aicon
->y_pos
!= Y
) {
1609 if (!wPreferences
.no_animations
) {
1610 SlideWindow(aicon
->icon
->core
->window
, aicon
->x_pos
, aicon
->y_pos
,
1613 #endif /* ANIMATIONS */
1615 wAppIconMove(aicon
, X
, Y
);
1618 /* we reversed the order so we use prev */
1619 aicon
= aicon
->prev
;
1626 /* arrange miniwindows */
1628 wwin
= scr
->focused_window
;
1629 /* reverse them to avoid unnecessarily shuffling */
1630 while (wwin
&& wwin
->prev
)
1634 if (wwin
->icon
&& wwin
->flags
.miniaturized
&& !wwin
->flags
.hidden
&&
1635 (wwin
->frame
->workspace
==scr
->current_workspace
||
1636 IS_OMNIPRESENT(wwin
) || wPreferences
.sticky_icons
)) {
1638 if (arrangeAll
|| !wwin
->flags
.icon_moved
) {
1639 if (wwin
->icon_x
!= X
|| wwin
->icon_y
!= Y
) {
1641 if (wPreferences
.no_animations
) {
1642 XMoveWindow(dpy
, wwin
->icon
->core
->window
, X
, Y
);
1644 SlideWindow(wwin
->icon
->core
->window
, wwin
->icon_x
,
1645 wwin
->icon_y
, X
, Y
);
1648 XMoveWindow(dpy
, wwin
->icon
->core
->window
, X
, Y
);
1649 #endif /* ANIMATIONS */
1657 wwin
->flags
.icon_moved
= 0;
1659 /* we reversed the order, so we use next */
1670 wSelectWindow(WWindow
*wwin
, Bool flag
)
1672 WScreen
*scr
= wwin
->screen_ptr
;
1675 wwin
->flags
.selected
= 1;
1676 XSetWindowBorder(dpy
, wwin
->frame
->core
->window
, scr
->white_pixel
);
1678 if (WFLAGP(wwin
, no_border
)) {
1679 XSetWindowBorderWidth(dpy
, wwin
->frame
->core
->window
,
1680 FRAME_BORDER_WIDTH
);
1683 if (!scr
->selected_windows
)
1684 scr
->selected_windows
= WMCreateArray(4);
1685 WMAddToArray(scr
->selected_windows
, wwin
);
1687 wwin
->flags
.selected
= 0;
1688 XSetWindowBorder(dpy
, wwin
->frame
->core
->window
,
1689 scr
->frame_border_pixel
);
1691 if (WFLAGP(wwin
, no_border
)) {
1692 XSetWindowBorderWidth(dpy
, wwin
->frame
->core
->window
, 0);
1695 if (scr
->selected_windows
) {
1696 WMRemoveFromArray(scr
->selected_windows
, wwin
);
1703 wMakeWindowVisible(WWindow
*wwin
)
1705 if (wwin
->frame
->workspace
!= wwin
->screen_ptr
->current_workspace
)
1706 wWorkspaceChange(wwin
->screen_ptr
, wwin
->frame
->workspace
);
1708 if (wwin
->flags
.shaded
) {
1709 wUnshadeWindow(wwin
);
1711 if (wwin
->flags
.hidden
) {
1714 app
= wApplicationOf(wwin
->main_window
);
1716 wUnhideApplication(app
, False
, False
);
1717 } else if (wwin
->flags
.miniaturized
) {
1718 wDeiconifyWindow(wwin
);
1720 if (!WFLAGP(wwin
, no_focusable
))
1721 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1722 wRaiseFrame(wwin
->frame
->core
);