From e3085b4f7574f3891e280f44c650af2b0b03f1ba Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Fri, 13 Mar 2009 04:51:17 +0100 Subject: [PATCH] Fix fullscreen for xpdf (at least on debian, with proper _NET_WM_STATE hints) 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 | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mainx.c b/src/mainx.c index 43511b0d..0b0e1bb1 100644 --- a/src/mainx.c +++ b/src/mainx.c @@ -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); } -- 2.39.5