]>
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 /* on shutdown, don't update the properties, so that we can read it back
17 in on startup and re-stack the windows as they were before we shut down
19 if (ob_state
== State_Exiting
) return;
21 /* create an array of the window ids (from bottom to top,
24 windows
= g_new(Window
, size
);
26 for (it
= g_list_last(stacking_list
); it
!= NULL
;
27 it
= it
->prev
, ++win_it
)
28 *win_it
= ((Client
*)it
->data
)->window
;
32 PROP_SET32A(ob_root
, net_client_list_stacking
, window
, windows
, size
);
38 void stacking_raise(Client
*client
)
40 Window wins
[2]; /* only ever restack 2 windows. */
44 g_assert(stacking_list
!= NULL
); /* this would be bad */
46 m
= client_find_modal_child(client
);
47 /* if we have a modal child, raise it instead, we'll go along tho later */
48 if (m
) stacking_raise(m
);
50 /* remove the client before looking so we can't run into ourselves */
51 stacking_list
= g_list_remove(stacking_list
, client
);
53 /* the stacking list is from highest to lowest */
57 if (client
->layer
>= c
->layer
&& m
!= c
)
63 if our new position is the top, we want to stack under the focus_backup.
64 otherwise, we want to stack under the previous window in the stack.
66 if (it
== stacking_list
)
67 wins
[0] = focus_backup
;
69 wins
[0] = ((Client
*)it
->prev
->data
)->frame
->window
;
71 wins
[0] = ((Client
*)g_list_last(stacking_list
)->data
)->frame
->window
;
72 wins
[1] = client
->frame
->window
;
74 stacking_list
= g_list_insert_before(stacking_list
, it
, client
);
76 XRestackWindows(ob_display
, wins
, 2);
81 void stacking_lower(Client
*client
)
83 Window wins
[2]; /* only ever restack 2 windows. */
86 g_assert(stacking_list
!= NULL
); /* this would be bad */
88 it
= g_list_last(stacking_list
);
90 if (client
->modal
&& client
->transient_for
) {
91 /* don't let a modal window lower below its transient_for */
92 it
= g_list_find(stacking_list
, client
->transient_for
);
95 wins
[0] = (it
== stacking_list
? focus_backup
:
96 ((Client
*)it
->prev
->data
)->frame
->window
);
97 wins
[1] = client
->frame
->window
;
98 if (wins
[0] == wins
[1]) return; /* already right above the window */
100 stacking_list
= g_list_remove(stacking_list
, client
);
101 stacking_list
= g_list_insert_before(stacking_list
, it
, client
);
103 while (it
!= stacking_list
) {
104 Client
*c
= it
->data
;
105 if (client
->layer
<= c
->layer
)
109 if (it
->data
== client
) return; /* already the bottom, return */
111 wins
[0] = ((Client
*)it
->data
)->frame
->window
;
112 wins
[1] = client
->frame
->window
;
114 stacking_list
= g_list_remove(stacking_list
, client
);
115 stacking_list
= g_list_insert_before(stacking_list
,
119 XRestackWindows(ob_display
, wins
, 2);
This page took 0.037906 seconds and 4 git commands to generate.