14#include <xcb/xinerama.h>
39 xcb_xinerama_query_screens_reply_t *reply;
40 xcb_xinerama_screen_info_t *screen_info;
42 reply = xcb_xinerama_query_screens_reply(
conn, xcb_xinerama_query_screens_unchecked(
conn), NULL);
44 ELOG(
"Couldn't get Xinerama screens\n");
47 screen_info = xcb_xinerama_query_screens_screen_info(reply);
48 int screens = xcb_xinerama_query_screens_screen_info_length(reply);
50 for (
int screen = 0; screen < screens; screen++) {
53 DLOG(
"Re-used old Xinerama screen %p\n", s);
66 s->
rect.
x = screen_info[screen].x_org;
67 s->
rect.
y = screen_info[screen].y_org;
68 s->
rect.
width = screen_info[screen].width;
81 DLOG(
"found Xinerama screen: %d x %d at %d x %d\n",
82 screen_info[screen].width, screen_info[screen].height,
83 screen_info[screen].x_org, screen_info[screen].y_org);
89 ELOG(
"No screens found. Please fix your setup. i3 will exit now.\n");
113 if (!xcb_get_extension_data(
conn, &xcb_xinerama_id)->present) {
114 DLOG(
"Xinerama extension not found, using root output.\n");
117 xcb_xinerama_is_active_reply_t *reply;
118 reply = xcb_xinerama_is_active_reply(
conn, xcb_xinerama_is_active(
conn), NULL);
120 if (reply == NULL || !reply->state) {
121 DLOG(
"Xinerama is not active (in your X-Server), using root output.\n");
char * output_primary_name(Output *output)
Retrieves the primary name of an output.
void init_ws_for_output(Output *output)
Initializes at least one workspace for this output, trying the following steps until there is at leas...
void output_init_con(Output *output)
Initializes a CT_OUTPUT Con (searches existing ones from inplace restart before) to use for the given...
struct outputs_head outputs
Output * create_root_output(xcb_connection_t *conn)
Creates an output covering the root window.
static Output * get_screen_at(unsigned int x, unsigned int y)
static void use_root_output(xcb_connection_t *conn)
static void query_screens(xcb_connection_t *conn)
void xinerama_init(void)
We have just established a connection to the X server and need the initial Xinerama information to se...
xcb_connection_t * conn
XCB connection and root screen.
void * scalloc(size_t num, size_t size)
Safe-wrapper around calloc which exits if malloc returns NULL (meaning that there is no more memory a...
int sasprintf(char **strp, const char *fmt,...)
Safe-wrapper around asprintf which exits if it returns -1 (meaning that there is no more memory avail...
#define TAILQ_FOREACH(var, head, field)
#define SLIST_INSERT_HEAD(head, elm, field)
#define TAILQ_INSERT_TAIL(head, elm, field)
#define TAILQ_INSERT_HEAD(head, elm, field)
An Output is a physical output on your graphics driver.
bool active
Whether the output is currently active (has a CRTC attached with a valid mode)
Rect rect
x, y, width, height