Opened 20 months ago

Closed 18 months ago

Last modified 17 months ago

#5573 closed Bug (fixed)

Window goes to the wrong monitor when returning from fullscreen

Reported by: balagemayrag Owned by: underground78
Priority: high Milestone: 1.7.10
Component: General Version: 1.7.9
Severity: normal Keywords:
Cc: underground78 Evaluation: diagnosed

Description

Hi there,

I usually play movies using my external (secondary) FULL HD monitor, using MPC-HC. I start these using a custom shortcut configured in Total Commander, that class the following command:

mpc-hc.exe <media-file> /monitor 2 /fullscreen

I used to use version 1.7.6 but now I have switched to 1.7.9. I noticed that when I exit fullscreen mode MPC-HC window goes back to monitor 1, while it was started on monitor 2. When switching monitors the playback even stops for a second, at least the sound goes off. For me this makes my user-experience bad and very impractical. If I started the player on monitor 2, I would like it to stay there. If I start it without the /fullscreen switch it's ok.

The normal behavior should be that it stays on the monitor it was launched to with the /monitor option.

I found no setting in Options -> Playback -> Fullscreen about this.

I'm not sure which version introduced this issue, however I'm sure that in 1.7.6 it's not there but in 1.7.9. Could you please change it back to the old (normal and logical) behavior?

Change History (24)

comment:1 Changed 19 months ago by underground78

  • Milestone next release deleted

As far as I can tell I cannot reproduce this issue. Could you please try with the default settings just in case (reset the settings from the Miscellaneous option page)?

When switching monitors the playback even stops for a second, at least the sound goes off.

Do you have "Reinitialize when changing display" enabled? If you do, you can try without it.

comment:2 Changed 19 months ago by underground78

  • Cc underground78 added
  • Evaluation set to need info
  • Status changed from new to evaluated

comment:3 Changed 19 months ago by balagemayrag

No, I don't have "Reinitialize when changing display", however I have done a little testing.

Reproduction

Your tip on resetting all the settings helped me a lot in finding which option causes the problematic behavior. So, thanks. You must have either "Remember last window position" (RememberWindowPos) or "Remember last window size" (RememberWindowSize) enabled. Where it gets really problematic is when only RememberWindowSize is enabled, because window size should not - under any circumstances - be bound to a distinct screen. With this option I just want the window size to stay the same regardless of which screen it is on.

My everyday use-case

I use MPC-HC for two purposes. One is to play music and audio clips. For this I need a window that is wide enough to make seeking convenient. Another purpose is to watch movies which I do on my external screen. Of course I could do this with two portable installations of MPC-HC having different configurations. I tried this but I've given it up after noticing that one instance of MPC-HC clears all the file associations of the other and vice versa as I wanted to set one installation for audio-only formats and the other for videos (this might be another bug or feature request).

How I'd expect it to work

Neither RememberWindowPos, nor RememberWindowSize should be bound to monitors, both should be RELATIVE to the dimensions of the screen MPC has been launched on (which is controlled by /adapter).

Last edited 19 months ago by balagemayrag (previous) (diff)

comment:4 Changed 19 months ago by underground78

I don't get it. RememberWindowPos is by definition the position of the window on the whole display and RememberWindowSize is by definition independent of the position.

I'm not sure what you want exactly. Is the problem just that /monitor does not override the saved position when /fullscreen is set?

comment:5 Changed 19 months ago by balagemayrag

Well, the basic problem is that RememberWindowSize is by definition independent of the position, but it is not in practice. I can't explain better, so I created a demonstration video.

http://www.youtube.com/watch?v=4kBcVFdAX0M

  • At 0:25 and 1:04 I press "F" (toggle full screen, same as Alt+Enter by default).
  • At 0:37 I turn RememberWindowSize off.

comment:6 Changed 19 months ago by underground78

  • Evaluation changed from need info to diagnosed

I can reproduce now and I have found some weird code. Could you try this test build and report back?

comment:7 Changed 19 months ago by balagemayrag

Tested it and works fine now. If only RememberWindowSize is enabled, the window stays on the same screen MPC-HC was launched on.

.. however if I turn RememberWindowPos on, it literally disables the /monitor switch if the last position was on another window. Is that okay?

comment:8 Changed 19 months ago by underground78

however if I turn RememberWindowPos on, it literally disables the /monitor switch if the last position was on another window. Is that okay?

Do you mean when returning from fullscreen? If it was when going fullscreen, I would be sure that it is not okay, if it's when returning from fullscreen I'm not really sure. I guess it could reset the saved position to the center of the chosen monitor but I don't know if it's the best solution.

comment:9 Changed 19 months ago by balagemayrag

Yes, I mean returning from fullscreen.

I think it would be better if position was dependent on the area of each screen (1st, 2nd, 3rd, etc. monitor) and not the whole (virtual) display. This would mean the remembered last position would be relative to the screen MPC-HC is at. Then an option like RememberWindowMonitor could be added that would make MPC-HC launch on the screen it was launched last time. If RememberWindowMonitor is turned off and the /monitor switch wasn't added to the command line, it should launch on the primary monitor.

comment:10 Changed 19 months ago by underground78

I don't think the last position should be independent from the monitor, it wouldn't really make sense. Either we consider that /monitor used with /fullscreen is only relevant to the fullscreen window and in this case the current behavior makes sense, or we consider that it must reset the window position completely if the last saved position is not on the chosen monitor.

comment:11 Changed 18 months ago by balagemayrag

Okay, whatever. :) If size is independent from the monitor, it's okay with me, so if it works like in your test build, I think it's OK.

Last edited 18 months ago by balagemayrag (previous) (diff)

comment:12 Changed 18 months ago by underground78

Here is a new test build. Could you try if its behavior makes sense for you? Normally /monitor will reset the saved position if it was not on the chosen monitor.

comment:13 Changed 18 months ago by balagemayrag

Well, thanks for the build. My answer to your question is that it doesn't really make sense. If RememberWindowPosition is on, the /monitor switch seems to be ignored regarding its original role. Although it does reset the window position when /monitor is used, the window won't go to the preferred monitor, so then why reset its position anyways? I think something happens in the wrong order, e.g. resetting the position happens after the placement (creation) of the window (onto the preferred monitor), while it should happen earlier.

See my demonstration: http://www.youtube.com/watch?v=ZK3dlAJZI0E

Commands used:

mpc-hc.exe <videofile> /monitor 2
--- RememberWindowPosition was turned on here. ---
mpc-hc.exe <videofile> /monitor 1

So with /monitor 1 specified, I think it should open up on the bottom display (notebook) for the /monitor switch overrides the stored position.

comment:14 Changed 18 months ago by underground78

Hmm I thought the problem was just when using /fullscreen. Could you try if that part is working?

comment:15 Changed 18 months ago by balagemayrag

It doesn't work as it should either. Does the same. /monitor is ignored when RememberWindowPosition is turned on. So when the saved position is on monitor 2 it will go fullscreen onto monitor 2 at next launch even if I specify /monitor 1.

Last edited 18 months ago by balagemayrag (previous) (diff)

comment:16 Changed 18 months ago by underground78

I think I have found and fixed the other issue: new test build. Please try if everything is fixed this time (including the window returning to the wrong monitor).

comment:17 Changed 18 months ago by Underground78 <underground78@…

  • Owner set to Underground78 <underground78@…>
  • Resolution set to fixed
  • Status changed from evaluated to closed

In a079b2:

Fix: The window could return to the wrong monitor after fullscreen.

When MPC-HC was started fullscreen on a specific monitor, for example using the command line /monitor N /fullscreen, it could return to the wrong monitor if "remember window size" was enabled and "remember window position" was disabled.

Fixes #5573.

comment:18 Changed 18 months ago by underground78

In 04e5a1:

Fix: /monitor was ignored when "remember window position" was enabled.

Ref: #5573.

comment:19 Changed 18 months ago by underground78

  • Milestone set to next release
  • Owner changed from Underground78 <underground78@… to underground78

Will be in the nightly builds as of revision 1.7.9.180.

comment:20 Changed 18 months ago by balagemayrag

I can confirm that it works fine with RememberWindowPos disabled and RememberWindowSize enabled. However, when RememberWindowPos is enabled, the window returns to the monitor the position was saved on at previous start, so the position still won't be reset when /monitor is specified. The /monitor has effect only when /fullscreen option is added. Is this the behavior you wanted to change to after fixing the RememberWindowSize issue?

comment:21 Changed 18 months ago by underground78

No it wasn't and I'm not completely sure to understand what exactly is still misbehaving. Are you saying that if you enable "remember window size" and previously the window was on monitor 2, it will still go on monitor 2 even if you use /monitor 1?

comment:22 Changed 18 months ago by balagemayrag

No, it doesn't. The behavior is the same what you can see on my very first demonstration video if RememberWindowPos is enabled. RememberWindowSize won't cause MPC-HC to return to the wrong monitor anymore. That part is fixed. However, the position reset - triggered by the /monitor switch - you tried to achieve doesn't work but I repeat, it doesn't have anything to do with RememberWindowSize at all, only RememberWindowPos. Whether that is good or bad is a matter of definition, the bug about remembering window size is already fixed. Thanks for that, a lot. :)

comment:23 Changed 18 months ago by underground78

Sorry, I meant:

Are you saying that if you enable "remember window position" and previously the window was on monitor 2, it will still go on monitor 2 even if you use /monitor 1?


Edit: As far as I can tell, it works fine here. What are you testing exactly?

Last edited 18 months ago by underground78 (previous) (diff)

comment:24 Changed 17 months ago by thevbm

  • Milestone changed from next release to 1.7.10

Milestone renamed

Note: See TracTickets for help on using tickets.