Fix Xinerama detection

This commit is contained in:
Julien Danjou 2008-03-23 17:58:10 +00:00
parent bf4071397a
commit 3b295beaed
3 changed files with 16 additions and 25 deletions

View File

@ -78,15 +78,24 @@ screensinfo_new(xcb_connection_t *conn)
int xinerama_screen_number, screen, screen_to_test;
xcb_screen_t *s;
bool drop;
xcb_xinerama_is_active_reply_t *r = NULL;
si = p_new(ScreensInfo, 1);
xsq = xcb_xinerama_query_screens_reply(conn,
xcb_xinerama_query_screens_unchecked(conn),
NULL);
if((si->xinerama_is_active = xinerama_is_active(conn)) && xsq)
/* Check for extension before checking for Xinerama */
if(xcb_get_extension_data(conn, &xcb_xinerama_id)->present)
{
r = xcb_xinerama_is_active_reply(conn, xcb_xinerama_is_active(conn), NULL);
si->xinerama_is_active = r->state;
p_delete(&r);
}
if(si->xinerama_is_active)
{
xsq = xcb_xinerama_query_screens_reply(conn,
xcb_xinerama_query_screens_unchecked(conn),
NULL);
xsi = xcb_xinerama_query_screens_screen_info(xsq);
xinerama_screen_number = xcb_xinerama_query_screens_screen_info_length(xsq);
@ -121,6 +130,8 @@ screensinfo_new(xcb_connection_t *conn)
p_delete(&si->geometry);
si->geometry = newgeometry;
}
p_delete(&xsq);
}
else
{
@ -136,9 +147,6 @@ screensinfo_new(xcb_connection_t *conn)
}
}
if(xsq)
p_delete(&xsq);
return si;
}

View File

@ -132,22 +132,6 @@ x_get_transient_for_hint(xcb_connection_t *c, xcb_window_t win,
return true;
}
bool
xinerama_is_active(xcb_connection_t *c)
{
bool ret;
xcb_xinerama_is_active_reply_t *r = NULL;
r = xcb_xinerama_is_active_reply(c, xcb_xinerama_is_active(c), NULL);
if(!r)
return false;
ret = r->state;
p_delete(&r);
return ret;
}
xcb_window_t
root_window(xcb_connection_t *c, int screen_number)
{

View File

@ -77,7 +77,6 @@ unsigned int xgetnumlockmask(xcb_connection_t *);
/* Common function defined in Xlib but not in XCB */
bool x_get_transient_for_hint(xcb_connection_t *, xcb_window_t, xcb_window_t *);
bool xinerama_is_active(xcb_connection_t *);
xcb_window_t root_window(xcb_connection_t *, int);
typedef struct _class_hint_t