-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remember window size #41
Comments
I'm passing
On my system, Windows chooses to make it larger than I would like, though not full screen. I think there used to be a time when Windows would remember what you did automatically, but as of at least Win7 that is no longer the case. The window size is set before preferences are loaded, which means I can't simply save a preference and use it later. I think the correct approach is to use GetWindowPlacement and SetWindowPlacement. I actually use these in SourceGen, with a WindowPlacement class that makes native calls into Simply restoring the previous X/Y position and size is problematic on multi-monitor systems, since the external monitors frequently go away. Anything that is placed substantially off-screen needs to be relocated and perhaps resized, or you might not be able to see the window or grab its title bar. The window placement calls are expected to deal with that. |
I finally got around to digging into this a little more. MFC's CWinAppEx class, from which CiderPress inherits, has an So that might be part of why it no longer behaves the way it used to. The key moment for picking a size seems to be
I can trivially set a fixed size like this:
Not ideal, but seems more pleasant than the current behavior. The window's position is still determined by the OS, so it shouldn't end up off screen. Potentially slightly awkward for somebody running at 1024x768; I could try to limit the size based on the screen metrics of the primary or current monitor (with these calls), though I don't know if that's a real concern in this century. |
Windows is currently creating the main window at near-maximal size. It used to remember the size and placement, but no longer does. As a workaround, the initial size is set to 1150x800, which is large enough to show all columns without scrolling even with very wide pathnames. With some effort this could be modified to respect the maximum size of the monitor on which it will be displayed, so that anyone still running at 1024x768 won't be in a bad place. Ideally it would remember the previous size and position. See issue #41 for discussion.
Above workaround published in v4.0.5-d2. |
Ciderpress now opens full screen and then spreads half-way across my 2nd monitor. Reverting back to v4.0.5-d1, as that version works correctly. |
@Keatah Can you provide some additional details?
The change should force the window to be 1150x800, so unless you're running on a tiny system I'm at a bit of a loss. Anything that would help me reproduce your circumstances would be helpful. |
Yes, we're running at smaller resolutions. Some as small as 1024x768. Otherwise 1280x1024, 1600x1200. Not popular resolutions in today's world, I understand.. It seems ok at 1920x1200 or 1920x1080. I wouldn't worry about it too much. Is it possible to have CP remember the previous size and position? Win10 and sometimes WinXP. |
Version 4.0.5 was released without the fixed-size behavior (i.e. same as v4.0.5-d1). FWIW, this is the last version that will run on WinXP. Version 4.1.0-d1 saves and restores the main window placement: https://github.com/fadden/ciderpress/releases/tag/v4.1.0-d1 |
It's almost perfect now. If I try and align the window with the top-left of my screen however it tends to reset to default size. I think I must be moving the window to -1 xpos or -1 ypos, but visually it looks like the window is completely on screen rather than offscreen. This triggers the "offscreen" code path and resets it. It would be better if it just moved x pos, y pos to 0,0 and kept width and height intact in this scenario. But it's still a major improvement on the old version. |
Whoops, that's my fault. It's punting if any of the values are < 0. Easy to fix. |
It's okay to have the window off the top/left edge of the primary display, but CiderPress was rejecting the values and reverting to default placement. (for issue #41)
This should work better: https://github.com/fadden/ciderpress/releases/tag/v4.1.0-d2 |
Works great! |
Every time I launch Ciderpress it creates a window that is 3820 pixels wide on my monitor. So the first thing I have to do is reduce the width of the window. It would be nice if it remembered the window size.
The text was updated successfully, but these errors were encountered: