]>
Dogcows Code - chaz/openbox/blob - openbox/stacking.c
8 GList
*stacking_list
= NULL
;
10 void stacking_set_list()
12 Window
*windows
, *win_it
;
14 guint size
= g_list_length(stacking_list
);
16 /* create an array of the window ids (from bottom to top,
19 windows
= g_new(Window
, size
);
21 for (it
= g_list_last(stacking_list
); it
!= NULL
; it
= it
->prev
, ++win_it
)
22 *win_it
= ((Client
*)it
->data
)->window
;
26 PROP_SET32A(ob_root
, net_client_list_stacking
, window
, windows
, size
);
32 void stacking_raise(Client
*client
)
34 Window wins
[2]; /* only ever restack 2 windows. */
38 g_assert(stacking_list
!= NULL
); /* this would be bad */
40 m
= client_find_modal_child(client
);
41 /* if we have a modal child, raise it instead, we'll go along tho later */
42 if (m
) stacking_raise(m
);
44 /* remove the client before looking so we can't run into ourselves */
45 stacking_list
= g_list_remove(stacking_list
, client
);
47 /* the stacking list is from highest to lowest */
51 if (client
->layer
>= c
->layer
&& m
!= c
)
57 if our new position is the top, we want to stack under the focus_backup.
58 otherwise, we want to stack under the previous window in the stack.
60 if (it
== stacking_list
)
61 wins
[0] = focus_backup
;
63 wins
[0] = ((Client
*)it
->prev
->data
)->frame
->window
;
65 wins
[0] = ((Client
*)g_list_last(stacking_list
)->data
)->frame
->window
;
66 wins
[1] = client
->frame
->window
;
68 stacking_list
= g_list_insert_before(stacking_list
, it
, client
);
70 XRestackWindows(ob_display
, wins
, 2);
75 void stacking_lower(Client
*client
)
77 Window wins
[2]; /* only ever restack 2 windows. */
80 g_assert(stacking_list
!= NULL
); /* this would be bad */
82 it
= g_list_last(stacking_list
);
84 if (client
->modal
&& client
->transient_for
) {
85 /* don't let a modal window lower below its transient_for */
86 it
= g_list_find(stacking_list
, client
->transient_for
);
89 wins
[0] = (it
== stacking_list
? focus_backup
:
90 ((Client
*)it
->prev
->data
)->frame
->window
);
91 wins
[1] = client
->frame
->window
;
92 if (wins
[0] == wins
[1]) return; /* already right above the window */
94 stacking_list
= g_list_remove(stacking_list
, client
);
95 stacking_list
= g_list_insert_before(stacking_list
, it
, client
);
97 while (it
!= stacking_list
) {
99 if (client
->layer
>= c
->layer
)
103 if (it
->data
== client
) return; /* already the bottom, return */
105 wins
[0] = ((Client
*)it
->data
)->frame
->window
;
106 wins
[1] = client
->frame
->window
;
108 stacking_list
= g_list_remove(stacking_list
, client
);
109 stacking_list
= g_list_insert_before(stacking_list
,
113 XRestackWindows(ob_display
, wins
, 2);
This page took 0.042833 seconds and 5 git commands to generate.