2 * layout.c - layout management
4 * Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 /** Arrange windows following current selected layout
29 * \param screen the screen to arrange
34 uint32_t select_input_val
[] = { CLIENT_SELECT_INPUT_EVENT_MASK
& ~(XCB_EVENT_MASK_ENTER_WINDOW
| XCB_EVENT_MASK_LEAVE_WINDOW
) };
36 foreach(_c
, globalconf
.clients
)
40 * While we arrange, we do not want to receive EnterNotify or LeaveNotify
41 * events, or we would get spurious events. */
42 xcb_change_window_attributes(globalconf
.connection
,
47 /* Restore titlebar before client, so geometry is ok again. */
48 if(titlebar_isvisible(c
, screen
))
49 titlebar_unban(c
->titlebar
);
50 else if(c
->screen
== screen
)
51 titlebar_ban(c
->titlebar
);
53 if(client_isvisible(c
, screen
))
55 /* we don't touch other screens windows */
56 else if(c
->screen
== screen
)
60 client_update_strut_positions(screen
);
62 /* Reset status before calling arrange hook.
63 * This is needed if you call a function that relies
64 * on need_arrange while arrange is in progress.
66 globalconf
.screens
[screen
].need_arrange
= false;
69 if(globalconf
.hooks
.arrange
!= LUA_REFNIL
)
71 lua_pushnumber(globalconf
.L
, screen
+ 1);
72 luaA_dofunction(globalconf
.L
, globalconf
.hooks
.arrange
, 1, 0);
75 /* Now, we want to receive EnterNotify and LeaveNotify events back. */
76 select_input_val
[0] = CLIENT_SELECT_INPUT_EVENT_MASK
;
77 foreach(c
, globalconf
.clients
)
78 xcb_change_window_attributes(globalconf
.connection
,
84 /** Refresh the screen disposition
85 * \return true if the screen was arranged, false otherwise
92 for(screen
= 0; screen
< globalconf
.nscreen
; screen
++)
93 if(globalconf
.screens
[screen
].need_arrange
)
97 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80