int predict_text_width(xcb_connection_t *conn, const char *font_pattern, char *text,
int length);
+/**
+ * Configures the given window to have the size/position specified by given rect
+ *
+ */
+void xcb_set_window_rect(xcb_connection_t *conn, xcb_window_t window, Rect r);
+
#endif
workspace->fullscreen_client = client;
LOG("Entering fullscreen mode...\n");
/* We just entered fullscreen mode, let’s configure the window */
- uint32_t mask = XCB_CONFIG_WINDOW_X |
- XCB_CONFIG_WINDOW_Y |
- XCB_CONFIG_WINDOW_WIDTH |
- XCB_CONFIG_WINDOW_HEIGHT;
- uint32_t values[4] = {workspace->rect.x,
- workspace->rect.y,
- workspace->rect.width,
- workspace->rect.height};
+ Rect r = workspace->rect;
DLOG("child itself will be at %dx%d with size %dx%d\n",
- values[0], values[1], values[2], values[3]);
+ r.x, r.y, r.width, r.height);
- xcb_configure_window(conn, client->frame, mask, values);
+ xcb_set_window_rect(conn, client->frame, r);
/* Child’s coordinates are relative to the parent (=frame) */
- values[0] = 0;
- values[1] = 0;
- xcb_configure_window(conn, client->child, mask, values);
+ r.x = 0;
+ r.y = 0;
+ xcb_set_window_rect(conn, client->child, r);
/* Raise the window */
- values[0] = XCB_STACK_MODE_ABOVE;
+ uint32_t values[] = { XCB_STACK_MODE_ABOVE };
xcb_configure_window(conn, client->frame, XCB_CONFIG_WINDOW_STACK_MODE, values);
- Rect child_rect = workspace->rect;
- child_rect.x = child_rect.y = 0;
- fake_configure_notify(conn, child_rect, client->child);
+ fake_configure_notify(conn, r, client->child);
xcb_flush(conn);
}
DLOG("frame 0x%08x needs to be pushed to %dx%d\n", client->frame, client->rect.x, client->rect.y);
DLOG("resizing client 0x%08x to %d x %d\n", client->frame, client->rect.width, client->rect.height);
- xcb_configure_window(conn, client->frame,
- XCB_CONFIG_WINDOW_X |
- XCB_CONFIG_WINDOW_Y |
- XCB_CONFIG_WINDOW_WIDTH |
- XCB_CONFIG_WINDOW_HEIGHT,
- &(client->rect.x));
+ xcb_set_window_rect(conn, client->frame, client->rect);
/* Adjust the position of the child inside its frame.
* The coordinates of the child are relative to its frame, we
* add a border of 2 pixel to each value */
- uint32_t mask = XCB_CONFIG_WINDOW_X |
- XCB_CONFIG_WINDOW_Y |
- XCB_CONFIG_WINDOW_WIDTH |
- XCB_CONFIG_WINDOW_HEIGHT;
Rect *rect = &(client->child_rect);
switch (container_mode(client->container, true)) {
case MODE_STACK:
DLOG("child will be at %dx%d with size %dx%d\n", rect->x, rect->y, rect->width, rect->height);
- xcb_configure_window(conn, client->child, mask, &(rect->x));
+ xcb_set_window_rect(conn, client->child, *rect);
/* After configuring a child window we need to fake a configure_notify_event (see ICCCM 4.2.3).
* This is necessary to inform the client of its position relative to the root window,
*
* i3 - an improved dynamic tiling window manager
*
- * © 2009 Michael Stapelberg and contributors
+ * © 2009-2010 Michael Stapelberg and contributors
*
* See file LICENSE for license information.
*
return width;
}
+
+/*
+ * Configures the given window to have the size/position specified by given rect
+ *
+ */
+void xcb_set_window_rect(xcb_connection_t *conn, xcb_window_t window, Rect r) {
+ xcb_configure_window(conn, window,
+ XCB_CONFIG_WINDOW_X |
+ XCB_CONFIG_WINDOW_Y |
+ XCB_CONFIG_WINDOW_WIDTH |
+ XCB_CONFIG_WINDOW_HEIGHT,
+ &(r.x));
+}