1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 focus.c for the Openbox window manager
4 Copyright (c) 2004 Mikael Magnusson
5 Copyright (c) 2003 Ben Jansens
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 See the COPYING file for a copy of the GNU General Public License.
24 #include "framerender.h"
34 #include "render/render.h"
40 ObClient
*focus_client
, *focus_hilite
;
41 GList
**focus_order
; /* these lists are created when screen_startup
42 sets the number of desktops */
43 ObClient
*focus_cycle_target
;
49 InternalWindow bottom
;
52 RrAppearance
*a_focus_indicator
;
55 static ObIconPopup
*focus_cycle_popup
;
57 static void focus_cycle_destructor(ObClient
*client
, gpointer data
)
59 /* end cycling if the target disappears */
60 if (focus_cycle_target
== client
)
61 focus_cycle(TRUE
, TRUE
, TRUE
, TRUE
, TRUE
, TRUE
);
64 static Window
createWindow(Window parent
, gulong mask
,
65 XSetWindowAttributes
*attrib
)
67 return XCreateWindow(ob_display
, parent
, 0, 0, 1, 1, 0,
68 RrDepth(ob_rr_inst
), InputOutput
,
69 RrVisual(ob_rr_inst
), mask
, attrib
);
73 void focus_startup(gboolean reconfig
)
75 focus_cycle_popup
= icon_popup_new(TRUE
);
78 XSetWindowAttributes attr
;
80 client_add_destructor(focus_cycle_destructor
, NULL
);
82 /* start with nothing focused */
83 focus_set_client(NULL
);
85 focus_indicator
.top
.obwin
.type
= Window_Internal
;
86 focus_indicator
.left
.obwin
.type
= Window_Internal
;
87 focus_indicator
.right
.obwin
.type
= Window_Internal
;
88 focus_indicator
.bottom
.obwin
.type
= Window_Internal
;
90 attr
.save_under
= True
;
91 attr
.override_redirect
= True
;
92 attr
.background_pixel
= BlackPixel(ob_display
, ob_screen
);
93 focus_indicator
.top
.win
=
94 createWindow(RootWindow(ob_display
, ob_screen
),
95 CWOverrideRedirect
| CWBackPixel
| CWSaveUnder
,
97 focus_indicator
.left
.win
=
98 createWindow(RootWindow(ob_display
, ob_screen
),
99 CWOverrideRedirect
| CWBackPixel
| CWSaveUnder
,
101 focus_indicator
.right
.win
=
102 createWindow(RootWindow(ob_display
, ob_screen
),
103 CWOverrideRedirect
| CWBackPixel
| CWSaveUnder
,
105 focus_indicator
.bottom
.win
=
106 createWindow(RootWindow(ob_display
, ob_screen
),
107 CWOverrideRedirect
| CWBackPixel
| CWSaveUnder
,
110 stacking_add(INTERNAL_AS_WINDOW(&focus_indicator
.top
));
111 stacking_add(INTERNAL_AS_WINDOW(&focus_indicator
.left
));
112 stacking_add(INTERNAL_AS_WINDOW(&focus_indicator
.right
));
113 stacking_add(INTERNAL_AS_WINDOW(&focus_indicator
.bottom
));
115 color_white
= RrColorNew(ob_rr_inst
, 0xff, 0xff, 0xff);
117 a_focus_indicator
= RrAppearanceNew(ob_rr_inst
, 4);
118 a_focus_indicator
->surface
.grad
= RR_SURFACE_SOLID
;
119 a_focus_indicator
->surface
.relief
= RR_RELIEF_FLAT
;
120 a_focus_indicator
->surface
.primary
= RrColorNew(ob_rr_inst
,
122 a_focus_indicator
->texture
[0].type
= RR_TEXTURE_LINE_ART
;
123 a_focus_indicator
->texture
[0].data
.lineart
.color
= color_white
;
124 a_focus_indicator
->texture
[1].type
= RR_TEXTURE_LINE_ART
;
125 a_focus_indicator
->texture
[1].data
.lineart
.color
= color_white
;
126 a_focus_indicator
->texture
[2].type
= RR_TEXTURE_LINE_ART
;
127 a_focus_indicator
->texture
[2].data
.lineart
.color
= color_white
;
128 a_focus_indicator
->texture
[3].type
= RR_TEXTURE_LINE_ART
;
129 a_focus_indicator
->texture
[3].data
.lineart
.color
= color_white
;
133 void focus_shutdown(gboolean reconfig
)
137 icon_popup_free(focus_cycle_popup
);
140 client_remove_destructor(focus_cycle_destructor
);
142 for (i
= 0; i
< screen_num_desktops
; ++i
)
143 g_list_free(focus_order
[i
]);
146 /* reset focus to root */
147 XSetInputFocus(ob_display
, PointerRoot
, RevertToNone
, event_lasttime
);
149 RrColorFree(color_white
);
151 RrAppearanceFree(a_focus_indicator
);
153 XDestroyWindow(ob_display
, focus_indicator
.top
.win
);
154 XDestroyWindow(ob_display
, focus_indicator
.left
.win
);
155 XDestroyWindow(ob_display
, focus_indicator
.right
.win
);
156 XDestroyWindow(ob_display
, focus_indicator
.bottom
.win
);
160 static void push_to_top(ObClient
*client
)
164 desktop
= client
->desktop
;
165 if (desktop
== DESKTOP_ALL
) desktop
= screen_desktop
;
166 focus_order
[desktop
] = g_list_remove(focus_order
[desktop
], client
);
167 focus_order
[desktop
] = g_list_prepend(focus_order
[desktop
], client
);
170 void focus_set_client(ObClient
*client
)
176 ob_debug("focus_set_client 0x%lx\n", client
? client
->window
: 0);
179 /* uninstall the old colormap, and install the new one */
180 screen_install_colormap(focus_client
, FALSE
);
181 screen_install_colormap(client
, TRUE
);
183 if (client
== NULL
) {
185 ob_debug("actively focusing NONWINDOW\n");
187 /* when nothing will be focused, send focus to the backup target */
188 XSetInputFocus(ob_display
, screen_support_win
, RevertToNone
,
190 XSync(ob_display
, FALSE
);
193 /* in the middle of cycling..? kill it. */
194 if (focus_cycle_target
)
195 focus_cycle(TRUE
, TRUE
, TRUE
, TRUE
, TRUE
, TRUE
);
198 focus_client
= client
;
200 /* move to the top of the list */
204 /* set the NET_ACTIVE_WINDOW hint, but preserve it on shutdown */
205 if (ob_state() != OB_STATE_EXITING
) {
206 active
= client
? client
->window
: None
;
207 PROP_SET32(RootWindow(ob_display
, ob_screen
),
208 net_active_window
, window
, active
);
212 /* finds the first transient that isn't 'skip' and ensure's that client_normal
214 static ObClient
*find_transient_recursive(ObClient
*c
, ObClient
*top
,
220 for (it
= c
->transients
; it
; it
= g_slist_next(it
)) {
221 if (it
->data
== top
) return NULL
;
222 ret
= find_transient_recursive(it
->data
, top
, skip
);
223 if (ret
&& ret
!= skip
&& client_normal(ret
)) return ret
;
224 if (it
->data
!= skip
&& client_normal(it
->data
)) return it
->data
;
229 static ObClient
* focus_fallback_transient(ObClient
*top
, ObClient
*old
)
231 ObClient
*target
= find_transient_recursive(top
, top
, old
);
233 /* make sure client_normal is true always */
234 if (!client_normal(top
))
236 target
= top
; /* no transient, keep the top */
238 if (client_can_focus(target
))
244 ObClient
* focus_fallback_target(ObFocusFallbackType type
)
247 ObClient
*old
= NULL
;
248 ObClient
*target
= NULL
;
252 if (type
== OB_FOCUS_FALLBACK_UNFOCUSING
&& old
) {
253 if (old
->transient_for
) {
254 gboolean trans
= FALSE
;
256 if (!config_focus_follow
|| config_focus_last
)
259 if ((target
= client_under_pointer()) &&
260 client_search_transient
261 (client_search_top_transient(target
), old
))
267 /* try for transient relations */
269 if (old
->transient_for
== OB_TRAN_GROUP
) {
270 for (it
= focus_order
[screen_desktop
]; it
;
271 it
= g_list_next(it
))
275 for (sit
= old
->group
->members
; sit
;
276 sit
= g_slist_next(sit
))
278 if (sit
->data
== it
->data
)
280 focus_fallback_transient(sit
->data
, old
)))
286 focus_fallback_transient(old
->transient_for
, old
)))
293 if (config_focus_follow
&&
294 (type
== OB_FOCUS_FALLBACK_UNFOCUSING
|| !config_focus_last
))
296 if ((target
= client_under_pointer()))
297 if (client_normal(target
) && client_can_focus(target
))
302 /* try for group relations */
306 for (it
= focus_order
[screen_desktop
]; it
; it
= g_list_next(it
))
307 for (sit
= old
->group
->members
; sit
; sit
= g_slist_next(sit
))
308 if (sit
->data
== it
->data
)
309 if (sit
->data
!= old
&& client_normal(sit
->data
))
310 if (client_can_focus(sit
->data
))
315 for (it
= focus_order
[screen_desktop
]; it
; it
= g_list_next(it
))
316 if (type
!= OB_FOCUS_FALLBACK_UNFOCUSING
|| it
->data
!= old
)
317 if (client_normal(it
->data
) && client_can_focus(it
->data
))
323 void focus_fallback(ObFocusFallbackType type
)
327 /* unfocus any focused clients.. they can be focused by Pointer events
328 and such, and then when I try focus them, I won't get a FocusIn event
331 focus_set_client(NULL
);
333 if ((new = focus_fallback_target(type
)))
337 static void popup_cycle(ObClient
*c
, gboolean show
)
340 icon_popup_hide(focus_cycle_popup
);
346 a
= screen_physical_area_monitor(0);
347 icon_popup_position(focus_cycle_popup
, CenterGravity
,
348 a
->x
+ a
->width
/ 2, a
->y
+ a
->height
/ 2);
349 /* icon_popup_size(focus_cycle_popup, a->height/2, a->height/16);
350 icon_popup_show(focus_cycle_popup, c->title,
351 client_icon(c, a->height/16, a->height/16));
353 /* XXX the size and the font extents need to be related on some level
355 icon_popup_size(focus_cycle_popup
, POPUP_WIDTH
, POPUP_HEIGHT
);
357 /* use the transient's parent's title/icon */
358 while (p
->transient_for
&& p
->transient_for
!= OB_TRAN_GROUP
)
359 p
= p
->transient_for
;
361 if (p
!= c
&& !strcmp("", (c
->iconic
? c
->icon_title
: c
->title
)))
362 title
= g_strdup(p
->iconic
? p
->icon_title
: p
->title
);
363 /*title = g_strconcat((c->iconic ? c->icon_title : c->title),
365 (p->iconic ? p->icon_title : p->title),
368 icon_popup_show(focus_cycle_popup
,
370 (c
->iconic
? c
->icon_title
: c
->title
)),
371 client_icon(p
, 48, 48));
376 void focus_cycle_draw_indicator()
378 if (!focus_cycle_target
) {
379 XUnmapWindow(ob_display
, focus_indicator
.top
.win
);
380 XUnmapWindow(ob_display
, focus_indicator
.left
.win
);
381 XUnmapWindow(ob_display
, focus_indicator
.right
.win
);
382 XUnmapWindow(ob_display
, focus_indicator
.bottom
.win
);
385 if (focus_cycle_target)
386 frame_adjust_focus(focus_cycle_target->frame, FALSE);
387 frame_adjust_focus(focus_cycle_target->frame, TRUE);
392 wt
= wl
= wr
= wb
= MAX(3,
393 ob_rr_theme
->handle_height
+
394 ob_rr_theme
->bwidth
* 2);
396 x
= focus_cycle_target
->frame
->area
.x
;
397 y
= focus_cycle_target
->frame
->area
.y
;
398 w
= focus_cycle_target
->frame
->area
.width
;
401 XMoveResizeWindow(ob_display
, focus_indicator
.top
.win
,
403 a_focus_indicator
->texture
[0].data
.lineart
.x1
= 0;
404 a_focus_indicator
->texture
[0].data
.lineart
.y1
= h
-1;
405 a_focus_indicator
->texture
[0].data
.lineart
.x2
= 0;
406 a_focus_indicator
->texture
[0].data
.lineart
.y2
= 0;
407 a_focus_indicator
->texture
[1].data
.lineart
.x1
= 0;
408 a_focus_indicator
->texture
[1].data
.lineart
.y1
= 0;
409 a_focus_indicator
->texture
[1].data
.lineart
.x2
= w
-1;
410 a_focus_indicator
->texture
[1].data
.lineart
.y2
= 0;
411 a_focus_indicator
->texture
[2].data
.lineart
.x1
= w
-1;
412 a_focus_indicator
->texture
[2].data
.lineart
.y1
= 0;
413 a_focus_indicator
->texture
[2].data
.lineart
.x2
= w
-1;
414 a_focus_indicator
->texture
[2].data
.lineart
.y2
= h
-1;
415 a_focus_indicator
->texture
[3].data
.lineart
.x1
= (wl
-1);
416 a_focus_indicator
->texture
[3].data
.lineart
.y1
= h
-1;
417 a_focus_indicator
->texture
[3].data
.lineart
.x2
= w
- wr
;
418 a_focus_indicator
->texture
[3].data
.lineart
.y2
= h
-1;
419 RrPaint(a_focus_indicator
, focus_indicator
.top
.win
,
422 x
= focus_cycle_target
->frame
->area
.x
;
423 y
= focus_cycle_target
->frame
->area
.y
;
425 h
= focus_cycle_target
->frame
->area
.height
;
427 XMoveResizeWindow(ob_display
, focus_indicator
.left
.win
,
429 a_focus_indicator
->texture
[0].data
.lineart
.x1
= w
-1;
430 a_focus_indicator
->texture
[0].data
.lineart
.y1
= 0;
431 a_focus_indicator
->texture
[0].data
.lineart
.x2
= 0;
432 a_focus_indicator
->texture
[0].data
.lineart
.y2
= 0;
433 a_focus_indicator
->texture
[1].data
.lineart
.x1
= 0;
434 a_focus_indicator
->texture
[1].data
.lineart
.y1
= 0;
435 a_focus_indicator
->texture
[1].data
.lineart
.x2
= 0;
436 a_focus_indicator
->texture
[1].data
.lineart
.y2
= h
-1;
437 a_focus_indicator
->texture
[2].data
.lineart
.x1
= 0;
438 a_focus_indicator
->texture
[2].data
.lineart
.y1
= h
-1;
439 a_focus_indicator
->texture
[2].data
.lineart
.x2
= w
-1;
440 a_focus_indicator
->texture
[2].data
.lineart
.y2
= h
-1;
441 a_focus_indicator
->texture
[3].data
.lineart
.x1
= w
-1;
442 a_focus_indicator
->texture
[3].data
.lineart
.y1
= wt
-1;
443 a_focus_indicator
->texture
[3].data
.lineart
.x2
= w
-1;
444 a_focus_indicator
->texture
[3].data
.lineart
.y2
= h
- wb
;
445 RrPaint(a_focus_indicator
, focus_indicator
.left
.win
,
448 x
= focus_cycle_target
->frame
->area
.x
+
449 focus_cycle_target
->frame
->area
.width
- wr
;
450 y
= focus_cycle_target
->frame
->area
.y
;
452 h
= focus_cycle_target
->frame
->area
.height
;
454 XMoveResizeWindow(ob_display
, focus_indicator
.right
.win
,
456 a_focus_indicator
->texture
[0].data
.lineart
.x1
= 0;
457 a_focus_indicator
->texture
[0].data
.lineart
.y1
= 0;
458 a_focus_indicator
->texture
[0].data
.lineart
.x2
= w
-1;
459 a_focus_indicator
->texture
[0].data
.lineart
.y2
= 0;
460 a_focus_indicator
->texture
[1].data
.lineart
.x1
= w
-1;
461 a_focus_indicator
->texture
[1].data
.lineart
.y1
= 0;
462 a_focus_indicator
->texture
[1].data
.lineart
.x2
= w
-1;
463 a_focus_indicator
->texture
[1].data
.lineart
.y2
= h
-1;
464 a_focus_indicator
->texture
[2].data
.lineart
.x1
= w
-1;
465 a_focus_indicator
->texture
[2].data
.lineart
.y1
= h
-1;
466 a_focus_indicator
->texture
[2].data
.lineart
.x2
= 0;
467 a_focus_indicator
->texture
[2].data
.lineart
.y2
= h
-1;
468 a_focus_indicator
->texture
[3].data
.lineart
.x1
= 0;
469 a_focus_indicator
->texture
[3].data
.lineart
.y1
= wt
-1;
470 a_focus_indicator
->texture
[3].data
.lineart
.x2
= 0;
471 a_focus_indicator
->texture
[3].data
.lineart
.y2
= h
- wb
;
472 RrPaint(a_focus_indicator
, focus_indicator
.right
.win
,
475 x
= focus_cycle_target
->frame
->area
.x
;
476 y
= focus_cycle_target
->frame
->area
.y
+
477 focus_cycle_target
->frame
->area
.height
- wb
;
478 w
= focus_cycle_target
->frame
->area
.width
;
481 XMoveResizeWindow(ob_display
, focus_indicator
.bottom
.win
,
483 a_focus_indicator
->texture
[0].data
.lineart
.x1
= 0;
484 a_focus_indicator
->texture
[0].data
.lineart
.y1
= 0;
485 a_focus_indicator
->texture
[0].data
.lineart
.x2
= 0;
486 a_focus_indicator
->texture
[0].data
.lineart
.y2
= h
-1;
487 a_focus_indicator
->texture
[1].data
.lineart
.x1
= 0;
488 a_focus_indicator
->texture
[1].data
.lineart
.y1
= h
-1;
489 a_focus_indicator
->texture
[1].data
.lineart
.x2
= w
-1;
490 a_focus_indicator
->texture
[1].data
.lineart
.y2
= h
-1;
491 a_focus_indicator
->texture
[2].data
.lineart
.x1
= w
-1;
492 a_focus_indicator
->texture
[2].data
.lineart
.y1
= h
-1;
493 a_focus_indicator
->texture
[2].data
.lineart
.x2
= w
-1;
494 a_focus_indicator
->texture
[2].data
.lineart
.y2
= 0;
495 a_focus_indicator
->texture
[3].data
.lineart
.x1
= wl
-1;
496 a_focus_indicator
->texture
[3].data
.lineart
.y1
= 0;
497 a_focus_indicator
->texture
[3].data
.lineart
.x2
= w
- wr
;
498 a_focus_indicator
->texture
[3].data
.lineart
.y2
= 0;
499 RrPaint(a_focus_indicator
, focus_indicator
.bottom
.win
,
502 XMapWindow(ob_display
, focus_indicator
.top
.win
);
503 XMapWindow(ob_display
, focus_indicator
.left
.win
);
504 XMapWindow(ob_display
, focus_indicator
.right
.win
);
505 XMapWindow(ob_display
, focus_indicator
.bottom
.win
);
509 static gboolean
valid_focus_target(ObClient
*ft
)
511 /* we don't use client_can_focus here, because that doesn't let you
512 focus an iconic window, but we want to be able to, so we just check
513 if the focus flags on the window allow it, and its on the current
515 if ((ft
->type
== OB_CLIENT_TYPE_NORMAL
||
516 ft
->type
== OB_CLIENT_TYPE_DIALOG
||
517 (!client_has_group_siblings(ft
) &&
518 (ft
->type
== OB_CLIENT_TYPE_TOOLBAR
||
519 ft
->type
== OB_CLIENT_TYPE_MENU
||
520 ft
->type
== OB_CLIENT_TYPE_UTILITY
))) &&
521 ((ft
->can_focus
|| ft
->focus_notify
) &&
523 (ft
->desktop
== screen_desktop
|| ft
->desktop
== DESKTOP_ALL
)) &&
524 ft
== client_focus_target(ft
))
530 for (it = ft->transients; it; it = g_slist_next(it)) {
531 ObClient *c = it->data;
533 if (c->frame->visible)
543 void focus_cycle(gboolean forward
, gboolean linear
, gboolean interactive
,
544 gboolean dialog
, gboolean done
, gboolean cancel
)
546 static ObClient
*first
= NULL
;
547 static ObClient
*t
= NULL
;
548 static GList
*order
= NULL
;
549 GList
*it
, *start
, *list
;
554 focus_cycle_target
= NULL
;
559 if (!focus_order
[screen_desktop
])
562 if (!first
) first
= focus_client
;
564 if (linear
) list
= client_list
;
565 else list
= focus_order
[screen_desktop
];
567 if (!focus_order
[screen_desktop
])
571 if (!focus_cycle_target
) focus_cycle_target
= focus_client
;
573 start
= it
= g_list_find(list
, focus_cycle_target
);
574 if (!start
) /* switched desktops or something? */
575 start
= it
= forward
? g_list_last(list
) : g_list_first(list
);
576 if (!start
) goto done_cycle
;
581 if (it
== NULL
) it
= g_list_first(list
);
584 if (it
== NULL
) it
= g_list_last(list
);
587 if (valid_focus_target(ft
)) {
589 if (ft
!= focus_cycle_target
) { /* prevents flicker */
590 focus_cycle_target
= ft
;
591 focus_cycle_draw_indicator();
593 popup_cycle(ft
, dialog
);
595 } else if (ft
!= focus_cycle_target
) {
596 focus_cycle_target
= ft
;
601 } while (it
!= start
);
604 if (done
&& focus_cycle_target
)
605 client_activate(focus_cycle_target
, FALSE
);
609 focus_cycle_target
= NULL
;
614 focus_cycle_draw_indicator();
615 popup_cycle(ft
, FALSE
);
621 void focus_directional_cycle(ObDirection dir
, gboolean interactive
,
622 gboolean dialog
, gboolean done
, gboolean cancel
)
624 static ObClient
*first
= NULL
;
631 focus_cycle_target
= NULL
;
636 if (!focus_order
[screen_desktop
])
639 if (!first
) first
= focus_client
;
640 if (!focus_cycle_target
) focus_cycle_target
= focus_client
;
642 if (focus_cycle_target
)
643 ft
= client_find_directional(focus_cycle_target
, dir
);
647 for (it
= focus_order
[screen_desktop
]; it
; it
= g_list_next(it
))
648 if (valid_focus_target(it
->data
))
653 if (ft
!= focus_cycle_target
) {/* prevents flicker */
654 focus_cycle_target
= ft
;
655 focus_cycle_draw_indicator();
658 if (focus_cycle_target
) {
659 popup_cycle(focus_cycle_target
, dialog
);
666 if (done
&& focus_cycle_target
)
667 client_activate(focus_cycle_target
, FALSE
);
670 focus_cycle_target
= NULL
;
672 focus_cycle_draw_indicator();
673 popup_cycle(ft
, FALSE
);
678 void focus_order_add_new(ObClient
*c
)
683 focus_order_to_top(c
);
686 if (d
== DESKTOP_ALL
) {
687 for (i
= 0; i
< screen_num_desktops
; ++i
) {
688 g_assert(!g_list_find(focus_order
[i
], c
));
689 if (focus_order
[i
] && ((ObClient
*)focus_order
[i
]->data
)->iconic
)
690 focus_order
[i
] = g_list_insert(focus_order
[i
], c
, 0);
692 focus_order
[i
] = g_list_insert(focus_order
[i
], c
, 1);
695 g_assert(!g_list_find(focus_order
[d
], c
));
696 if (focus_order
[d
] && ((ObClient
*)focus_order
[d
]->data
)->iconic
)
697 focus_order
[d
] = g_list_insert(focus_order
[d
], c
, 0);
699 focus_order
[d
] = g_list_insert(focus_order
[d
], c
, 1);
704 void focus_order_remove(ObClient
*c
)
709 if (d
== DESKTOP_ALL
) {
710 for (i
= 0; i
< screen_num_desktops
; ++i
)
711 focus_order
[i
] = g_list_remove(focus_order
[i
], c
);
713 focus_order
[d
] = g_list_remove(focus_order
[d
], c
);
716 static void to_top(ObClient
*c
, guint d
)
718 focus_order
[d
] = g_list_remove(focus_order
[d
], c
);
720 focus_order
[d
] = g_list_prepend(focus_order
[d
], c
);
724 /* insert before first iconic window */
725 for (it
= focus_order
[d
];
726 it
&& !((ObClient
*)it
->data
)->iconic
; it
= g_list_next(it
));
727 focus_order
[d
] = g_list_insert_before(focus_order
[d
], it
, c
);
731 void focus_order_to_top(ObClient
*c
)
736 if (d
== DESKTOP_ALL
) {
737 for (i
= 0; i
< screen_num_desktops
; ++i
)
743 static void to_bottom(ObClient
*c
, guint d
)
745 focus_order
[d
] = g_list_remove(focus_order
[d
], c
);
747 focus_order
[d
] = g_list_append(focus_order
[d
], c
);
751 /* insert before first iconic window */
752 for (it
= focus_order
[d
];
753 it
&& !((ObClient
*)it
->data
)->iconic
; it
= g_list_next(it
));
754 focus_order
[d
] = g_list_insert_before(focus_order
[d
], it
, c
);
758 void focus_order_to_bottom(ObClient
*c
)
763 if (d
== DESKTOP_ALL
) {
764 for (i
= 0; i
< screen_num_desktops
; ++i
)