
I wrote a patch[1] for MuPDF's OpenGL viewer (which makes use of GLFW) to enable fullscreen toggle, but XMonad doesn't like GLFW's implementation. Also, since glfwSetWindowTitle sets X11's title, class, and instance to the same value, it's currently impossible[2] to apply a rule for the window, but it's easy to patch and test if you think this can be solved with a manageHook rule. Entering and returning from fullscreen does work correctly with FVWM, Fluxbox, WindowMaker, dwm, Weston, and sway, of which two are Wayland compositors and dwm is a tiling wm like XMonad. What happens with XMonad is that it enters GLFW fullscreen after a multi-second delay and is not able to return from it on toggle. If I patch mupdf to not update the title, add a doFloat rule, and toggle fullscreen, it does not enter fullscreen until I manually interact with the still visibly floating window by trying to move it with a mouse. However, it does return from fullscreen into its original size/position when I press 'f' again. My config is a a personal extension of https://github.com/xmonad/xmonad-testing/blob/master/example-config.hs. Is GLFW's fullscreen toggle implementation generally problematic in XMonad, or can I solve this in my config? As noted in [1], llpp fullscreen toggle works with XMonad, and it uses OpenGL as well, but it doesn't rely on GLFW, so this isn't a general issue with OpenGL but specific to GLFW. [1] https://bugs.ghostscript.com/show_bug.cgi?id=697593 [2] https://bugs.ghostscript.com/show_bug.cgi?id=697634

On 2 March 2017 at 01:35, Tuncer Ayaz
Also, since glfwSetWindowTitle sets X11's title, class, and instance to the same value, it's currently impossible[2] to apply a rule for the window, but it's easy to patch and test if you think this can be solved with a manageHook rule. [...] [2] https://bugs.ghostscript.com/show_bug.cgi?id=697634
Actually, glfwSetwindowtitle is not at fault. MuPDF didn't pass the correct string when calling glfwCreateWindow(). Patch attached in MuPDF bug report. So, if a manageHook rule can fix the fullscreen problem, we'll be able to match instance or class now.

On 03/02/2017 08:29 AM, Tuncer Ayaz wrote:
On 2 March 2017 at 01:35, Tuncer Ayaz
wrote: [..] [2] https://bugs.ghostscript.com/show_bug.cgi?id=697634
Actually, glfwSetwindowtitle is not at fault. MuPDF didn't pass the correct string when calling glfwCreateWindow(). Patch attached in MuPDF bug report.
So, if a manageHook rule can fix the fullscreen problem, we'll be able to match instance or class now.
Hi. I think, you need to enable EWMH support. I've tried with minimal config from [XMonad.Hooks.EwmhDesktops][1] and fullscreen works (in `mupdf-x11` with and without your patch, if i've applied it correctly). [1]: http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html

On 5 March 2017 at 09:51, Dmitriy Matrosov wrote:
On 03/02/2017 08:29 AM, Tuncer Ayaz wrote:
On 2 March 2017 at 01:35, Tuncer Ayaz
wrote: [..] [2] https://bugs.ghostscript.com/show_bug.cgi?id=697634
Actually, glfwSetwindowtitle is not at fault. MuPDF didn't pass the correct string when calling glfwCreateWindow(). Patch attached in MuPDF bug report.
So, if a manageHook rule can fix the fullscreen problem, we'll be able to match instance or class now.
Hi.
I think, you need to enable EWMH support. I've tried with minimal config from [XMonad.Hooks.EwmhDesktops][1] and fullscreen works (in `mupdf-x11` with and without your patch, if i've applied it correctly).
Thanks for taking a look. My patches are for fixing mupdf-gl (the GLFW created OpenGL viewer). desktopConfig, which is what I use in my extended version of example-config.hs, has basic EWMH enabled. Nonetheless, I've added handleEventHook with EwmhDesktops.fullscreenEventHook, but it didn't make a difference. I think you tried the x11 viewer and not glfw. Test mupdf-gl instead. So, if you manage to modify https://raw.githubusercontent.com/xmonad/xmonad-testing/master/example-confi... such that it doesn't (on entering fullscreen) print a set of gl error 65544: X11: Iconification of full screen windows requires a WM that supports EWMH fullscreen and thereby toggles fullscreen like mupdf-x11, we can fix the example config.

On Sun, Mar 5, 2017 at 7:08 AM, Tuncer Ayaz
gl error 65544: X11: Iconification of full screen windows requires a WM that supports EWMH fullscreen
This is xmonad not *advertising* EWMH fuillscreen, because the startupHook can't tell whether the fullscreenEventHook is present or not. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On 03/05/2017 03:08 PM, Tuncer Ayaz wrote:
My patches are for fixing mupdf-gl (the GLFW created OpenGL viewer).
desktopConfig, which is what I use in my extended version of example-config.hs, has basic EWMH enabled. Nonetheless, I've added handleEventHook with EwmhDesktops.fullscreenEventHook, but it didn't make a difference.
I think you tried the x11 viewer and not glfw. Test mupdf-gl instead.
Ah, yes, i've tried `mupdf-x11`. But now, i think, i found the reason why fullscreen doesn't work: as Brandon Allbery noted, the problem is in advertising EWMH. It turns out, two atoms are missed in `_NET_SUPPORTED`: `_NET_WM_STATE` and `_NET_WM_STATE_FULLSCREEN`. Without them glfw goes with "override redirect" way and fullscreen does not work properly. Here is the relevant code from `glfw/src/x11_window.c`: static void updateWindowMode(_GLFWwindow* window) { if (window->monitor) { if (_glfw.x11.xinerama.available && _glfw.x11.NET_WM_FULLSCREEN_MONITORS) { sendEventToWM(window, _glfw.x11.NET_WM_FULLSCREEN_MONITORS, window->monitor->x11.index, window->monitor->x11.index, window->monitor->x11.index, window->monitor->x11.index, 0); } if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_FULLSCREEN) { sendEventToWM(window, _glfw.x11.NET_WM_STATE, _NET_WM_STATE_ADD, _glfw.x11.NET_WM_STATE_FULLSCREEN, 0, 1, 0); } else { // This is the butcher's way of removing window decorations // Setting the override-redirect attribute on a window makes the // window manager ignore the window completely (ICCCM, section 4) // The good thing is that this makes undecorated full screen windows // easy to do; the bad thing is that we have to do everything // manually and some things (like iconify/restore) won't work at // all, as those are tasks usually performed by the window manager XSetWindowAttributes attributes; attributes.override_redirect = True; XChangeWindowAttributes(_glfw.x11.display, window->x11.handle, CWOverrideRedirect, &attributes); window->x11.overrideRedirect = GLFW_TRUE; } The right way is when (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_FULLSCREEN) == True. So, apart from regular `XMonad.Hooks.EwmhDesktops` i need to advertise two more atoms in `_NET_SUPPORTED`. Here is xmonad config working for me: import Data.Maybe import Control.Monad import XMonad import XMonad.Hooks.EwmhDesktops addNETSupported :: Atom -> X () addNETSupported x = withDisplay $ \dpy -> do r <- asks theRoot a_NET_SUPPORTED <- getAtom "_NET_SUPPORTED" a <- getAtom "ATOM" liftIO $ do sup <- (join . maybeToList) <$> getWindowProperty32 dpy a_NET_SUPPORTED r when (fromIntegral x `notElem` sup) $ changeProperty32 dpy r a_NET_SUPPORTED a propModeAppend [fromIntegral x] addEWMHFullscreen :: X () addEWMHFullscreen = do wms <- getAtom "_NET_WM_STATE" wfs <- getAtom "_NET_WM_STATE_FULLSCREEN" mapM_ addNETSupported [wms, wfs] main :: IO () main = xmonad . ewmh $ def { modMask = mod4Mask , handleEventHook = fullscreenEventHook <+> handleEventHook def , startupHook = startupHook def >> addEWMHFullscreen }

On 03/06/2017 11:03 PM, Dmitriy Matrosov wrote:
[..] So, apart from regular `XMonad.Hooks.EwmhDesktops` i need to advertise two more atoms in `_NET_SUPPORTED`. Here is xmonad config working for me:
It seems, gmail wraps the lines.. Here is the xmonad.hs from previous message again: https://gist.github.com/sgf-dma/a609f855bbacf1a0292e660c32a5a04e

On Mon, Mar 6, 2017 at 3:13 PM, Dmitriy Matrosov
It seems, gmail wraps the lines
Use "Fixed Width" font in the formatting toolbar at the bottom of the compose window. Indenting the code is also a good idea, since mail readers don't always agree on how to treat such things. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On 6 March 2017 at 20:03, Dmitriy Matrosov
On 03/05/2017 03:08 PM, Tuncer Ayaz wrote:
My patches are for fixing mupdf-gl (the GLFW created OpenGL viewer).
desktopConfig, which is what I use in my extended version of example-config.hs, has basic EWMH enabled. Nonetheless, I've added handleEventHook with EwmhDesktops.fullscreenEventHook, but it didn't make a difference.
I think you tried the x11 viewer and not glfw. Test mupdf-gl instead.
Ah, yes, i've tried `mupdf-x11`. But now, i think, i found the reason why fullscreen doesn't work: as Brandon Allbery noted, the problem is in advertising EWMH. It turns out, two atoms are missed in `_NET_SUPPORTED`: `_NET_WM_STATE` and `_NET_WM_STATE_FULLSCREEN`. Without them glfw goes with "override redirect" way and fullscreen does not work properly. Here is the relevant code from `glfw/src/x11_window.c`:
Sorry for the late reply. I haven't had success with your xmonad.hs "hack" yet, but my mupdf patches landed upstream, so vanilla mupdf-gl from master will work correctly if the window manager does as well. Also, it sounds like the bug could be fixed in xmonad-contrib. Is that correct? Or would it make more sense to include the "hack" in xmonad-testing/example.hs?

On 03/20/2017 03:00 AM, Tuncer Ayaz wrote:
On 6 March 2017 at 20:03, Dmitriy Matrosov
wrote: On 03/05/2017 03:08 PM, Tuncer Ayaz wrote:
My patches are for fixing mupdf-gl (the GLFW created OpenGL viewer).
desktopConfig, which is what I use in my extended version of example-config.hs, has basic EWMH enabled. Nonetheless, I've added handleEventHook with EwmhDesktops.fullscreenEventHook, but it didn't make a difference.
I think you tried the x11 viewer and not glfw. Test mupdf-gl instead.
Ah, yes, i've tried `mupdf-x11`. But now, i think, i found the reason why fullscreen doesn't work: as Brandon Allbery noted, the problem is in advertising EWMH. It turns out, two atoms are missed in `_NET_SUPPORTED`: `_NET_WM_STATE` and `_NET_WM_STATE_FULLSCREEN`. Without them glfw goes with "override redirect" way and fullscreen does not work properly. Here is the relevant code from `glfw/src/x11_window.c`:
Sorry for the late reply. I haven't had success with your xmonad.hs "hack" yet, but my mupdf patches landed upstream, so vanilla mupdf-gl from master will work correctly if the window manager does as well.
You have tried my config or copied changes to yours? In the latter case, please, provide the exact entire config you've tried. And also the git revision in mupdf repository may help.
Also, it sounds like the bug could be fixed in xmonad-contrib. Is that correct? Or would it make more sense to include the "hack" in xmonad-testing/example.hs?
It should be fixed in xmonad-contrib in X.H.EwmhDesktops, as i understand. There is already PR adding [part][1] of what needed, but it haven't been merged yet. [1]: https://github.com/xmonad/xmonad-contrib/pull/109
participants (3)
-
Brandon Allbery
-
Dmitriy Matrosov
-
Tuncer Ayaz