Section: utils
Priority: optional
Maintainer: Michael Stapelberg <michael+i3@stapelberg.de>
-Build-Depends: debhelper (>= 5), libxcb-wm0-dev (>= 0.3.3), libxcb-aux0-dev (>= 0.3.3), asciidoc
+Build-Depends: debhelper (>= 5), libx11-dev, libxcb-wm0-dev (>= 0.3.3), libxcb-aux0-dev (>= 0.3.3), asciidoc
Standards-Version: 3.8.0
Homepage: http://i3.zekjur.net/
uint32_t colorpixel, uint32_t x, uint32_t y, uint32_t to_x, uint32_t to_y);
void xcb_draw_rect(xcb_connection_t *conn, xcb_drawable_t drawable, xcb_gcontext_t gc,
uint32_t colorpixel, uint32_t x, uint32_t y, uint32_t width, uint32_t height);
+void fake_configure_notify(xcb_connection_t *conn, Rect r, xcb_window_t window);
#endif
Client *client = table_get(byChild, event->window);
if (client == NULL) {
- LOG("No such client\n");
+ LOG("This client is not mapped, so we don't care and just tell the client that he will get its size\n");
+ Rect rect = {event->x, event->y, event->width, event->height};
+ fake_configure_notify(conn, rect, event->window);
return 1;
}
- xcb_configure_notify_event_t generated_event;
-
- generated_event.event = client->child;
- generated_event.window = client->child;
- generated_event.response_type = XCB_CONFIGURE_NOTIFY;
-
- generated_event.x = client->child_rect.x;
- generated_event.y = client->child_rect.y;
- generated_event.width = client->child_rect.width;
- generated_event.height = client->child_rect.height;
-
- generated_event.border_width = 0;
- generated_event.above_sibling = XCB_NONE;
- generated_event.override_redirect = false;
-
- xcb_send_event(conn, false, client->child, XCB_EVENT_MASK_STRUCTURE_NOTIFY, (char*)&generated_event);
- xcb_flush(conn);
+ fake_configure_notify(conn, client->child_rect, client->child);
LOG("Told the client to stay at %dx%d with size %dx%d\n",
client->child_rect.x, client->child_rect.y, client->child_rect.width, client->child_rect.height);
/* After configuring a child window we need to fake a configure_notify_event according
to ICCCM 4.2.3. This seems rather broken, especially since X sends exactly the same
configure_notify_event automatically according to xtrace. Anyone knows details? */
- xcb_configure_notify_event_t event;
-
- event.event = client->child;
- event.window = client->child;
- event.response_type = XCB_CONFIGURE_NOTIFY;
-
- event.x = rect->x;
- event.y = rect->y;
- event.width = rect->width;
- event.height = rect->height;
-
- event.border_width = 0;
- event.above_sibling = XCB_NONE;
- event.override_redirect = false;
-
- xcb_send_event(conn, false, client->child, XCB_EVENT_MASK_STRUCTURE_NOTIFY, (char*)&event);
+ fake_configure_notify(conn, rect, client->child);
}
/*
xcb_rectangle_t rect = {x, y, width, height};
xcb_poly_fill_rectangle(conn, drawable, gc, 1, &rect);
}
+
+/*
+ * Generates a configure_notify event and sends it to the given window
+ * Applications need this to think they’ve configured themselves correctly.
+ * The truth is, however, that we will manage them.
+ *
+ */
+void fake_configure_notify(xcb_connection_t *conn, Rect r, xcb_window_t window) {
+ xcb_configure_notify_event_t generated_event;
+
+ generated_event.event = window;
+ generated_event.window = window;
+ generated_event.response_type = XCB_CONFIGURE_NOTIFY;
+
+ generated_event.x = r.x;
+ generated_event.y = r.y;
+ generated_event.width = r.width;
+ generated_event.height = r.height;
+
+ generated_event.border_width = 0;
+ generated_event.above_sibling = XCB_NONE;
+ generated_event.override_redirect = false;
+
+ xcb_send_event(conn, false, window, XCB_EVENT_MASK_STRUCTURE_NOTIFY, (char*)&generated_event);
+ xcb_flush(conn);
+}