mpv icon indicating copy to clipboard operation
mpv copied to clipboard

Cannot cycle fullscreen and modify geometry properties in the same function in a Lua script

Open JorgeR81 opened this issue 1 month ago • 2 comments

mpv Information

mpv v0.40.0 Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
 built on Sep  5 2025 15:11:06
libplacebo version: v7.354.0 (v7.351.0-67-g515da95-dirty)
FFmpeg version: n7.1.1-57-g1b48158a2
FFmpeg library versions:
   libavcodec      61.19.101
   libavdevice     61.3.100
   libavfilter     10.4.100
   libavformat     61.7.100
   libavutil       59.39.100
   libswresample   5.3.100
   libswscale      8.3.100

Other Information

- Windows version: Windows 10, version 22H2 (OS Build 19045.6466)
- GPU model, driver and version: Nvidia GTX 1070 - Driver version 560.95
- Source of mpv: https://www.videohelp.com/software/mpv-media-player
- Latest known working version: 
- Issue started after the following happened: It never worked for me.

Reproduction Steps

I used a script only with the test function provided in the original issue:  https://github.com/mpv-player/mpv/issues/14005#issuecomment-3565020006 I removed all other scripts from my "scripts" folder.

Changing the order of the commands, in the function, does not change the behaviour. It also does no work with "cycle" fullscreen.

There are no error messages in the console.

Test function:

function do_stuff()
    mp.commandv("set", "fullscreen", "no")
    mp.commandv("set", "geometry", "500x500")
end

mp.add_key_binding("v", "do-stuff", do_stuff)

Expected Behavior

  • Leave Fullcreen
  • Change window geometry to 500x500

Actual Behavior

mpv 0.40.0 ( stable - portable )

  • It does not leave Fullscreen
  • But the underlying geometry is changed, because if I leave fullscreen afterwards ( with the regular key ), I can see the geometry changed to 500 x 500

This also happens using the PIP button in the mpv-osc-tethys script as I mentioned in the original issue.


mpv 0.32.0 ( stable - portable )

I also tried in my older version ( from the same source ), before the fix from the original issue.

It also does not work, but the behavior it's different:

  • It does not leave Fullscreen.
  • But it does not change the geometry

Log File

logfile.txt

You'll notice that my portable mpv 0.40.0 is in a folder named "mpv-0.32.0-x86_64"

But that's not related to this issue.

I put the new portable install in the old folder, so that Windows can open videos with the new mpv version ( on double click ), without having to mess with the Windows Registry.

( If I knew this back then, I would have chosen a different name for this folder, before adding mpv to the "open with" list ... )

Sample Files

No response

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

  • [x] I tested with the latest mpv version to validate that the issue is not already fixed.
  • [x] I provided all required information including system and mpv version.
  • [x] I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of --log-file=output.txt.
  • [x] I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
  • [x] I attached the full, untruncated log file.
  • [x] I attached the backtrace in the case of a crash.

JorgeR81 avatar Nov 22 '25 10:11 JorgeR81

I suspect other users also have this problem, but it was not reported. 

As I mentioned, in the original issue, this partialy breaks the PIP feature / button in the mpv-osc-tethys OSC.

I also checked the ModernZ  OSC and I has an "On Top" button, but it's not a "PIP" button. 

It does not try to change the geometry or fullscreen states ( as you can see in the function below ). https://github.com/Samillion/ModernZ/blob/main/modernz.lua#L2591

But, if you already have an "On Top" button, why not make it a ( much more useful ) "PIP" button ? I think the developer is aware of other users with this issue and decided not to add a PIP feature. 

JorgeR81 avatar Nov 22 '25 11:11 JorgeR81

I just realized that if I enter Fullscreen, via the maximize button, the PIP button will work ! What I mean is that, when I click the PIP button, it will leave "fullscreen" and change the window geometry.

But in this case, mpv was not really in "fullscreen".

The native OSC and thetys OSC use the same code for the maximize button. To maximize, this button uses window-maximized instead of fullscreen. It only uses fullscreen to "minimize" ( to leave fullscreen ).

 ne.eventresponder["mbtn_left_up"] =
        function ()
            if state.fullscreen then
                mp.commandv("cycle", "fullscreen")
            else
                mp.commandv("cycle", "window-maximized")
            end
        end

https://github.com/mpv-player/mpv/blob/master/player/lua/osc.lua#L1201 https://github.com/Zren/mpv-osc-tethys/blob/master/osc_tethys.lua#L3171


I'm mentioning this in case it helps to understand the issue.

This does not solve the issue, because the "maximize" and "fullscreen" buttons serve different purposes.

If you use the "maximize" button, you lose the previous window geometry.
So, if we manually change the size or position of the ( PIP ) window and then maximize, we can't get back to that previous state.

Also, some users have mpv set to open in fullscreen by default ( fs=yes in the mpv.conf file ), an in this case the PIP feature will not work correctly.

JorgeR81 avatar Nov 24 '25 16:11 JorgeR81