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.
27 extern awesome_t globalconf
;
29 /** Arrange windows following current selected layout
30 * \param screen the screen to arrange
36 int phys_screen
= screen_virttophys(screen
);
37 xcb_query_pointer_cookie_t qp_c
;
38 xcb_query_pointer_reply_t
*qp_r
;
40 for(c
= globalconf
.clients
; c
; c
= c
->next
)
42 if(client_isvisible(c
, screen
))
44 /* we don't touch other screens windows */
45 else if(c
->screen
== screen
)
50 if(globalconf
.hooks
.arrange
!= LUA_REFNIL
)
52 lua_pushnumber(globalconf
.L
, screen
+ 1);
53 luaA_dofunction(globalconf
.L
, globalconf
.hooks
.arrange
, 1, 0);
56 qp_c
= xcb_query_pointer_unchecked(globalconf
.connection
,
57 xutil_screen_get(globalconf
.connection
,
60 /* check that the mouse is on a window or not */
61 if((qp_r
= xcb_query_pointer_reply(globalconf
.connection
, qp_c
, NULL
)))
63 if(qp_r
->child
== XCB_NONE
|| qp_r
->root
== qp_r
->child
)
64 window_root_buttons_grab(qp_r
->root
);
65 else if ((c
= client_getbywin(qp_r
->child
)))
66 window_buttons_grab(c
->win
, qp_r
->root
, &c
->buttons
);
68 globalconf
.pointer_x
= qp_r
->root_x
;
69 globalconf
.pointer_y
= qp_r
->root_y
;
75 globalconf
.screens
[screen
].need_arrange
= false;
78 /** Refresh the screen disposition
79 * \return true if the screen was arranged, false otherwise
86 for(screen
= 0; screen
< globalconf
.nscreen
; screen
++)
87 if(globalconf
.screens
[screen
].need_arrange
)
91 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80