]> git.sur5r.net Git - i3/i3/commitdiff
Fake more configure notifies (makes xpdf work better)
authorMichael Stapelberg <michael+x200@stapelberg.de>
Thu, 12 Mar 2009 23:39:16 +0000 (00:39 +0100)
committerMichael Stapelberg <michael+x200@stapelberg.de>
Thu, 12 Mar 2009 23:39:16 +0000 (00:39 +0100)
debian/control
include/xcb.h
src/handlers.c
src/layout.c
src/xcb.c

index 06efef76ac83917f819e3b2ae7840e27fd09ee99..6ad86a065f5f422730ee8d6fa5b3ffab6cf7fbb1 100644 (file)
@@ -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/
 
index 31307e330f7d0b04df06bfc1dc784da2fa192050..338114e5d77f14353e256681dffe8fbed2bf5129 100644 (file)
@@ -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
index 8278a89a872bf81ae09ddaceec74df100192b683..ef28ae7c109d8d47b422307fd4820a323afb844c 100644 (file)
@@ -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);
index 547b7c52f79870885fbd476a16c6f685a59ff34b..4f1bdb368d572c51273c50eed34bb94476c9e865 100644 (file)
@@ -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);
 }
 
 /*
index 5b4260987677a5b2ea197e86964f99a847873da5..802acc81cef7c6d69f48749bcac6525afadc750a 100644 (file)
--- a/src/xcb.c
+++ b/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);
+}