diff --git a/common/xscreen.c b/common/xscreen.c index 4b2c6239..2c0a4590 100644 --- a/common/xscreen.c +++ b/common/xscreen.c @@ -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; } diff --git a/common/xutil.c b/common/xutil.c index 2071056b..426b003b 100644 --- a/common/xutil.c +++ b/common/xutil.c @@ -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) { diff --git a/common/xutil.h b/common/xutil.h index 3f5ad99e..bd6e28d3 100644 --- a/common/xutil.h +++ b/common/xutil.h @@ -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