poedit icon indicating copy to clipboard operation
poedit copied to clipboard

Remember window position

Open rillig opened this issue 5 years ago • 2 comments

It would be nice if Poedit remembered the window sizes and restored them the next time it is run.

This applies to:

  • the main window
  • the search dialog
  • the View > References window

rillig avatar Apr 12 '19 19:04 rillig

It does, since approximately forever.

If you have reason to believe otherwise (and knowing you, you wouldn't file this issue otherwise), please describe steps to reproduce, including versions of everything, OS DPI settings, any unusual window manager stuff (taskbar settings, multi-monitor setups, remote desktop etc.). TIA!

vslavik avatar Apr 13 '19 10:04 vslavik

  • Microsoft Windows [Version 10.0.17134.706]
  • I have no idea about the DPI settings. I hope they are irrelevant for this issue.
  • I have a two-screen setup, both are 1920×1080.
  • The screen coordinates go from (-1920,0) to (+1919,1079).
  • No remote desktop, nothing else that might be considered unusual.

When I open Poedit in the middle of the main screen and close it again, the Windows Registry contains:

[HKEY_CURRENT_USER\Software\Vaclav Slavik\Poedit\windows\mainwin]
"x"=dword:000001f5
"y"=dword:00000071
"w"=dword:000003be
"h"=dword:000002d9
"maximized"=dword:00000000

(What's funny is that this export contains the keys in insertion order while regedit.exe always shows them in alphabetical order. Insertion order makes much more sense in this case. :))

When I open Poedit again and immediately close it, almost all of these values stay the same. Only y is incremented by 2. This happens each time I open and close Poedit. I'm using a very fresh Windows 10 installation, and I have made no changes to the theme or window styling.

When I open Poedit again, maximize the main window and then close it, the Registry contains maximized=1. y stays the same as before, as expected.

Next experiment. I opened Poedit and took a screenshot of the main window using Alt+PrtScr. The captured image is 960×718 pixels, while the Registry says 958×613. Here's the screenshot, for your reference:

image

Based on this measurement I'm assuming that you are measuring the client area of the window, starting from below the 1px gray line below the toolbar, up to and including the 1px gray line above the status bar at the bottom. This doesn't explain why the height of the window changes by 2px though.

Back to the original issue.

When I maximize the window and then press Win+Right, it occupies only the right half of the screen. When I close it now, the values in the Registry become:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Vaclav Slavik\Poedit\windows\mainwin]
"x"=dword:000003b9
"y"=dword:00000000
"w"=dword:000003be
"h"=dword:000003a7
"maximized"=dword:00000000
  • x is half the screen minus 7px. I would have expected half the screen + 1px (for the non-client area) instead.
  • y is 0. I would have expected 85 instead, since that's the height of the non-client area at the top of the window.
  • w is as expected.
  • h is as expected, based on my assumptions from the screenshot above.

My hypothesis is now that Poedit calculates the screen components of the total window area, and since y now becomes negative (or better: less than the minimum y coordinate from any of the available screens), the coordinates are adjusted.

  • The client width is the same as in the Registry.
  • The window is horizontally centered on the main screen, which makes x = (1920 - 958 - 2) / 2.
  • y = 0, which makes sense because if y were negative, the window would be partly off-screen.
  • h = 928, which is 7 less than in the Registry. The last hex digit in the Registry is 7. Coincidence?

image

rillig avatar Apr 13 '19 19:04 rillig