Bug 411005 - Windows appear on a secondary monitor with wrong size
Summary: Windows appear on a secondary monitor with wrong size
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.16.4
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Vlad Zahorodnii
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-17 10:13 UTC by Ivar Erikson
Modified: 2019-09-09 10:53 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Kate, opened and positioned (3.50 MB, image/png)
2019-08-17 10:13 UTC, Ivar Erikson
Details
Kate, closed and reopened (573.58 KB, image/jpeg)
2019-08-17 10:15 UTC, Ivar Erikson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivar Erikson 2019-08-17 10:13:49 UTC
Created attachment 122195 [details]
Kate, opened and positioned

SUMMARY

When using multiple monitors, windows keeps resetting their size and position each time they're closed and reopened.

E.g. Kate. On a one monitor setup, I don't need to specify any special window or application settings for it to remembet size/position.
When I plug in a second monitor, it keeps resetting. Even if I set a size, then use "Special Window Settings > Size & Position > Remember" it still seems to 'forget' these settings when closed. 
In my case with Kate, it goes from my setting covering 1/3 or 1/2 my 3440x1440 screen, to a size of approx 15 cm in the lower left-hand corner. This happens each time I close and re-open it.

With LibreOffice I have an issue where dialogue windows, e.g. Format Options (ctrl+1) openes on the other monitor. Many other apps also opens on the 'other' monitor from where they were last used and where their other windows are located.


STEPS TO REPRODUCE, example "Kate"

1. Plug in secondary monitor.
2. Open app, e.g. Kate. 
3. Resize and position
4. Close Kate.
5. Open Kate.


OBSERVED RESULT

App [e.g. Kate] opens in 'wrong' size, in a 'wrong' place.


EXPECTED RESULT

Apps should open in the size and in the location/monitor they were closed (unless ofc there are special Forced location/size settings).



STEPS TO REPRODUCE, example "LibreOffice"

1. Plug in secondary monitor.
2. Open LibreOffice.
3. Select cell. Open Format dialogue (ctrl+1)


OBSERVED RESULT

Dialogue window opens on the other monitor.


EXPECTED RESULT

Apps, and their dialogue windows, should open on the monitor on which their parents are, and in the location they were put last time used (unless ofc there are special Forced location/size settings).

----------

SOFTWARE/OS VERSIONS

Operating System: Kubuntu 19.04
KDE Plasma Version: 5.16.4
KDE Frameworks Version: 5.60.0
Qt Version: 5.12.2
Kernel Version: 5.0.0-25-generic
OS Type: 64-bit
Processors: 4 × Intel® Core™ i5-6600K CPU @ 3.50GHz
Memory: 31,4 GiB of RAM

----------

ADDITIONAL INFORMATION

There does seem to be some inconsistency to the behaviour. Dolphin seems to, mostly, open where it's supposed to. Firefox sometimes goes to the wrong monitor, but sometimes not... Mostly it seems that apps want to open on the secondary monitor instead of the main monitor. Possibly have apps open on the monitor from which they were started (e.g. via a taskbar setting)?

I have this happening with my two different dual-monitor setups:

1: [PC monitor, 3440x1440, horizontal][4K TV]
2: [PC monitor, 1200x1920, vertical][PC monitor, 3440x1440, horizontal]

I was unsure if I should make these two examples separate reports, but to me they seem to relate to the same issue, and I don't want to fill the bug tracker unnecessarily. If they should be separate, do tell, and I'll make it so:)
Comment 1 Ivar Erikson 2019-08-17 10:15:20 UTC
Created attachment 122196 [details]
Kate, closed and reopened
Comment 2 Ivar Erikson 2019-08-17 10:17:39 UTC
Ironically, despite my comment of Dolphin staying where it's supposed to, when I popped in the secondary monitor to take the screenshots Dolphin emigrated to the new monitor.
Comment 3 Vlad Zahorodnii 2019-08-24 22:22:58 UTC
Do you actually have multihead configuration, meaning that there are couple X servers running per each screen individually?
Comment 4 Ivar Erikson 2019-08-25 12:44:28 UTC
Not to my knowledge. I.e. I haven't set that up myself, manually. I've just hooked the monitors up to my graphics card and adjusted the layout in Displays settings.
Comment 5 Vlad Zahorodnii 2019-08-25 13:02:27 UTC
It can be that the problematic clients request "wrong" geometry.

Does the issue occur when you force "Ignore requested geometry" wndow rule?
Comment 6 Ivar Erikson 2019-09-09 06:54:09 UTC
Very sorry for the tardy response. I've been traveling for work, and haven't been able to test or respond.
_____

So, I tried with Kate, which is the most consistent offender:

I set `Window Specific Settings > Ignore requested geometry > Force > Yes`
but it did not change the behavior of Kate when opening with a secondary monitor plugged in;

I tried to use Remember istead of Force;
 
I tried to set the same options in *Application* Specific Settings;

I also tried to use Obey geometric restrictions > Force / Remeber > No / Yes, in both Window and Application Specific Settings, to no avail.
Comment 7 Vlad Zahorodnii 2019-09-09 07:21:55 UTC
Please post output of
    qdbus org.kde.KWin /KWin supportInformation
Comment 8 Ivar Erikson 2019-09-09 07:33:21 UTC
Follow the link for the output of
qdbus org.kde.KWin /KWin supportInformation

https://invent.kde.org/snippets/439

I can upload it here as a .txt if preferable.
Comment 9 Ivar Erikson 2019-09-09 07:34:19 UTC
A comment regarding geometry (I think): It does seem that at least Dolphin resets its size to correspond to the secondary monitor's geometry(?) in the following way:

Secondary monitor is vertical: 1200x1920 (i.e. a 1920x1200 in portrait mode)
Dolphin's width resets to fit the 1200 px width of the secondary monitor, even though it opens on the primary 3440x1440 monitor.

Using Window Settings > Size/Position > Remember does seem to fix this. Ignore requested gemoetry > Force > Yes does not.
Comment 10 Vlad Zahorodnii 2019-09-09 07:44:37 UTC
Please post your ~/.config/kwinrulesrc.
Comment 11 Vlad Zahorodnii 2019-09-09 07:45:45 UTC
KWin doesn't remember the last size of each clients. It's responsibility of applications. (Unless you create a geometry window rule)
Comment 12 Vlad Zahorodnii 2019-09-09 07:47:28 UTC
About positioning clients on a multi-screen setup... Please create another bug report. It's very difficult to track several bugs in one bug report.
Comment 13 Ivar Erikson 2019-09-09 07:50:55 UTC
Alright, will do.
Comment 14 Ivar Erikson 2019-09-09 07:50:58 UTC
kwinrulesrc:

https://invent.kde.org/snippets/440
Comment 15 Vlad Zahorodnii 2019-09-09 08:01:23 UTC
Alright, I can reproduce the first bug.
Comment 16 Vlad Zahorodnii 2019-09-09 08:07:53 UTC
A shot in the dark: something goes wrong in checkWorkspacePosition method.
Comment 17 Vlad Zahorodnii 2019-09-09 08:42:20 UTC
Kate sends a ConfigureRequest event and KWin honors it. This is not a bug!

Force "Ignore requested geometry" window rule in order to make kwin not honor ConfigureRequest events.
Comment 18 Vlad Zahorodnii 2019-09-09 08:43:22 UTC
(In reply to Ivar Erikson from comment #6)
> I also tried to use Obey geometric restrictions > Force / Remeber > No /
> Yes, in both Window and Application Specific Settings, to no avail.
No, you need to force "Ignore requested geometry" window rule.
Comment 19 Ivar Erikson 2019-09-09 08:47:57 UTC
(In reply to Vlad Zahorodnii from comment #18)
> (In reply to Ivar Erikson from comment #6)
> > I also tried to use Obey geometric restrictions > Force / Remeber > No /
> > Yes, in both Window and Application Specific Settings, to no avail.
> No, you need to force "Ignore requested geometry" window rule.

I did that first :) I just tried the Obey option too because I was curious if it would do anything.

"I set `Window Specific Settings > Ignore requested geometry > Force > Yes`
but it did not change the behavior of Kate when opening with a secondary monitor plugged in"
Comment 20 Vlad Zahorodnii 2019-09-09 08:51:58 UTC
(In reply to Ivar Erikson from comment #19)
> "I set `Window Specific Settings > Ignore requested geometry > Force > Yes`
> but it did not change the behavior of Kate when opening with a secondary
> monitor plugged in"
You also have to create a size rule. Otherwise, kate will reset its size.
Comment 21 Ivar Erikson 2019-09-09 09:11:50 UTC
Aha. I have applied the following Special Window Settings:

Position > Remember
Size > Remember
Ignore requested geometry > Force > Yes

So far, success, this makes Kate open in the size and position it had before closing.


So this ConfigureRequest even somehow dictates that e.g. Kate should open in a corner, in a tiny window, when there are multiple monitors on a system? (Mind you, I have noe idea what a "ConfigureRequest event" is.)
Comment 22 Christoph Feck 2019-09-09 10:53:49 UTC
Please do not change the bug status.