Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

fixes initial placement, move and size issues #498

Merged
merged 3 commits into from
Jan 13, 2015
Merged

Conversation

void cef_host_window::NotifyWindowMovedOrResized()
{
if (GetBrowser() && GetBrowser()->GetHost()) {
GetBrowser()->GetHost()->NotifyMoveOrResizeStarted();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calling this was something that needed to be added whenever the app is moved or resized

@JeffryBooher
Copy link
Contributor Author

@redmunds do you mind taking a look when you have time? Thanks!

@redmunds
Copy link
Contributor

Found a weird case:

  1. Open Brackets in secondary monitor
  2. Maximize Brackets, then shutdown
  3. Restart Brackets

Results:
Brackets is opened in primary monitor. Note that I did not disconnect or move secondary monitor.

Then, if I Restore Brackets window size it switches back to secondary monitor!

@redmunds redmunds self-assigned this Jan 10, 2015
@JeffryBooher
Copy link
Contributor Author

hmmmm...That is weird indeed. Not only that but it restores back to the secondary monitor which then maximizes back on the secondary monitor.

@redmunds
Copy link
Contributor

Verified that this case is now fixed.

I also notice that Brackets window is moved from secondary monitor if it's disconnected while Brackets is running! Sweet.

@redmunds
Copy link
Contributor

I noticed another case:

  1. Maximize Brackets on secondary monitor and close Brackets
  2. Disconnect secondary monitor and restart Brackets
  3. Brackets opens maximized in primary monitor as expected
  4. Now click Restore button

Results:
Brackets window becomes really small (390x200). Brackets is unusable as an editor, but you can still grab edges, make window bigger, and then everything works as expected.

Expected
Would be nice if Brackets remembered my previous Restore size (obviously it needs to be re-_position_ed). If that can't be remembered, then maybe default size (1000x700) can be used.

Not sure if this is worth fixing.

// to the default window placement
left = CW_USEDEFAULT;
top = CW_USEDEFAULT;
width = CW_USEDEFAULT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can original width and height be maintained? i.e. only set left and top to default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this has to work for both the maximized size / placement and the restored size / placement otherwise you run into that odd case so, IMO, it's better to just let the OS decide initial placement and then let the user move it wherever they want.

This eliminates incorrectly computing the placement or placing the window on a secondary monitor (in the case they have more than 2 monitors and disconnect one or rearrange monitors.)

@JeffryBooher
Copy link
Contributor Author

@redmunds regarding the issue you ran into with maximizing, disconnecting the monitor, restarting and clicking the restore button. In this case the Window is using CW_USEDEFAULT which lets Windows decide where to put the restored window. In some cases it's just using the minimum sizes which is 320x200. I could only reproduce this while running in the debugger so I rejiggered the logic so that we just don't set the restored window placement if it's off-screen which forces windows to just use CW_USEDEFAULT (which was passed in during initial window creation).

@redmunds
Copy link
Contributor

@JeffryBooher This looks good on WIndows.

Have you verified that this doesn't break Mac build? I upgraded my Mac to Yosemite and can't build Brackets at the moment.

@JeffryBooher
Copy link
Contributor Author

@redmunds this is only changing Windows project files -- it doesn't affect any cross platform code so I think we're safe on Mac.

@redmunds
Copy link
Contributor

Merging.

redmunds added a commit that referenced this pull request Jan 13, 2015
fixes initial placement, move and size issues
@redmunds redmunds merged commit d258997 into master Jan 13, 2015
@redmunds redmunds deleted the jeff/various-fixes branch January 13, 2015 20:02
redmunds added a commit that referenced this pull request Dec 8, 2015
fixes initial placement, move and size issues
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants