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 layout_t
*curlay
= layout_get_current(screen
);
37 int phys_screen
= screen_virttophys(screen
);
38 xcb_query_pointer_cookie_t qp_c
;
39 xcb_query_pointer_reply_t
*qp_r
;
41 for(c
= globalconf
.clients
; c
; c
= c
->next
)
43 if(client_isvisible(c
, screen
))
45 /* we don't touch other screens windows */
46 else if(c
->screen
== screen
)
53 qp_c
= xcb_query_pointer_unchecked(globalconf
.connection
,
54 xutil_screen_get(globalconf
.connection
,
57 /* check that the mouse is on a window or not */
58 if((qp_r
= xcb_query_pointer_reply(globalconf
.connection
, qp_c
, NULL
)))
60 if(qp_r
->child
== XCB_NONE
|| qp_r
->root
== qp_r
->child
)
61 window_root_buttons_grab(qp_r
->root
);
62 else if ((c
= client_getbywin(qp_r
->child
)))
63 window_buttons_grab(c
->win
, qp_r
->root
, &c
->buttons
);
65 globalconf
.pointer_x
= qp_r
->root_x
;
66 globalconf
.pointer_y
= qp_r
->root_y
;
72 globalconf
.screens
[screen
].need_arrange
= false;
75 lua_pushnumber(globalconf
.L
, screen
+ 1);
76 luaA_dofunction(globalconf
.L
, globalconf
.hooks
.arrange
, 1, 0);
79 /** Refresh the screen disposition
80 * \return true if the screen was arranged, false otherwise
87 for(screen
= 0; screen
< globalconf
.nscreen
; screen
++)
88 if(globalconf
.screens
[screen
].need_arrange
)
92 /** Get current layout used on screen.
93 * \param screen Virtual screen number.
94 * \return layout used on that screen
97 layout_get_current(int screen
)
100 tag_t
**curtags
= tags_get_current(screen
);
103 l
= curtags
[0]->layout
;
109 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80