Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feh should request Full Screen to the window manager #744

Open
denilsonsa opened this issue Jan 2, 2024 · 2 comments
Open

feh should request Full Screen to the window manager #744

denilsonsa opened this issue Jan 2, 2024 · 2 comments

Comments

@denilsonsa
Copy link

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
Copy link
Author

denilsonsa commented Jan 2, 2024

Relevant VLC source-code: (probably)

Relevant Feh source-code: (probably)

  • feh/src/winwidget.c

    Lines 294 to 309 in 1d02f90

    if (ret->full_screen) {
    Atom prop_fs = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False);
    Atom prop_state = XInternAtom(disp, "_NET_WM_STATE", False);
    memset(&ev, 0, sizeof(ev));
    ev.xclient.type = ClientMessage;
    ev.xclient.message_type = prop_state;
    ev.xclient.display = disp;
    ev.xclient.window = ret->win;
    ev.xclient.format = 32;
    ev.xclient.data.l[0] = 1;
    ev.xclient.data.l[1] = prop_fs;
    XChangeProperty(disp, ret->win, prop_state, XA_ATOM, 32,
    PropModeReplace, (unsigned char *) &prop_fs, 1);
    }
  • feh/src/winwidget.c

    Lines 344 to 353 in 1d02f90

    /* Size hints */
    if (ret->full_screen || opt.geom_flags) {
    XSizeHints xsz;
    xsz.flags = USPosition;
    xsz.x = x;
    xsz.y = y;
    XSetWMNormalHints(disp, ret->win, &xsz);
    XMoveWindow(disp, ret->win, x, y);
    }

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
Copy link
Author

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 added a commit to denilsonsa/dotfiles that referenced this issue Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant