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; int xinerama_screen_number, screen, screen_to_test;
xcb_screen_t *s; xcb_screen_t *s;
bool drop; bool drop;
xcb_xinerama_is_active_reply_t *r = NULL;
si = p_new(ScreensInfo, 1); si = p_new(ScreensInfo, 1);
xsq = xcb_xinerama_query_screens_reply(conn, /* Check for extension before checking for Xinerama */
xcb_xinerama_query_screens_unchecked(conn), if(xcb_get_extension_data(conn, &xcb_xinerama_id)->present)
NULL);
if((si->xinerama_is_active = xinerama_is_active(conn)) && xsq)
{ {
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); xsi = xcb_xinerama_query_screens_screen_info(xsq);
xinerama_screen_number = xcb_xinerama_query_screens_screen_info_length(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); p_delete(&si->geometry);
si->geometry = newgeometry; si->geometry = newgeometry;
} }
p_delete(&xsq);
} }
else else
{ {
@ -136,9 +147,6 @@ screensinfo_new(xcb_connection_t *conn)
} }
} }
if(xsq)
p_delete(&xsq);
return si; return si;
} }

View File

@ -132,22 +132,6 @@ x_get_transient_for_hint(xcb_connection_t *c, xcb_window_t win,
return true; 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 xcb_window_t
root_window(xcb_connection_t *c, int screen_number) 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 */ /* 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 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); xcb_window_t root_window(xcb_connection_t *, int);
typedef struct _class_hint_t typedef struct _class_hint_t