]> git.sur5r.net Git - i3/i3/commitdiff
Fix fullscreen for xpdf (at least on debian, with proper _NET_WM_STATE hints)
authorMichael Stapelberg <michael+x200@stapelberg.de>
Fri, 13 Mar 2009 03:51:17 +0000 (04:51 +0100)
committerMichael Stapelberg <michael+x200@stapelberg.de>
Fri, 13 Mar 2009 03:51:17 +0000 (04:51 +0100)
xpdf sets the _NET_WM_STATE before actually mapping the window. i3 only checked
for changes of this hint, but not if it is already set when intially managing
the window.

Note that you need to patch your xpdf to support _NET_WM_STATE, because, while
only being reported at 2004, upstream still did not merge the patch *grrr*
See this debian bug report:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=247602
Or directly download the patch from:
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=61;filename=31_fullscreen.dpatch;att=1;bug=247602

src/mainx.c

index 43511b0db92d4be583765b7d273004362e5d0b72..0b0e1bb1430429e6064e88a67fddc658b664b02f 100644 (file)
@@ -126,7 +126,7 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
                 xcb_visualid_t visual, xcb_window_t root, uint8_t depth,
                 int16_t x, int16_t y, uint16_t width, uint16_t height) {
 
-        xcb_get_property_cookie_t wm_type_cookie, strut_cookie;
+        xcb_get_property_cookie_t wm_type_cookie, strut_cookie, state_cookie;
         uint32_t mask = 0;
         uint32_t values[3];
 
@@ -141,6 +141,7 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
         /* Place requests for properties ASAP */
         wm_type_cookie = xcb_get_any_property_unchecked(conn, false, child, atoms[_NET_WM_WINDOW_TYPE], UINT32_MAX);
         strut_cookie = xcb_get_any_property_unchecked(conn, false, child, atoms[_NET_WM_STRUT_PARTIAL], UINT32_MAX);
+        state_cookie = xcb_get_any_property_unchecked(conn, false, child, atoms[_NET_WM_STATE], UINT32_MAX);
 
         Client *new = table_get(byChild, child);
 
@@ -273,6 +274,20 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
                 SLIST_INSERT_HEAD(&(new->container->workspace->focus_stack), new, focus_clients);
         }
 
+        /* Check if the window already got the fullscreen hint set */
+        xcb_atom_t *state;
+        if ((preply = xcb_get_property_reply(conn, state_cookie, NULL)) != NULL &&
+            (state = xcb_get_property_value(preply)) != NULL)
+                /* Check all set _NET_WM_STATEs */
+                for (int i = 0; i < xcb_get_property_value_length(preply); i++)
+                        if (state[i] == atoms[_NET_WM_STATE_FULLSCREEN]) {
+                                /* If the window got the fullscreen state, we just toggle fullscreen
+                                   and don’t event bother to redraw the layout – that would not change
+                                   anything anyways */
+                                toggle_fullscreen(conn, new);
+                                return;
+                        }
+
         render_layout(conn);
 }