client: manage take phys_screen as arg

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-09-03 22:25:24 +02:00
parent fcde8d229b
commit 3a45831242
4 changed files with 28 additions and 31 deletions

View File

@ -89,7 +89,7 @@ awesome_atexit(void)
static void
scan(void)
{
int i, screen, real_screen, tree_c_len;
int i, screen, phys_screen, tree_c_len;
const int screen_max = xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
root_win_t root_wins[screen_max];
xcb_query_tree_reply_t *tree_r;
@ -98,20 +98,20 @@ scan(void)
xcb_get_geometry_reply_t *geom_r;
long state;
for(screen = 0; screen < screen_max; screen++)
for(phys_screen = 0; phys_screen < screen_max; phys_screen++)
{
/* Get the root window ID associated to this screen */
root_wins[screen].id = xutil_screen_get(globalconf.connection, screen)->root;
root_wins[phys_screen].id = xutil_screen_get(globalconf.connection, phys_screen)->root;
/* Get the window tree associated to this screen */
root_wins[screen].tree_cookie = xcb_query_tree_unchecked(globalconf.connection,
root_wins[screen].id);
root_wins[phys_screen].tree_cookie = xcb_query_tree_unchecked(globalconf.connection,
root_wins[phys_screen].id);
}
for(screen = 0; screen < screen_max; screen++)
for(phys_screen = 0; phys_screen < screen_max; phys_screen++)
{
tree_r = xcb_query_tree_reply(globalconf.connection,
root_wins[screen].tree_cookie,
root_wins[phys_screen].tree_cookie,
NULL);
if(!tree_r)
@ -170,10 +170,10 @@ scan(void)
*(geom_wins[i]), NULL)))
continue;
real_screen = screen_get_bycoord(globalconf.screens_info, screen,
screen = screen_get_bycoord(globalconf.screens_info, phys_screen,
geom_r->x, geom_r->y);
client_manage(wins[i], geom_r, real_screen);
client_manage(wins[i], geom_r, phys_screen, screen);
p_delete(&geom_r);
}

View File

@ -392,10 +392,11 @@ client_stack(void)
/** Manage a new client.
* \param w The window.
* \param wgeom Window geometry.
* \param phys_screen Physical screen number.
* \param screen Virtual screen number where to manage client.
*/
void
client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen)
client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, int screen)
{
xcb_get_property_cookie_t ewmh_icon_cookie;
client_t *c;
@ -413,7 +414,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen)
if(systray_iskdedockapp(w))
{
systray_request_handle(w, screen_virttophys(screen), NULL);
systray_request_handle(w, phys_screen, NULL);
return;
}
@ -421,10 +422,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen)
c->screen = screen_get_bycoord(globalconf.screens_info, screen, wgeom->x, wgeom->y);
if(globalconf.screens_info->xinerama_is_active)
c->phys_screen = globalconf.default_screen;
else
c->phys_screen = c->screen;
c->phys_screen = phys_screen;
/* Initial values */
c->win = w;

View File

@ -40,7 +40,7 @@ client_t * client_getbywin(xcb_window_t);
void client_stack(void);
void client_ban(client_t *);
void client_unban(client_t *);
void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, int);
void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, int, int);
area_t client_geometry_hints(client_t *, area_t);
bool client_resize(client_t *, area_t, bool);
void client_unmanage(client_t *);

25
event.c
View File

@ -553,7 +553,7 @@ static int
event_handle_maprequest(void *data __attribute__ ((unused)),
xcb_connection_t *connection, xcb_map_request_event_t *ev)
{
int screen_nbr = 0, ret = 0;
int phys_screen, screen = 0, ret = 0;
client_t *c;
xcb_get_window_attributes_cookie_t wa_c;
xcb_get_window_attributes_reply_t *wa_r;
@ -592,36 +592,35 @@ event_handle_maprequest(void *data __attribute__ ((unused)),
geom_c = xcb_get_geometry_unchecked(connection, ev->window);
if(globalconf.screens_info->xinerama_is_active)
qp_c = xcb_query_pointer_unchecked(connection, xutil_screen_get(globalconf.connection,
screen_nbr)->root);
qp_c = xcb_query_pointer_unchecked(connection,
xutil_screen_get(globalconf.connection,
globalconf.default_screen)->root);
if(!(geom_r = xcb_get_geometry_reply(connection, geom_c, NULL)))
{
if(globalconf.screens_info->xinerama_is_active)
{
qp_r = xcb_query_pointer_reply(connection, qp_c, NULL);
p_delete(&qp_r);
}
ret = -1;
goto bailout;
}
for(iter = xcb_setup_roots_iterator(xcb_get_setup(connection)), phys_screen = 0;
iter.rem && iter.data->root != geom_r->root; xcb_screen_next(&iter), ++phys_screen);
if(globalconf.screens_info->xinerama_is_active
&& (qp_r = xcb_query_pointer_reply(connection, qp_c, NULL)))
{
screen_nbr = screen_get_bycoord(globalconf.screens_info, screen_nbr,
screen = screen_get_bycoord(globalconf.screens_info, screen,
qp_r->root_x, qp_r->root_y);
p_delete(&qp_r);
}
else
for(iter = xcb_setup_roots_iterator(xcb_get_setup(connection)), screen_nbr = 0;
iter.rem && iter.data->root != geom_r->root; xcb_screen_next (&iter), ++screen_nbr);
screen = phys_screen;
client_manage(ev->window, geom_r, screen_nbr);
client_manage(ev->window, geom_r, phys_screen, screen);
p_delete(&geom_r);
}
bailout:
p_delete(&qp_r);
p_delete(&wa_r);
return ret;
}