feh icon indicating copy to clipboard operation
feh copied to clipboard

feh should request Full Screen to the window manager

Open denilsonsa opened this issue 2 years ago • 2 comments

I'm asking this, but please be aware that I don't fully comprehend how "full screen" works on X11.

How to reproduce

  1. Get a system with multiple displays running KDE/Plasma. In my case, Manjaro Linux with KDE/Plasma on Xorg. (I'm not using Wayland.)
  2. Go to the KDE System Settings.
  3. Under Window Management, select KWin Scripts.
  4. Enable Video Wall.
  5. Click on the little settings button besides the Video Wall script.
  6. Either uncheck Apply to (which means it applies to all applications), or add , feh to the list.
  7. Click Ok, Apply, etc. You may even close the system settings and logout and login again, if you prefer.
  8. Now open feh on any image.
  9. Press F to go to full screen.

What happens

Feh is full-screen on a single display.

What I expected to happen

Feh should have expanded to all displays.

Why?

  1. Feh would have requested the full screen mode.
  2. Then, KWin (the window manager) would intercept it and run the Video Wall script.
  3. The Video Wall script is supposed to be executed every time fullScreenChanged event happens.
  4. The Video Wall script would then set the Feh full screen window dimensions to match all the displays.

It works fine when setting full screen on Firefox, VLC, Konsole, and certainly others.

For some unknown reason, it doesn't work for Feh. I believe the fullScreenChanged event is never triggered for Feh windows, possibly because Feh's full-screen implementation is missing something that the other apps have. But this is just a guess. You can confirm it by changing the /usr/share/kwin/scripts/videowall/contents/code/main.js script to add console.log(window) (or console.log(client)) on the callback function passed to connect(). (Please remember to reload the KWin script. If unsure, just logout and login again.) On my system, that console.log() prints stuff for the aforementioned applications, but doesn't print anything for Feh, which means that callback is never called.

denilsonsa avatar Jan 02 '24 00:01 denilsonsa

Relevant VLC source-code: (probably)

  • https://code.videolan.org/videolan/vlc/-/blob/bc0ae4752e63638d5fe16d7304cb0edfa1f8c50f/modules/video_output/xcb/window.c#L704-766
  • https://code.videolan.org/videolan/vlc/-/blob/bc0ae4752e63638d5fe16d7304cb0edfa1f8c50f/modules/video_output/xcb/window.c#L941-942

Relevant Feh source-code: (probably)

  • https://github.com/derf/feh/blob/1d02f9027a39d45657e78eba19b4956158bb4365/src/winwidget.c#L294-L309
  • https://github.com/derf/feh/blob/1d02f9027a39d45657e78eba19b4956158bb4365/src/winwidget.c#L344-L353

Running xwininfo -wm on VLC (before and after entering full screen):

xwininfo: Window id: 0x5c0000c "rickroll.mp4 - VLC media player"

  Window manager hints:
      Client accepts input or input focus: Yes
      Initial state is Normal State
      Displayed on desktop 0
      Window type:
          Normal
      Process id: 545810 on host foobar
      Frame extents: 0, 0, 28, 0

xwininfo: Window id: 0x5c0000c "rickroll.mp4 - VLC media player"

  Window manager hints:
      Client accepts input or input focus: Yes
      Initial state is Normal State
      Displayed on desktop 0
      Window type:
          Normal
      Window state:
          Fullscreen
          Focused
      Process id: 545810 on host foobar
      Frame extents: 0, 0, 0, 0

Running xwininfo -wm on Feh (before and after entering full screen):

xwininfo: Window id: 0x6200001 "feh [1 of 8] - foobar.jpg"

  No window manager hints defined
  Window manager hints:
      Displayed on desktop 0
      Process id: 550205 on host foobar
      Frame extents: 0, 0, 28, 0

xwininfo: Window id: 0x6200005 "feh [1 of 8] - foobar.jpg"

  No window manager hints defined
  Window manager hints:
      Displayed on desktop 0
      Window state:
          Maximized Vert
          Maximized Horz
          Fullscreen
      Process id: 550205 on host foobar

Somehow, it says "No window manager hints defined" for Feh. This may be a hint to start understanding what is the root cause.

denilsonsa avatar Jan 02 '24 00:01 denilsonsa

When using xprop against both VLC and Feh, I noticed:

  • VLC had _NET_WM_STATE(ATOM) = when windowed.
  • Feh had _NET_WM_STATE(ATOM) = when windowed.
  • VLC had _NET_WM_STATE(ATOM) = _NET_WM_STATE_FULLSCREEN when full screen.
  • Feh had _NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_FULLSCREEN when full screen.
  • VLC has _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL, while Feh didn't have that hint/prop.
  • VLC and Feh had different (hexadecimal) values for _MOTIF_WM_HINTS.

I don't know what else to do. If you can provide a patch (or a branch), I can try compiling it myself and observing if the behavior changes.

denilsonsa avatar Jan 02 '24 01:01 denilsonsa