mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
26.71k stars 2.84k forks source link

mpv 0.37+ always exits initial fullscreen onto monitor 0 when started with `fs=yes`, even when moved to another monitor #14226

Closed awused closed 1 month ago

awused commented 1 month ago

mpv Information

mpv 0.37.0 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
libplacebo version: v6.338.2
FFmpeg version: 6.1.1
FFmpeg library versions:
   libavutil       58.29.100
   libavcodec      60.31.102
   libavformat     60.16.100
   libswscale      7.5.100
   libavfilter     9.12.100
   libswresample   4.12.100

mpv v0.38.0-344-g2fa66b850d Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on May 24 2024 14:41:05
libplacebo version: v6.338.2
FFmpeg version: 6.1.1
FFmpeg library versions:
   libavutil       58.29.100
   libavcodec      60.31.102
   libavformat     60.16.100
   libswscale      7.5.100
   libavfilter     9.12.100
   libswresample   4.12.100

Other Information

Reproduction Steps

relevant i3 config (not necessary, can move mpv manually instead):

set $wsmpv "mpv"
for_window [class="mpv"] floating enable move window to workspace $wsmpv focus
workspace $wsmpv output "DP-0"

Expected Behavior

When I exit fullscreen mpv should remain on the current monitor as it did before 0.37.

Actual Behavior

When I exit fullscreen mpv jumps to monitor 0, regardless of what monitor it was actually rendering on.

Exiting fullscreen later, on non-initial fullscreens, does work as expected (start fullscreen -> move to another monitor -> exit fullscreen and mpv behaves as expected, remaining on the monitor it was moved to).

Log File

output.txt (from 0.37)

[vo/gpu/x11] Display 0 (HDMI-0): [3200, 0, 5760, 1440] @ 119.997589 FPS
[vo/gpu/x11] Display 1 (DP-0): [2560, 1440, 6400, 3600] @ 119.998907 FPS
[vo/gpu/x11] Display 2 (DP-2): [6400, 2160, 8960, 3600] @ 119.997589 FPS
[vo/gpu/x11] Display 3 (DP-4): [0, 2160, 2560, 3600] @ 119.997589 FPS

I was watching the video on DP-0, where it was initially opened, and then closed fullscreen through mpv (pushed F) and it jumped to HDMI-0.

Sample Files

No response

I carefully read all instruction and confirm that I did the following:

awused commented 1 month ago

Bisected to 200992f90c49fdc2d5605cf79ffaa5247fd62e3e

I should add that setting --fs-screen will override this, but the same problem exists - --fs-screen=2 means it'll always jump to screen 2 on exiting, even if it wasn't on screen 2.

Dudemanguy commented 1 month ago

I can reproduce this behavior with the i3 config you supplied but not if I simply move the fullscreen window somewhere else and then exit fullscreen. Also it happens to me with 0.36.0 so I'm not even sure we're seeing the same thing.

setting --fs-screen

This option and --screen has never worked for me on i3.

awused commented 1 month ago

Are you only counting the initial fullscreen on mpv startup? Any subsequent fullscreens are not affected.

Setting fs-screen just changes where the mpv window goes after the initial fullscreen exits, and doesn't actually override which monitor i3 places the initial fullscreen on, nor what happens after any subsequent fullscreens. I bisected the issue to a specific commit added after 0.36, and cannot reproduce the issue with 0.36, so whatever you're seeing with 0.36 is a separate issue.

Dudemanguy commented 1 month ago

Are you only counting the initial fullscreen on mpv startup?

Yes of course.

Setting fs-screen just changes where the mpv window goes after the initial fullscreen exits

It doesn't do that for me. It just does nothing.

Dudemanguy commented 1 month ago

I found that I get can similar behavior but only if I force i3 to use floating windows for mpv. To be clear, this is what happens for me:

And in my case, it always seems to exit fullscreen to whatever screen 0 is (primary or not doesn't appear to matter). If I don't float mpv, then it exits fullscreen and stays in the same screen as the window. This behavior is the same before 200992f90c49fdc2d5605cf79ffaa5247fd62e3e so again, not really sure we're seeing the same thing.

But anyways, does anything change for you if you simply comment out this line?

diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index ec74a50f56..dfaac6153e 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -1667,7 +1667,7 @@ static void vo_x11_map_window(struct vo *vo, struct mp_rect rc)
         x11->fs = 1;
         // The "saved" positions are bogus, so reset them when leaving FS again.
         x11->size_changed_during_fs = true;
-        x11->pos_changed_during_fs = true;
+//        x11->pos_changed_during_fs = true;
     }

     if (x11->opts->fsscreen_id != -1) {
awused commented 1 month ago

Yeah, commenting out that one line seems to fix it. Though I'm actually moving the workspace to another output with mpv in it instead of moving mpv, maybe that's the difference in what you're seeing (bindsym Mod1+Shift+Left move workspace to output left).

Dudemanguy commented 1 month ago

I think just deleting that line is OK. But I'll try to do some more testing.

awused commented 3 weeks ago

I tested out git head, it's better but the mpv window isn't centered on the monitor after exiting fullscreen. Though this is also a problem even with 0.37 and --fs-screen, so it's not a new regression with #14228.

Never mind the centering was force-window=immediate that I added at some point trying to debug this issue. This issue is fixed for me at git head.