Bug 1591487 - qmmp does not open it's window on the old position
Summary: qmmp does not open it's window on the old position
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: qmmp
Version: 29
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Karel Volný
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-14 21:00 UTC by customercare
Modified: 2018-09-30 17:52 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-09-30 17:52:41 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Desktop showing geometry, sizes and positions (341.06 KB, image/jpeg)
2018-06-15 08:45 UTC, customercare
no flags Details

Description customercare 2018-06-14 21:00:14 UTC
Description of problem:

Since F27 QMMP does not reopen it's window on the same position it got closed.

Worked in F26 with qmmp-1.1.7-1.fc26.x86_64


Version-Release number of selected component (if applicable):

1.1.10-1.fc27

Comment 1 Karel Volný 2018-06-15 08:31:02 UTC
the suspicious change seems to be this one:

$ diff qmmp-1.1.7/src/plugins/Ui/skinned/mainwindow.cpp qmmp-1.1.10/src/plugins/Ui/skinned/mainwindow.cpp
2c2
<  *   Copyright (C) 2006-2016 by Ilya Kotov                                 *
---
>  *   Copyright (C) 2006-2017 by Ilya Kotov                                 *
24a25
> #include <QDesktopWidget>
284c285,294
<         move(settings.value("mw_pos", QPoint(100, 100)).toPoint()); //geometry
---
>         QDesktopWidget *desktop = qApp->desktop();
>         QPoint pos = settings.value("mw_pos", QPoint(100, 100)).toPoint();
>         if(!desktop->availableGeometry().contains(pos))
>         {
>             QRect availableGeometry = desktop->availableGeometry();
>             int r = m_skin->ratio();
>             pos.setX(qBound(availableGeometry.left(), pos.x(), availableGeometry.right() - r*275));
>             pos.setY(qBound(availableGeometry.top(), pos.y(), availableGeometry.bottom() - r*116));
>         }
>         move(pos); //geometry


I've tried to comment out the new code to see if it makes difference

scratch build here: https://koji.fedoraproject.org/koji/taskinfo?taskID=27629785

please install and test the experimental package:
https://kojipkgs.fedoraproject.org//work/tasks/9789/27629789/qmmp-1.1.10-2.fc27.x86_64.rpm


also please specify which desktop/windowmanager do you use?

Comment 2 customercare 2018-06-15 08:45:47 UTC
Created attachment 1451829 [details]
Desktop showing geometry, sizes and positions

Comment 3 customercare 2018-06-15 08:50:15 UTC
it fixed it partly as you can see :)

the main window is now back to it's original position, but the others not. Same changes required i assume. 

All windows are below/above each other and adjected/sticked together.

Desktop is Cinnamon latest as of FC27. You can take the screensize and geometries from the picture, which illustrates the problem good. Maybe it even shows why the new routine fails miserable :)

Comment 4 customercare 2018-06-15 08:53:20 UTC
BTW: when your finished and found out what was the problem, PLEASE let the devs of LIFEREA and Thunderbird know about it. 

Their windows have the same positioning bug ( only them ) 

Liferea starts on the right display, Thunderbird on the left, where it should be vice versa :D

Comment 5 Karel Volný 2018-06-15 09:21:51 UTC
(In reply to customercare from comment #3)
> it fixed it partly as you can see :)
> 
> the main window is now back to it's original position, but the others not.
> Same changes required i assume. 

yep, silly me, the same in eqwidget.cpp and playlist.cpp

but I cannot see anything obviously wrong with the code, so let's call Muffin maintainer for help ...

Leigh, please, do you have any idea why the check

if(!desktop->availableGeometry().contains(pos))

could fail in the first place?

(I suspect the problem is not in qmmp/Qt if Thunderbird is also affected ...)

Comment 6 customercare 2018-06-15 10:19:30 UTC
it seems to be a  "major" implementation problem to solve the repositioning problem on two or more displays. (working fine for just one hehehe :) )

FireFox i.e. opens itself anywhere, where the mousepointer is. So moving the mouispointer to where you want firefox to open, solves their problem :)

unfortunatly, it doesn't work for liferea and thunderbird :(

Comment 7 leigh scott 2018-06-15 11:13:45 UTC
Does the issue reproduce with muffin-3.8, you will need to use my copr to test.

https://copr.fedorainfracloud.org/coprs/leigh123linux/cinnamon/


@miketwebster Is this a known issue as it doesn't appear to be reported against muffin.

https://github.com/linuxmint/muffin/issues

Comment 8 Michael Webster 2018-06-15 15:30:49 UTC
I have two monitors.  The app saves and restores its position correctly if it's closed while on the primary (regardless of whether my primary is left or right.)

If I position it on a secondary monitor, it restores itself in the vertical position (because my monitors are horizontally arranged) but is at the extreme edge of the primary.

>>> x = QApplication([])
qt5ct: using qt5ct plugin
>>> inotify_add_watch("/home/mtwebster/.config/qt5ct") failed: "No such file or directory"
x.desktop()
<PyQt5.QtWidgets.QDesktopWidget object at 0x7f59cd268f78>
>>> x.desktop().availableGeometry()
PyQt5.QtCore.QRect(1680, 27, 1920, 996)
>>> x.desktop().screenGeometry()
PyQt5.QtCore.QRect(1680, 0, 1920, 1080)
>>>

This is showing only my primary monitor as available (and screen) geometry.  I haven't dug into what Qt looks for to determine sizes.

This behavior can be reproduced in cinnamon, gnome-shell, and (just the wm) kwin.

The python results are reproduced likewise.  Comparing `xprop -root` results between muffin/mutter-managed and kwin-managed screens doesn't show much difference, at least with NET_WORKAREA, NET_DESKTOP_GEOMETRY.

If it were up to me, I'd just remove those checks in the various places they occur.  Why was it needed?  How many people will it help vs how many more people it will just 'work' on without those.  This area of the desktop can be really really messy and inconsistent, regardless of how its implemented.  Window managers (at least any I've looked at) already have sanity-checking for windows placed out-of-view.  99% of users would, I imagine, never be screwing with their setup or monitor layout, etc... so how often would this even be necessary?

I think this issue is unrelated to thunderbird - thunderbird/firefox do a lot of custom things (since they're multiplatform, and need to abstract a lot more of this stuff,) and while I don't doubt there may be some issue with them, they use Gtk.

Comment 9 Karel Volný 2018-06-15 15:50:30 UTC
(In reply to Michael Webster from comment #8)
...
> This is showing only my primary monitor as available (and screen) geometry. 
> I haven't dug into what Qt looks for to determine sizes.
> 
> This behavior can be reproduced in cinnamon, gnome-shell, and (just the wm)
> kwin.

so, it looks more like a Qt bug if I get it right?

> Why was it needed?
...
> 99% of users would, I imagine, never be screwing with their setup or monitor layout

it happens to me all the time that after undocking my laptop, things appear out of the display panel, so probably the original motivation was something like that ... however, I agree that's problem of the underlaying graphics system and not the application

Comment 10 Michael Webster 2018-06-15 18:15:18 UTC
Ah these are unmanaged/undecorated windows probably. So the wm wouldn’t attempt to correct their position.  I would call it a qt bug or maybe incomplete configuration, but I’m really not familiar with qt lore.  What if the monitor count was saved and this repositioning code was only run when the count differed from the previous session?  This would cover the laptop case at least?

Comment 11 customercare 2018-06-15 18:20:02 UTC
"What if the monitor count was saved and this repositioning code was only run when the count differed from the previous session?"

can be ruled out, i didn't change my displays for months now :)

Comment 12 Michael Webster 2018-06-15 18:27:02 UTC
I’m suggesting that as a way to fix the issue. Or at least work around the current one. Essentially this code would never run unless the previous run’s monitor count was not the same as the current one’s.

Comment 13 Michael Webster 2018-06-16 01:22:15 UTC
Nevermind...nothing's broken - in Qt a "screen" is a monitor apparently (I'm used to it being something very different in gtk).

Instead of checking desktop().availableGeometry(), this code should get the number of 'screens' (desktop.screenCount), iterate over the result and use the overloaded desktop.availableGeometry(monitor_num) to check the saved geometry against each screen's geometry in turn.

If I can get this to build I'd try to make a patch.

Comment 14 Karel Volný 2018-06-18 08:56:15 UTC
(In reply to Michael Webster from comment #13)
> If I can get this to build

is there any problem?

> I'd try to make a patch.

that'd be marvellous, as I don't understand those things and don't have the time (nor even energy) to study screens handling in Qt ...

Comment 15 Karel Volný 2018-07-26 14:01:27 UTC
while commenting out the new check might be a way to go, I'd rather see this fixed properly ...

reported upstream as https://sourceforge.net/p/qmmp-dev/tickets/971/

Comment 16 Jan Kurik 2018-08-14 11:12:05 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.


Note You need to log in before you can comment on or make changes to this bug.