Bug 409675 - Main window does not remember its position.
Summary: Main window does not remember its position.
Status: RESOLVED DUPLICATE of bug 415150
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: 19.04.2
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-10 10:24 UTC by Michal Mutl
Modified: 2020-02-28 03:54 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Mutl 2019-07-10 10:24:28 UTC
SUMMARY
Main window does not remember its position. 

STEPS TO REPRODUCE
1. Change windows size and position
2. Close app
3. Run app 

OBSERVED RESULT

Size is restored but window position not. It seems that top-left corner is set to the same position regardless of position set by user.

EXPECTED RESULT

Window position should be restored to last set.

SOFTWARE/OS VERSIONS
Windows: 10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Christoph Cullmann 2019-07-13 22:29:20 UTC
*** Bug 326064 has been marked as a duplicate of this bug. ***
Comment 2 Christoph Cullmann 2019-07-13 22:30:46 UTC
Sizes are restored, windows positions not, I can confirm that even on Linux ;=)
Comment 3 Christoph Cullmann 2019-07-14 18:42:31 UTC
But this is not critical, actually it is like this since years.
I am not even sure we want to try to restore the position, as this will mess around with what the window manager or Windows itself does.
Comment 4 Michal Mutl 2019-07-15 05:49:37 UTC
It is critical, because if i change windows size and then position window to be centered with new size, after new Kate start its window is positioned with new size half-outside of the screen. 
Startup window size is too small so that resizing is needed to make working reasonable. But user must reposition window all the time Kate is started. Very annoying and non user friendly.
Comment 5 Michal Mutl 2019-07-15 05:52:38 UTC
Also I don't understand what is problem to remember window position in cfg file or registry. It has nothing to do with Windows window manager. Any windows application which needs to remember its window position does so. The you do with size, so explain me why Windows window manager can be messed with position restoring?
Comment 6 Christoph Cullmann 2019-07-15 06:00:43 UTC
If you e.g. change your resolution between saving/restoring Kate, you might have issues. The current window size restore has some checks for that, to not create window that span outside of your screen sizes.
I assume the same will be needed for the position.

In any case: If somebody wants to work on it and provides some patch, I would have no issues to accept it, if it handles screen geometry changes like the size restoring stuff well.
Comment 7 Michal Mutl 2019-07-15 06:21:53 UTC
Windows size and position must be saved, of course, for any used resolution and number of monitors, but it is nothing impossible.
Let us consider e.g. ini file to store this configuration.
Kate starts for the first time, user changes size and position and Kate saves such record

[MainWindow]
Size(1366x1080x96)=500,1000
Pos(1366x1080x96)=10,10

Then user changes resolution to e.g. 1920x1080x120 (or connect another monitor,changes only dpi etc). If Kate is running, no problem, user will probably change size and position to reflect new screen size and dpi. Kate simply saves new values and ini file now looks like this

[MainWindow]
Size(1366x768x96)=500,600
Pos(1366x768x96)=10,10
Size(1920x1080x120)=1000,800
Pos(1920x1080x120)=20,20

If user dos not change position manually, Kate either catches WMDPICHANGED and WMDISPLAYCHANGE messages and saves its size and pos itself or saves these values on its exit.

if Kate is started then it detects desktop size and dpi and looks for appropriate record in ini file and restores its size and position. If record is not found then Kate starts with default size and pos.

What do you think?
Comment 8 Christoph Cullmann 2019-07-15 06:36:25 UTC
To store the stuff indexed with screen geometry would make sense, yes.
If you can provide a patch, this would be welcome.
You can search for KWindowConfig::saveWindowSize and KWindowConfig::saveWindowSize to see where this would need to be done in the code.
Comment 9 Michal Mutl 2019-07-15 06:41:50 UTC
I'm afraid I have no experience with programming/building apps under Linux so I must frankly say I don't dare to make any changes in Kate's sources :(
Comment 10 Christoph Cullmann 2019-07-15 06:45:35 UTC
:=) You could try to do the change on Windows, but I must confess that takes some time to either setup all things manually or use e.g. craft.

https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source/Windows

Thought we really would welcome some "real" Windows developer to get Kate running well on that OS.
Comment 11 Michal Mutl 2019-07-15 06:55:41 UTC
I found Kate very promising editor (being disgusted with native windows editors on the market) so I would like to help you but C is not my native language, i'm experienced  Delphi developer, I can read C but code writing is another challenge. I don't know Kate architecture and also have no experience with multi-platform coding yet (Windows native apps take my all time :))
So it would be long-term run to make me capable of writing confident code for Kate. I can advise or point you to solutions but but direct coding is, i'm afraid, out of my scope and capabilities now.
Comment 12 Christoph Cullmann 2019-07-15 07:03:42 UTC
;=) I you dare to try to setup some dev environment, we could try how far you get with some small patches.
Comment 13 Michal Mutl 2019-07-15 07:08:14 UTC
Well, get me some time :), I will notify you when i'm ready. Here?
Comment 14 Christoph Cullmann 2019-07-15 07:43:28 UTC
Sure, or ping us on kwrite-devel@kde.org, if nobody reacts ;=)
Comment 15 Michal Mutl 2019-07-15 07:50:42 UTC
Well, Craft installed, Kate sources repository cloned. i'm using Visual Studio 2019 CE. How to make vs solution to set Kate project correctly?
Comment 16 Christoph Cullmann 2019-07-15 08:36:24 UTC
If you compiled the stuff with Craft, would VisualStudio be able to import the CMake project?
Comment 17 Christoph Cullmann 2019-07-15 08:42:09 UTC
;=) CCing the Craft maintainer.

Before I explain complete trash here.
Is there any prefered way how to work with Craft + VisualStudio?
Comment 18 Michal Mutl 2019-07-15 08:46:16 UTC
I tried to open CMakeLists.txt, compilation started but this error appeared:

CMake Error at C:\Repository\Kate\CMakeLists.txt:17 (find_package):
  Could not find a package configuration file provided by "ECM" (requested
  version 5.40.0) with any of the following names:

    ECMConfig.cmake
    ecm-config.cmake

  Add the installation prefix of "ECM" to CMAKE_PREFIX_PATH or set "ECM_DIR"
  to a directory containing one of the above files.  If "ECM" provides a
  separate development package or SDK, be sure it has been installed.	

C:\Repository\Kate\CMakeLists.txt line 17
Comment 19 Christoph Cullmann 2019-07-15 11:34:30 UTC
That means the ECM stuff is missing or the configuration wasn't taken properly.
Did you compile the stuff with craft before that?
Comment 20 Michal Mutl 2019-07-15 12:33:54 UTC
I called "craft kate" from craftenv and it succeeded after 30mins and took 4 GB. when I called "craft --compile kate" it failed because it did not find kate repository. where can I set it?
Comment 21 Christoph Cullmann 2019-07-15 13:21:15 UTC
Adding more Windows man power to the bug ;=)
Comment 22 Nate Graham 2019-10-16 22:32:43 UTC
I think it should do this on Linux too. :)
Comment 23 Nate Graham 2020-02-28 03:54:17 UTC
Found out that KXMLGui is supposed to be doing this.

*** This bug has been marked as a duplicate of bug 415150 ***