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
;
73 /******* Local Variables *******/
78 {SHADE_STEPS_UF
, SHADE_DELAY_UF
},
79 {SHADE_STEPS_F
, SHADE_DELAY_F
},
80 {SHADE_STEPS_M
, SHADE_DELAY_M
},
81 {SHADE_STEPS_S
, SHADE_DELAY_S
},
82 {SHADE_STEPS_U
, SHADE_DELAY_U
}};
84 #define SHADE_STEPS shadePars[(int)wPreferences.shade_speed].steps
85 #define SHADE_DELAY shadePars[(int)wPreferences.shade_speed].delay
88 static int ignoreTimestamp
=0;
93 processEvents(int event_count
)
98 * This is a hack. When animations are enabled, processing of
99 * events ocurred during a animation are delayed until it's end.
100 * Calls that consider the TimeStamp, like XSetInputFocus(), will
101 * fail because the TimeStamp is too old. Then, for example, if
102 * the user changes window focus while a miniaturize animation is
103 * in course, the window will not get focus properly after the end
104 * of the animation. This tries to workaround it by passing CurrentTime
105 * as the TimeStamp for XSetInputFocus() for all events ocurred during
109 while (XPending(dpy
) && event_count
--) {
110 WMNextEvent(dpy
, &event
);
111 WMHandleEvent(&event
);
115 #endif /* ANIMATIONS */
120 *----------------------------------------------------------------------
122 * Changes the window focus to the one passed as argument.
123 * If the window to focus is not already focused, it will be brought
124 * to the head of the list of windows. Previously focused window is
128 * Window list may be reordered and the window focus is changed.
130 *----------------------------------------------------------------------
133 wSetFocusTo(WScreen
*scr
, WWindow
*wwin
)
135 WWindow
*focused
=scr
->focused_window
;
136 WWindow
*owner
= NULL
;
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
) {
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 */
213 if (wwin
->client_win
== focused
->transient_for
)
214 wwin
->flags
.semi_focused
= 0;
215 else if (wwin
->transient_for
== focused
->client_win
)
216 focused
->flags
.semi_focused
= 1;
218 if (wwin
->transient_for
219 && wwin
->transient_for
== focused
->transient_for
) {
220 owner
= wWindowFor(wwin
->transient_for
);
221 if (owner
&& owner
->flags
.semi_focused
) {
223 /* this is to override the unfocusing of the mainwindow
224 * in the next wWindowUnfocus() and avoid flickering */
225 owner
->flags
.semi_focused
= 0;
228 /* unfocus previous window */
229 wWindowUnfocus(focused
);
231 owner
->flags
.semi_focused
= 1;
233 /* change the focus window list order */
235 wwin
->prev
->next
=wwin
->next
;
237 wwin
->next
->prev
=wwin
->prev
;
239 wwin
->prev
= focused
;
240 focused
->next
= wwin
;
242 scr
->focused_window
= wwin
;
244 if (oapp
&& oapp
!= napp
) {
245 wAppMenuUnmap(oapp
->menu
);
247 wApplicationDeactivate(oapp
);
251 if ((owner
=wWindowFor(wwin
->transient_for
))
252 && !owner
->flags
.semi_focused
) {
253 owner
->flags
.semi_focused
= 1;
254 wWindowUnfocus(owner
);
257 if (napp
&& !wasfocused
) {
258 wAppMenuMap(napp
->menu
, wwin
);
260 wApplicationActivate(napp
);
264 wKWMUpdateActiveWindowHint(scr
);
265 wKWMSendEventMessage(wwin
, WKWMFocusWindow
);
272 wShadeWindow(WWindow
*wwin
)
274 XWindowAttributes attribs
;
275 time_t time0
= time(NULL
);
280 if (wwin
->flags
.shaded
)
283 XLowerWindow(dpy
, wwin
->client_win
);
286 wSoundPlay(WMSOUND_SHADE
);
290 if (!wwin
->screen_ptr
->flags
.startup
&& !wwin
->flags
.skip_next_animation
291 && !wPreferences
.no_animations
) {
292 /* do the shading animation */
293 h
= wwin
->frame
->core
->height
;
296 w
= wwin
->frame
->core
->width
;
297 y
= wwin
->frame
->top_width
;
298 while (h
>wwin
->frame
->top_width
+1) {
299 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
300 XResizeWindow(dpy
, wwin
->frame
->core
->window
, w
, h
);
303 if (time(NULL
)-time0
> MAX_ANIMATION_TIME
)
307 wusleep(SHADE_DELAY
*1000L);
311 XMoveWindow(dpy
, wwin
->client_win
, 0, wwin
->frame
->top_width
);
313 #endif /* ANIMATIONS */
315 wwin
->flags
.skip_next_animation
= 0;
316 wwin
->flags
.shaded
= 1;
317 wwin
->flags
.mapped
=0;
318 XGetWindowAttributes(dpy
, wwin
->client_win
, &attribs
);
319 /* prevent window withdrawal when getting UnmapNotify */
320 XSelectInput(dpy
, wwin
->client_win
,
321 attribs
.your_event_mask
& ~StructureNotifyMask
);
322 XUnmapWindow(dpy
, wwin
->client_win
);
323 XSelectInput(dpy
, wwin
->client_win
, attribs
.your_event_mask
);
325 /* for the client it's just like iconification */
326 wFrameWindowResize(wwin
->frame
, wwin
->frame
->core
->width
,
327 wwin
->frame
->top_width
- 1);
329 wwin
->client
.y
= wwin
->frame_y
- wwin
->client
.height
330 + wwin
->frame
->top_width
;
331 wWindowSynthConfigureNotify(wwin
);
334 wClientSetState(wwin, IconicState, None);
338 wGNOMEUpdateClientStateHint(wwin
, False
);
341 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
342 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
344 /* update window list to reflect shaded state */
345 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
348 if (!wwin
->screen_ptr
->flags
.startup
) {
349 /* Look at processEvents() for reason of this code. */
351 processEvents(XPending(dpy
));
358 wUnshadeWindow(WWindow
*wwin
)
360 time_t time0
= time(NULL
);
363 #endif /* ANIMATIONS */
366 if (!wwin
->flags
.shaded
)
369 wwin
->flags
.shaded
= 0;
370 wwin
->flags
.mapped
= 1;
371 XMapWindow(dpy
, wwin
->client_win
);
374 wSoundPlay(WMSOUND_UNSHADE
);
378 if (!wPreferences
.no_animations
&& !wwin
->flags
.skip_next_animation
) {
379 /* do the shading animation */
380 h
= wwin
->frame
->top_width
+ wwin
->frame
->bottom_width
;
381 y
= wwin
->frame
->top_width
- wwin
->client
.height
;
382 s
= abs(y
)/SHADE_STEPS
;
384 w
= wwin
->frame
->core
->width
;
385 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
387 while (h
< wwin
->client
.height
+ wwin
->frame
->top_width
388 + wwin
->frame
->bottom_width
) {
389 XResizeWindow(dpy
, wwin
->frame
->core
->window
, w
, h
);
390 XMoveWindow(dpy
, wwin
->client_win
, 0, y
);
393 wusleep(SHADE_DELAY
*2000L/3);
397 if (time(NULL
)-time0
> MAX_ANIMATION_TIME
)
401 XMoveWindow(dpy
, wwin
->client_win
, 0, wwin
->frame
->top_width
);
403 #endif /* ANIMATIONS */
405 wwin
->flags
.skip_next_animation
= 0;
406 wFrameWindowResize(wwin
->frame
, wwin
->frame
->core
->width
,
407 wwin
->frame
->top_width
+ wwin
->client
.height
408 + wwin
->frame
->bottom_width
);
410 wwin
->client
.y
= wwin
->frame_y
+ wwin
->frame
->top_width
;
411 wWindowSynthConfigureNotify(wwin
);
414 wClientSetState(wwin, NormalState, None);
416 /* if the window is focused, set the focus again as it was disabled during
418 if (wwin
->flags
.focused
)
419 wSetFocusTo(wwin
->screen_ptr
, wwin
);
422 wGNOMEUpdateClientStateHint(wwin
, False
);
425 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
426 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
429 /* update window list to reflect unshaded state */
430 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
436 wMaximizeWindow(WWindow
*wwin
, int directions
)
438 int new_width
, new_height
, new_x
, new_y
;
439 WArea usableArea
= wwin
->screen_ptr
->totalUsableArea
;
441 if (wwin
->flags
.shaded
) {
442 wwin
->flags
.skip_next_animation
= 1;
443 wUnshadeWindow(wwin
);
445 wwin
->flags
.maximized
= directions
;
446 wwin
->old_geometry
.width
= wwin
->client
.width
;
447 wwin
->old_geometry
.height
= wwin
->client
.height
;
448 wwin
->old_geometry
.x
= wwin
->frame_x
;
449 wwin
->old_geometry
.y
= wwin
->frame_y
;
452 wKWMUpdateClientGeometryRestore(wwin
);
455 if (directions
& MAX_HORIZONTAL
) {
457 new_width
= (usableArea
.x2
-usableArea
.x1
)-FRAME_BORDER_WIDTH
*2;
458 new_x
= usableArea
.x1
;
462 new_x
= wwin
->frame_x
;
463 new_width
= wwin
->frame
->core
->width
;
467 if (directions
& MAX_VERTICAL
) {
469 new_height
= (usableArea
.y2
-usableArea
.y1
)-FRAME_BORDER_WIDTH
*2;
470 new_y
= usableArea
.y1
;
474 new_y
= wwin
->frame_y
;
475 new_height
= wwin
->frame
->core
->height
;
478 new_height
-= wwin
->frame
->top_width
+wwin
->frame
->bottom_width
;
480 wWindowConstrainSize(wwin
, &new_width
, &new_height
);
481 wWindowConfigure(wwin
, new_x
, new_y
, new_width
, new_height
);
484 wGNOMEUpdateClientStateHint(wwin
, False
);
487 wKWMUpdateClientStateHint(wwin
, KWMMaximizedFlag
);
488 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
492 wSoundPlay(WMSOUND_MAXIMIZE
);
498 wUnmaximizeWindow(WWindow
*wwin
)
500 int restore_x
, restore_y
;
502 if (!wwin
->flags
.maximized
)
505 if (wwin
->flags
.shaded
) {
506 wwin
->flags
.skip_next_animation
= 1;
507 wUnshadeWindow(wwin
);
509 restore_x
= (wwin
->flags
.maximized
& MAX_HORIZONTAL
) ?
510 wwin
->old_geometry
.x
: wwin
->frame_x
;
511 restore_y
= (wwin
->flags
.maximized
& MAX_VERTICAL
) ?
512 wwin
->old_geometry
.y
: wwin
->frame_y
;
513 wwin
->flags
.maximized
= 0;
514 wWindowConfigure(wwin
, restore_x
, restore_y
,
515 wwin
->old_geometry
.width
, wwin
->old_geometry
.height
);
518 wGNOMEUpdateClientStateHint(wwin
, False
);
521 wKWMUpdateClientStateHint(wwin
, KWMMaximizedFlag
);
522 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
526 wSoundPlay(WMSOUND_UNMAXIMIZE
);
532 animateResizeFlip(WScreen
*scr
, int x
, int y
, int w
, int h
,
533 int fx
, int fy
, int fw
, int fh
, int steps
)
535 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_F)
536 float cx
, cy
, cw
, ch
;
537 float xstep
, ystep
, wstep
, hstep
;
540 float angle
, final_angle
, delta
;
542 xstep
= (float)(fx
-x
)/steps
;
543 ystep
= (float)(fy
-y
)/steps
;
544 wstep
= (float)(fw
-w
)/steps
;
545 hstep
= (float)(fh
-h
)/steps
;
552 final_angle
= 2*WM_PI
*MINIATURIZE_ANIMATION_TWIST_F
;
553 delta
= (float)(final_angle
/FRAMES
);
554 for (angle
=0;; angle
+=delta
) {
555 if (angle
> final_angle
)
558 dx
= (cw
/10) - ((cw
/5) * sin(angle
));
559 dch
= (ch
/2) * cos(angle
);
562 points
[0].x
= cx
+ dx
; points
[0].y
= midy
- dch
;
563 points
[1].x
= cx
+ cw
- dx
; points
[1].y
= points
[0].y
;
564 points
[2].x
= cx
+ cw
+ dx
; points
[2].y
= midy
+ dch
;
565 points
[3].x
= cx
- dx
; points
[3].y
= points
[2].y
;
566 points
[4].x
= points
[0].x
; points
[4].y
= points
[0].y
;
569 XDrawLines(dpy
,scr
->root_win
,scr
->frame_gc
,points
, 5, CoordModeOrigin
);
571 #if (MINIATURIZE_ANIMATION_DELAY_F > 0)
572 wusleep(MINIATURIZE_ANIMATION_DELAY_F
);
575 XDrawLines(dpy
,scr
->root_win
,scr
->frame_gc
,points
, 5, CoordModeOrigin
);
581 if (angle
>= final_angle
)
591 animateResizeTwist(WScreen
*scr
, int x
, int y
, int w
, int h
,
592 int fx
, int fy
, int fw
, int fh
, int steps
)
594 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_T)
595 float cx
, cy
, cw
, ch
;
596 float xstep
, ystep
, wstep
, hstep
;
598 float angle
, final_angle
, a
, d
, delta
;
605 xstep
= (float)(fx
-x
)/steps
;
606 ystep
= (float)(fy
-y
)/steps
;
607 wstep
= (float)(fw
-w
)/steps
;
608 hstep
= (float)(fh
-h
)/steps
;
615 final_angle
= 2*WM_PI
*MINIATURIZE_ANIMATION_TWIST_T
;
616 delta
= (float)(final_angle
/FRAMES
);
617 for (angle
=0;; angle
+=delta
) {
618 if (angle
> final_angle
)
622 d
= sqrt((cw
/2)*(cw
/2)+(ch
/2)*(ch
/2));
624 points
[0].x
= cx
+cos(angle
-a
)*d
;
625 points
[0].y
= cy
+sin(angle
-a
)*d
;
626 points
[1].x
= cx
+cos(angle
+a
)*d
;
627 points
[1].y
= cy
+sin(angle
+a
)*d
;
628 points
[2].x
= cx
+cos(angle
-a
+WM_PI
)*d
;
629 points
[2].y
= cy
+sin(angle
-a
+WM_PI
)*d
;
630 points
[3].x
= cx
+cos(angle
+a
+WM_PI
)*d
;
631 points
[3].y
= cy
+sin(angle
+a
+WM_PI
)*d
;
632 points
[4].x
= cx
+cos(angle
-a
)*d
;
633 points
[4].y
= cy
+sin(angle
-a
)*d
;
635 XDrawLines(dpy
, scr
->root_win
, scr
->frame_gc
, points
, 5, CoordModeOrigin
);
637 #if (MINIATURIZE_ANIMATION_DELAY_T > 0)
638 wusleep(MINIATURIZE_ANIMATION_DELAY_T
);
641 XDrawLines(dpy
, scr
->root_win
, scr
->frame_gc
, points
, 5, CoordModeOrigin
);
647 if (angle
>= final_angle
)
657 animateResizeZoom(WScreen
*scr
, int x
, int y
, int w
, int h
,
658 int fx
, int fy
, int fw
, int fh
, int steps
)
660 #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_Z)
661 float cx
[FRAMES
], cy
[FRAMES
], cw
[FRAMES
], ch
[FRAMES
];
662 float xstep
, ystep
, wstep
, hstep
;
665 xstep
= (float)(fx
-x
)/steps
;
666 ystep
= (float)(fy
-y
)/steps
;
667 wstep
= (float)(fw
-w
)/steps
;
668 hstep
= (float)(fh
-h
)/steps
;
670 for (j
=0; j
<FRAMES
; j
++) {
677 for (i
=0; i
<steps
; i
++) {
678 for (j
=0; j
<FRAMES
; j
++) {
679 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
680 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
683 #if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
684 wusleep(MINIATURIZE_ANIMATION_DELAY_Z
);
686 for (j
=0; j
<FRAMES
; j
++) {
687 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
688 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
703 for (j
=0; j
<FRAMES
; j
++) {
704 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
705 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
708 #if (MINIATURIZE_ANIMATION_DELAY_Z > 0)
709 wusleep(MINIATURIZE_ANIMATION_DELAY_Z
);
711 for (j
=0; j
<FRAMES
; j
++) {
712 XDrawRectangle(dpy
, scr
->root_win
, scr
->frame_gc
,
713 (int)cx
[j
], (int)cy
[j
], (int)cw
[j
], (int)ch
[j
]);
722 animateResize(WScreen
*scr
, int x
, int y
, int w
, int h
,
723 int fx
, int fy
, int fw
, int fh
, int hiding
)
725 int style
= wPreferences
.iconification_style
; /* Catch the value */
728 if (style
== WIS_NONE
)
731 if (style
== WIS_RANDOM
) {
735 k
= (hiding
? 2 : 3);
738 steps
= (MINIATURIZE_ANIMATION_STEPS_T
* k
)/3;
740 animateResizeTwist(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
743 steps
= (MINIATURIZE_ANIMATION_STEPS_F
* k
)/3;
745 animateResizeFlip(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
749 steps
= (MINIATURIZE_ANIMATION_STEPS_Z
* k
)/3;
751 animateResizeZoom(scr
, x
, y
, w
, h
, fx
, fy
, fw
, fh
, steps
);
755 #endif /* ANIMATIONS */
763 while (XCheckTypedEvent(dpy
, Expose
, &tmpev
))
764 WMHandleEvent(&tmpev
);
769 unmapTransientsFor(WWindow
*wwin
)
772 XWindowAttributes attribs
;
775 tmp
= wwin
->screen_ptr
->focused_window
;
777 /* unmap the transients for this transient */
778 if (tmp
!=wwin
&& tmp
->transient_for
== wwin
->client_win
779 && (tmp
->flags
.mapped
|| wwin
->screen_ptr
->flags
.startup
780 || tmp
->flags
.shaded
)) {
781 unmapTransientsFor(tmp
);
782 XGetWindowAttributes(dpy
, tmp
->client_win
, &attribs
);
783 tmp
->flags
.miniaturized
=1;
784 if (!tmp
->flags
.shaded
) {
787 XUnmapWindow(dpy
, tmp
->frame
->core
->window
);
790 if (!tmp->flags.shaded)
792 wClientSetState(tmp
, IconicState
, None
);
794 wKWMUpdateClientStateHint(tmp
, KWMIconifiedFlag
);
795 wKWMSendEventMessage(tmp
, WKWMRemoveWindow
);
796 tmp
->flags
.kwm_hidden_for_modules
= 1;
799 UpdateSwitchMenu(wwin
->screen_ptr
, tmp
, ACTION_CHANGE_STATE
);
808 mapTransientsFor(WWindow
*wwin
)
812 tmp
= wwin
->screen_ptr
->focused_window
;
814 /* recursively map the transients for this transient */
815 if (tmp
!=wwin
&& tmp
->transient_for
== wwin
->client_win
816 && /*!tmp->flags.mapped*/ tmp
->flags
.miniaturized
817 && tmp
->icon
==NULL
) {
818 mapTransientsFor(tmp
);
819 tmp
->flags
.miniaturized
= 0;
820 if (!tmp
->flags
.shaded
) {
823 XMapWindow(dpy
, tmp
->frame
->core
->window
);
825 tmp
->flags
.semi_focused
= 0;
827 if (!tmp->flags.shaded)
829 wClientSetState(tmp
, NormalState
, None
);
831 wKWMUpdateClientStateHint(tmp
, KWMIconifiedFlag
);
832 if (tmp
->flags
.kwm_hidden_for_modules
) {
833 wKWMSendEventMessage(tmp
, WKWMAddWindow
);
834 tmp
->flags
.kwm_hidden_for_modules
= 0;
838 UpdateSwitchMenu(wwin
->screen_ptr
, tmp
, ACTION_CHANGE_STATE
);
847 setupIconGrabs(WIcon
*icon
)
849 /* setup passive grabs on the icon */
850 XGrabButton(dpy
, Button1
, AnyModifier
, icon
->core
->window
, True
,
851 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
852 XGrabButton(dpy
, Button2
, AnyModifier
, icon
->core
->window
, True
,
853 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
854 XGrabButton(dpy
, Button3
, AnyModifier
, icon
->core
->window
, True
,
855 ButtonPressMask
, GrabModeSync
, GrabModeAsync
, None
, None
);
861 recursiveTransientFor(WWindow
*wwin
)
868 /* hackish way to detect transient_for cycle */
869 i
= wwin
->screen_ptr
->window_count
+1;
871 while (wwin
&& wwin
->transient_for
!= None
&& i
>0) {
872 wwin
= wWindowFor(wwin
->transient_for
);
876 wwarning("%s has a severely broken WM_TRANSIENT_FOR hint.",
886 removeIconGrabs(WIcon
*icon
)
888 /* remove passive grabs on the icon */
889 XUngrabButton(dpy
, Button1
, AnyModifier
, icon
->core
->window
);
890 XUngrabButton(dpy
, Button2
, AnyModifier
, icon
->core
->window
);
891 XUngrabButton(dpy
, Button3
, AnyModifier
, icon
->core
->window
);
897 wIconifyWindow(WWindow
*wwin
)
899 XWindowAttributes attribs
;
903 if (!XGetWindowAttributes(dpy
, wwin
->client_win
, &attribs
)) {
904 /* the window doesn't exist anymore */
908 if (wwin
->flags
.miniaturized
) {
913 if (wwin
->transient_for
!=None
) {
914 WWindow
*owner
= wWindowFor(wwin
->transient_for
);
916 if (owner
&& owner
->flags
.miniaturized
)
920 present
= wwin
->frame
->workspace
==wwin
->screen_ptr
->current_workspace
;
922 /* if the window is in another workspace, simplify process */
924 /* icon creation may take a while */
925 XGrabPointer(dpy
, wwin
->screen_ptr
->root_win
, False
,
926 ButtonMotionMask
|ButtonReleaseMask
, GrabModeAsync
,
927 GrabModeAsync
, None
, None
, CurrentTime
);
930 if (!wwin
->flags
.icon_moved
) {
931 PlaceIcon(wwin
->screen_ptr
, &wwin
->icon_x
, &wwin
->icon_y
);
933 wwin
->icon
= wIconCreate(wwin
);
935 wwin
->flags
.miniaturized
=1;
936 wwin
->flags
.mapped
=0;
938 /* unmap transients */
940 unmapTransientsFor(wwin
);
944 wSoundPlay(WMSOUND_ICONIFY
);
947 XUngrabPointer(dpy
, CurrentTime
);
949 /* let all Expose events arrive so that we can repaint
950 * something before the animation starts (and the server is grabbed) */
952 wClientSetState(wwin
, IconicState
, wwin
->icon
->icon_win
);
955 if (!wwin
->screen_ptr
->flags
.startup
&& !wwin
->flags
.skip_next_animation
956 && !wPreferences
.no_animations
) {
957 animateResize(wwin
->screen_ptr
, wwin
->frame_x
, wwin
->frame_y
,
958 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
959 wwin
->icon_x
, wwin
->icon_y
,
960 wwin
->icon
->core
->width
, wwin
->icon
->core
->height
,
966 wwin
->flags
.skip_next_animation
= 0;
967 if (wwin
->screen_ptr
->current_workspace
==wwin
->frame
->workspace
||
968 IS_OMNIPRESENT(wwin
) || wPreferences
.sticky_icons
)
970 XMapWindow(dpy
, wwin
->icon
->core
->window
);
971 AddToStackList(wwin
->icon
->core
);
973 wLowerFrame(wwin
->icon
->core
);
976 WWindow
*owner
= recursiveTransientFor(wwin
->screen_ptr
->focused_window
);
979 * It doesn't seem to be working and causes button event hangup
980 * when deiconifying a transient window.
981 setupIconGrabs(wwin->icon);
983 if ((wwin
->flags
.focused
984 || (owner
&& wwin
->client_win
== owner
->client_win
))
985 && wPreferences
.focus_mode
==WKF_CLICK
) {
990 if (!WFLAGP(tmp
, no_focusable
)
991 && !(tmp
->flags
.hidden
||tmp
->flags
.miniaturized
))
995 wSetFocusTo(wwin
->screen_ptr
, tmp
);
996 } else if (wPreferences
.focus_mode
!=WKF_CLICK
) {
997 wSetFocusTo(wwin
->screen_ptr
, NULL
);
1001 if (!wwin
->screen_ptr
->flags
.startup
) {
1002 Window clientwin
= wwin
->client_win
;
1005 processEvents(XPending(dpy
));
1007 /* the window can disappear while doing the processEvents() */
1008 if (!wWindowFor(clientwin
))
1015 if (wwin
->flags
.selected
)
1016 wIconSelect(wwin
->icon
);
1019 wGNOMEUpdateClientStateHint(wwin
, False
);
1022 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
1023 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
1026 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1032 wDeiconifyWindow(WWindow
*wwin
)
1034 wWindowChangeWorkspace(wwin
, wwin
->screen_ptr
->current_workspace
);
1036 if (!wwin
->flags
.miniaturized
)
1039 if (wwin
->transient_for
!= None
) {
1040 WWindow
*owner
= recursiveTransientFor(wwin
);
1042 if (wwin
->flags
.miniaturized
) {
1043 wDeiconifyWindow(owner
);
1044 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1045 wRaiseFrame(wwin
->frame
->core
);
1050 wwin
->flags
.miniaturized
= 0;
1051 if (!wwin
->flags
.shaded
)
1052 wwin
->flags
.mapped
= 1;
1054 if (wwin
->icon
->selected
)
1055 wIconSelect(wwin
->icon
);
1057 XUnmapWindow(dpy
, wwin
->icon
->core
->window
);
1060 wSoundPlay(WMSOUND_DEICONIFY
);
1063 /* if the window is in another workspace, do it silently */
1065 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
1066 && !wwin
->flags
.skip_next_animation
) {
1067 animateResize(wwin
->screen_ptr
, wwin
->icon_x
, wwin
->icon_y
,
1068 wwin
->icon
->core
->width
, wwin
->icon
->core
->height
,
1069 wwin
->frame_x
, wwin
->frame_y
,
1070 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1073 #endif /* ANIMATIONS */
1074 wwin
->flags
.skip_next_animation
= 0;
1076 if (!wwin
->flags
.shaded
) {
1077 XMapWindow(dpy
, wwin
->client_win
);
1079 XMapWindow(dpy
, wwin
->frame
->core
->window
);
1080 wRaiseFrame(wwin
->frame
->core
);
1081 if (!wwin
->flags
.shaded
) {
1082 wClientSetState(wwin
, NormalState
, None
);
1084 mapTransientsFor(wwin
);
1085 RemoveFromStackList(wwin
->icon
->core
);
1086 /* removeIconGrabs(wwin->icon);*/
1087 wIconDestroy(wwin
->icon
);
1091 if (wPreferences
.focus_mode
==WKF_CLICK
1092 || wPreferences
.focus_mode
==WKF_SLOPPY
)
1093 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1096 if (!wwin
->screen_ptr
->flags
.startup
) {
1097 Window clientwin
= wwin
->client_win
;
1100 processEvents(XPending(dpy
));
1102 if (!wWindowFor(clientwin
))
1107 if (wPreferences
.auto_arrange_icons
) {
1108 wArrangeIcons(wwin
->screen_ptr
, True
);
1112 wGNOMEUpdateClientStateHint(wwin
, False
);
1115 wKWMUpdateClientStateHint(wwin
, KWMIconifiedFlag
);
1116 wKWMSendEventMessage(wwin
, WKWMChangedClient
);
1119 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1125 hideWindow(WIcon
*icon
, int icon_x
, int icon_y
, WWindow
*wwin
, int animate
)
1127 if (wwin
->flags
.miniaturized
) {
1128 XUnmapWindow(dpy
, wwin
->icon
->core
->window
);
1129 wwin
->flags
.hidden
= 1;
1130 wwin
->icon
->mapped
= 0;
1132 wGNOMEUpdateClientStateHint(wwin
, False
);
1135 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1140 if (wwin
->flags
.inspector_open
) {
1141 WWindow
*pwin
= wwin
->inspector
->frame
;
1144 pwin
->flags
.hidden
= 1;
1146 wClientSetState(pwin
, IconicState
, icon
->icon_win
);
1149 wwin
->flags
.hidden
= 1;
1152 wClientSetState(wwin
, IconicState
, icon
->icon_win
);
1155 wSoundPlay(WMSOUND_HIDE
);
1158 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
&&
1159 !wwin
->flags
.skip_next_animation
&& animate
) {
1160 animateResize(wwin
->screen_ptr
, wwin
->frame_x
, wwin
->frame_y
,
1161 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1162 icon_x
, icon_y
, icon
->core
->width
, icon
->core
->height
,
1166 wwin
->flags
.skip_next_animation
= 0;
1169 wGNOMEUpdateClientStateHint(wwin
, False
);
1172 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1179 wHideOtherApplications(WWindow
*awin
)
1183 #ifdef REDUCE_APPICONS
1184 char *tinstance
, *tclass
;
1185 unsigned int brokenwin
= 0, match
= 0;
1190 wwin
= awin
->screen_ptr
->focused_window
;
1192 #ifdef REDUCE_APPICONS
1193 if (awin
->wm_instance
== NULL
|| awin
->wm_class
== NULL
)
1199 && wwin
->frame
->workspace
== awin
->screen_ptr
->current_workspace
1200 && !(wwin
->flags
.miniaturized
||wwin
->flags
.hidden
)
1201 && !wwin
->flags
.internal_window
1202 && (!wwin
->flags
.inspector_open
|| wwin
->inspector
->frame
!=awin
)
1203 && !WFLAGP(wwin
, no_hide_others
)) {
1205 #ifdef REDUCE_APPICONS
1208 if ((tinstance
= wwin
->wm_instance
) == NULL
)
1210 if ((tclass
= wwin
->wm_class
) == NULL
)
1212 if ((strcmp(awin
->wm_instance
, tinstance
) == 0) &&
1213 (strcmp(awin
->wm_class
, tclass
) == 0) )
1218 if (wwin
->main_window
==None
|| WFLAGP(wwin
, no_appicon
)) {
1219 if (!WFLAGP(wwin
, no_miniaturizable
)) {
1220 wwin
->flags
.skip_next_animation
= 1;
1221 wIconifyWindow(wwin
);
1223 } else if (wwin
->main_window
!=None
1224 #ifndef REDUCE_APPICONS
1225 && awin
->main_window
!= wwin
->main_window
) {
1227 && (awin
->main_window
!= wwin
->main_window
&& !match
)) {
1229 tapp
= wApplicationOf(wwin
->main_window
);
1231 tapp
->flags
.skip_next_animation
= 1;
1232 wHideApplication(tapp
);
1234 if (!WFLAGP(wwin
, no_miniaturizable
)) {
1235 wwin
->flags
.skip_next_animation
= 1;
1236 wIconifyWindow(wwin
);
1244 wSetFocusTo(awin->screen_ptr, awin);
1251 wHideApplication(WApplication
*wapp
)
1253 #ifdef REDUCE_APPICONS
1255 char *tinstance
, *tclass
;
1256 unsigned int nowmhints
= 0, matchwmhints
= 0, matchworkspace
= 0;
1263 wwarning("trying to hide a non grouped window");
1266 if (!wapp
->main_window_desc
) {
1267 wwarning("group leader not found for window group");
1270 #ifdef REDUCE_APPICONS
1271 if ((wapp
->main_window_desc
->wm_instance
== NULL
) ||
1272 (wapp
->main_window_desc
->wm_class
== NULL
))
1275 scr
= wapp
->main_window_desc
->screen_ptr
;
1277 wlist
= scr
->focused_window
;
1281 if (wlist
->main_window
== wapp
->main_window
)
1282 wapp
->last_focused
= wlist
;
1284 wapp
->last_focused
= NULL
;
1286 #ifdef REDUCE_APPICONS
1287 matchwmhints
= matchworkspace
= 0;
1289 tapp
= wApplicationOf(wlist
->main_window
);
1290 tinstance
= tclass
= NULL
;
1292 if (tapp
->main_window_desc
) {
1293 tinstance
= tapp
->main_window_desc
->wm_instance
;
1294 tclass
= tapp
->main_window_desc
->wm_class
;
1297 if (tapp
== NULL
|| tinstance
== NULL
|| tclass
== NULL
) {
1298 /* Should never reach here */
1302 if ((strcmp(tinstance
, wapp
->main_window_desc
->wm_instance
) == 0) &&
1303 (strcmp(tclass
, wapp
->main_window_desc
->wm_class
) == 0) )
1307 if (wlist
->frame
->workspace
== wapp
->main_window_desc
->screen_ptr
->current_workspace
)
1310 if ((wlist
->main_window
== wapp
->main_window
|| matchwmhints
) &&
1316 if (wlist
->main_window
== wapp
->main_window
) {
1318 if (wlist
->flags
.focused
) {
1322 hideWindow(wapp
->app_icon
->icon
, wapp
->app_icon
->x_pos
,
1323 wapp
->app_icon
->y_pos
, wlist
,
1324 !wapp
->flags
.skip_next_animation
);
1326 wlist
= wlist
->prev
;
1329 wapp
->flags
.skip_next_animation
= 0;
1332 if (wPreferences
.focus_mode
==WKF_CLICK
) {
1333 wlist
= scr
->focused_window
;
1335 if (!WFLAGP(wlist
, no_focusable
) && !wlist
->flags
.hidden
1336 && (wlist
->flags
.mapped
|| wlist
->flags
.shaded
))
1338 wlist
= wlist
->prev
;
1340 wSetFocusTo(scr
, wlist
);
1342 wSetFocusTo(scr
, NULL
);
1346 wapp
->flags
.hidden
= 1;
1348 if(wPreferences
.auto_arrange_icons
) {
1349 wArrangeIcons(scr
, True
);
1357 unhideWindow(WIcon
*icon
, int icon_x
, int icon_y
, WWindow
*wwin
, int animate
,
1358 int bringToCurrentWS
)
1360 if (bringToCurrentWS
)
1361 wWindowChangeWorkspace(wwin
, wwin
->screen_ptr
->current_workspace
);
1363 wwin
->flags
.hidden
=0;
1364 wwin
->flags
.mapped
=1;
1367 wSoundPlay(WMSOUND_UNHIDE
);
1370 if (!wwin
->screen_ptr
->flags
.startup
&& !wPreferences
.no_animations
1372 animateResize(wwin
->screen_ptr
, icon_x
, icon_y
,
1373 icon
->core
->width
, icon
->core
->height
,
1374 wwin
->frame_x
, wwin
->frame_y
,
1375 wwin
->frame
->core
->width
, wwin
->frame
->core
->height
,
1379 wwin
->flags
.skip_next_animation
= 0;
1380 XMapWindow(dpy
, wwin
->client_win
);
1381 XMapWindow(dpy
, wwin
->frame
->core
->window
);
1382 wClientSetState(wwin
, NormalState
, None
);
1383 wRaiseFrame(wwin
->frame
->core
);
1384 if (wwin
->flags
.inspector_open
) {
1385 WWindow
*pwin
= wwin
->inspector
->frame
;
1387 pwin
->flags
.hidden
= 0;
1388 pwin
->flags
.mapped
= 1;
1389 XMapWindow(dpy
, pwin
->client_win
);
1390 XMapWindow(dpy
, pwin
->frame
->core
->window
);
1391 wClientSetState(pwin
, NormalState
, None
);
1395 wGNOMEUpdateClientStateHint(wwin
, False
);
1398 UpdateSwitchMenu(wwin
->screen_ptr
, wwin
, ACTION_CHANGE_STATE
);
1404 wUnhideApplication(WApplication
*wapp
, Bool miniwindows
, Bool bringToCurrentWS
)
1407 WWindow
*wlist
, *next
;
1408 WWindow
*focused
=NULL
;
1409 #ifdef REDUCE_APPICONS
1410 char *tinstance
, *tclass
;
1411 unsigned int nowmhints
= 0, matchwmhints
= 0, matchworkspace
= 0;
1418 #ifdef REDUCE_APPICONS
1419 if ((wapp
->main_window_desc
->wm_class
== NULL
) ||
1420 (wapp
->main_window_desc
->wm_instance
== NULL
))
1424 scr
= wapp
->main_window_desc
->screen_ptr
;
1425 wlist
= scr
->focused_window
;
1427 /* goto beginning of list */
1429 wlist
= wlist
->prev
;
1434 #ifndef REDUCE_APPICONS
1435 if (wlist
->main_window
== wapp
->main_window
) {
1437 matchwmhints
= matchworkspace
= 0;
1439 if ((tinstance
= wlist
->wm_instance
) == NULL
)
1441 if ((tclass
= wlist
->wm_class
) == NULL
)
1443 if ((strcmp(tinstance
, wapp
->main_window_desc
->wm_instance
) == 0)
1444 && (strcmp(tclass
, wapp
->main_window_desc
->wm_class
) == 0) )
1448 if (wlist
->frame
->workspace
== wapp
->main_window_desc
->screen_ptr
->current_workspace
)
1452 if ((wlist
->main_window
== wapp
->main_window
|| matchwmhints
) &&
1455 if (wlist
->flags
.focused
)
1457 else if (!focused
|| !focused
->flags
.focused
)
1460 if (wlist
->flags
.miniaturized
&& wlist
->icon
) {
1461 if (bringToCurrentWS
|| wPreferences
.sticky_icons
1462 || wlist
->frame
->workspace
== scr
->current_workspace
) {
1463 if (!wlist
->icon
->mapped
) {
1464 XMapWindow(dpy
, wlist
->icon
->core
->window
);
1465 wlist
->icon
->mapped
= 1;
1467 wlist
->flags
.hidden
= 0;
1469 UpdateSwitchMenu(scr
, wlist
, ACTION_CHANGE_STATE
);
1471 if (wlist
->frame
->workspace
!= scr
->current_workspace
)
1472 wWindowChangeWorkspace(wlist
, scr
->current_workspace
);
1475 wDeiconifyWindow(wlist
);
1477 } else if (wlist
->flags
.hidden
) {
1478 unhideWindow(wapp
->app_icon
->icon
, wapp
->app_icon
->x_pos
,
1479 wapp
->app_icon
->y_pos
, wlist
,
1480 !wapp
->flags
.skip_next_animation
,
1483 if (bringToCurrentWS
1484 && wlist
->frame
->workspace
!= scr
->current_workspace
) {
1485 wWindowChangeWorkspace(wlist
, scr
->current_workspace
);
1487 wRaiseFrame(wlist
->frame
->core
);
1493 wapp
->flags
.skip_next_animation
= 0;
1494 wapp
->flags
.hidden
= 0;
1497 wSetFocusTo(scr
, focused
);
1498 else if (wapp
->last_focused
&& wapp
->last_focused
->flags
.mapped
)
1499 wSetFocusTo(scr
, wapp
->last_focused
);
1500 wapp
->last_focused
= NULL
;
1501 if (wPreferences
.auto_arrange_icons
) {
1502 wArrangeIcons(scr
, True
);
1509 wShowAllWindows(WScreen
*scr
)
1511 WWindow
*wwin
, *old_foc
;
1514 old_foc
= wwin
= scr
->focused_window
;
1516 if (!wwin
->flags
.internal_window
&&
1517 (scr
->current_workspace
== wwin
->frame
->workspace
1518 || IS_OMNIPRESENT(wwin
))) {
1519 if (wwin
->flags
.miniaturized
) {
1520 wwin
->flags
.skip_next_animation
= 1;
1521 wDeiconifyWindow(wwin
);
1522 } else if (wwin
->flags
.hidden
) {
1523 wapp
= wApplicationOf(wwin
->main_window
);
1525 wUnhideApplication(wapp
, False
, False
);
1527 wwin
->flags
.skip_next_animation
= 1;
1528 wDeiconifyWindow(wwin
);
1534 wSetFocusTo(scr
, old_foc
);
1535 /*wRaiseFrame(old_foc->frame->core);*/
1540 wRefreshDesktop(WScreen
*scr
)
1543 XSetWindowAttributes attr
;
1545 attr
.backing_store
= NotUseful
;
1546 attr
.save_under
= False
;
1547 win
= XCreateWindow(dpy
, scr
->root_win
, 0, 0, scr
->scr_width
,
1548 scr
->scr_height
, 0, CopyFromParent
, CopyFromParent
,
1549 (Visual
*)CopyFromParent
, CWBackingStore
|CWSaveUnder
,
1551 XMapRaised(dpy
, win
);
1552 XDestroyWindow(dpy
, win
);
1558 wArrangeIcons(WScreen
*scr
, Bool arrangeAll
)
1562 int pf
; /* primary axis */
1563 int sf
; /* secondary axis */
1567 int sx1
, sx2
, sy1
, sy2
; /* screen boundary */
1571 int isize
= wPreferences
.icon_size
;
1574 * Find out screen boundaries.
1578 sx2
= scr
->scr_width
;
1579 sy2
= scr
->scr_height
;
1581 if (scr
->dock
->on_right_side
)
1582 sx2
-= isize
+ DOCK_EXTRA_SPACE
;
1584 sx1
+= isize
+ DOCK_EXTRA_SPACE
;
1587 sw
= isize
* (scr
->scr_width
/isize
);
1588 sh
= isize
* (scr
->scr_height
/isize
);
1589 fullW
= (sx2
-sx1
)/isize
;
1590 fullH
= (sy2
-sy1
)/isize
;
1592 /* icon yard boundaries */
1593 if (wPreferences
.icon_yard
& IY_VERT
) {
1600 if (wPreferences
.icon_yard
& IY_RIGHT
) {
1607 if (wPreferences
.icon_yard
& IY_TOP
) {
1615 /* arrange icons putting the most recently focused window
1616 * as the last icon */
1617 #define X ((wPreferences.icon_yard & IY_VERT) ? xo + xs*(si*isize)\
1618 : xo + xs*(pi*isize))
1619 #define Y ((wPreferences.icon_yard & IY_VERT) ? yo + ys*(pi*isize)\
1620 : yo + ys*(si*isize))
1622 /* arrange application icons */
1623 aicon
= scr
->app_icon_list
;
1624 /* reverse them to avoid unnecessarily sliding of icons */
1625 while (aicon
&& aicon
->next
)
1626 aicon
= aicon
->next
;
1631 if (!aicon
->docked
) {
1632 if (aicon
->x_pos
!= X
|| aicon
->y_pos
!= Y
) {
1634 if (!wPreferences
.no_animations
) {
1635 SlideWindow(aicon
->icon
->core
->window
, aicon
->x_pos
, aicon
->y_pos
,
1638 #endif /* ANIMATIONS */
1640 wAppIconMove(aicon
, X
, Y
);
1643 /* we reversed the order so we use prev */
1644 aicon
= aicon
->prev
;
1651 /* arrange miniwindows */
1653 wwin
= scr
->focused_window
;
1654 /* reverse them to avoid unnecessarily shuffling */
1655 while (wwin
&& wwin
->prev
)
1659 if (wwin
->icon
&& wwin
->flags
.miniaturized
&& !wwin
->flags
.hidden
&&
1660 (wwin
->frame
->workspace
==scr
->current_workspace
||
1661 IS_OMNIPRESENT(wwin
) || wPreferences
.sticky_icons
)) {
1663 if (arrangeAll
|| !wwin
->flags
.icon_moved
) {
1664 if (wwin
->icon_x
!= X
|| wwin
->icon_y
!= Y
) {
1666 if (wPreferences
.no_animations
) {
1667 XMoveWindow(dpy
, wwin
->icon
->core
->window
, X
, Y
);
1669 SlideWindow(wwin
->icon
->core
->window
, wwin
->icon_x
,
1670 wwin
->icon_y
, X
, Y
);
1673 XMoveWindow(dpy
, wwin
->icon
->core
->window
, X
, Y
);
1674 #endif /* ANIMATIONS */
1678 wwin
->flags
.icon_moved
= 0;
1682 /* we reversed the order, so we use next */
1693 wSelectWindow(WWindow
*wwin
, Bool flag
)
1695 WScreen
*scr
= wwin
->screen_ptr
;
1697 wwin
->flags
.selected
= 1;
1698 XSetWindowBorder(dpy
, wwin
->frame
->core
->window
, scr
->white_pixel
);
1699 scr
->selected_windows
= list_cons(wwin
, scr
->selected_windows
);
1701 wwin
->flags
.selected
= 0;
1702 XSetWindowBorder(dpy
, wwin
->frame
->core
->window
,
1703 scr
->frame_border_pixel
);
1704 scr
->selected_windows
= list_remove_elem(scr
->selected_windows
, wwin
);
1710 wMakeWindowVisible(WWindow
*wwin
)
1712 wWorkspaceChange(wwin
->screen_ptr
, wwin
->frame
->workspace
);
1714 if (wwin
->flags
.shaded
) {
1715 wUnshadeWindow(wwin
);
1717 if (wwin
->flags
.hidden
) {
1718 wUnhideApplication(wApplicationOf(wwin
->main_window
), False
, False
);
1719 } else if (wwin
->flags
.miniaturized
) {
1720 wDeiconifyWindow(wwin
);
1722 wSetFocusTo(wwin
->screen_ptr
, wwin
);
1723 wRaiseFrame(wwin
->frame
->core
);