Fake more configure notifies (makes xpdf work better)
This commit is contained in:
parent
89db5f7217
commit
14834c3530
|
@ -2,7 +2,7 @@ Source: i3-wm
|
|||
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/
|
||||
|
||||
|
|
|
@ -58,5 +58,6 @@ void xcb_draw_line(xcb_connection_t *conn, xcb_drawable_t drawable, xcb_gcontext
|
|||
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
|
||||
|
|
|
@ -447,27 +447,13 @@ int handle_configure_request(void *prophs, xcb_connection_t *conn, xcb_configure
|
|||
|
||||
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);
|
||||
|
|
17
src/layout.c
17
src/layout.c
|
@ -263,22 +263,7 @@ static void resize_client(xcb_connection_t *conn, Client *client) {
|
|||
/* 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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
26
src/xcb.c
26
src/xcb.c
|
@ -181,3 +181,29 @@ void xcb_draw_rect(xcb_connection_t *conn, xcb_drawable_t drawable, xcb_gcontext
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue