Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

samuelmaddock
Copy link
Member

@samuelmaddock samuelmaddock commented Oct 27, 2020

@electron/wg-api
@electron/wg-releases I'd like to target 10-x-y if possible.

Description of Change

Emits a resized event after the user has finished manually resizing a window.
Similarly, a moved event now emits on Windows when the window has finished being moved.

2020-10-27_17-19-50

I'm not quite sure whether it's possible to test this manual method of resizing the window. For now, I've added tests for macOS' animated resizing.

resolves #24934

Checklist

Release Notes

Notes: Added 'resized' (Windows/macOS) and 'moved' (Windows) events to BrowserWindow.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Oct 27, 2020
@deepak1556 deepak1556 requested a review from zcbenz October 27, 2020 21:28

Emitted once when the window is moved to a new position.

__Note__: On macOS this event is an alias of `move`.
Copy link
Member Author

Choose a reason for hiding this comment

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

I moved the Note into 'moved' since now the behavior only differs on this event. On Windows, 'moved' will only emit after the user has stopped moving the window. On macOS, it will always emit along with 'move'.

Copy link
Contributor

Choose a reason for hiding this comment

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

After moving the note, it reads to me like this: the moved event is not really implemented on macOS, it is just an alias of move event. But I think the actual behavior is reverse?

The original note was confusing too, so I think maybe we should clearly describe the behavior in the note.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's how I see it as well. You had left a comment mentioning needing to figure out a proper way to dispatch move.

- (void)windowDidMove:(NSNotification*)notification {
[super windowDidMove:notification];
// TODO(zcbenz): Remove the alias after figuring out a proper
// way to dispatch move.
shell_->NotifyWindowMove();
shell_->NotifyWindowMoved();
}

For me, I assume move should follow similar behavior to how mousemove works. It should be emitted at each change of the position of the window.

moved should be emitted after moving is finished and should follow after the last move event. However, macOS doesn't have this behavior and will instead always emit after move.

Does this make sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah you are right.

I thought windowDidMove would emit when moving is finished, but after testing I found it actually keeps emitting during the moving. So moving the note does make the doc more clear 👍 .

Also adds 'moved' event to BrowserWindow on Windows.
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Oct 28, 2020
@MarshallOfSound
Copy link
Member

@samuelmaddock Can you update the PR title / release notes to include a reference to the addition of the "moved" event on Windows

@jkleinsc
Copy link
Member

The releases WG approved this PR for backport to 10-x-y and 11-x-y at the Oct 28, 2020 meeting

@samuelmaddock samuelmaddock changed the title feat: add 'resized' event to BrowserWindow feat: add 'resized' and 'moved' (on Windows) events to BrowserWindow Oct 29, 2020
@samuelmaddock samuelmaddock changed the title feat: add 'resized' and 'moved' (on Windows) events to BrowserWindow Notes: Added 'resized' (Windows/macOS) and 'moved' (Windows) event to BrowserWindow. Oct 29, 2020
@samuelmaddock
Copy link
Member Author

@samuelmaddock Can you update the PR title / release notes to include a reference to the addition of the "moved" event on Windows

@MarshallOfSound I tried my best 😅

@samuelmaddock samuelmaddock changed the title Notes: Added 'resized' (Windows/macOS) and 'moved' (Windows) event to BrowserWindow. Notes: Added 'resized' (Windows/macOS) and 'moved' (Windows) events to BrowserWindow. Oct 29, 2020
@codebytere codebytere changed the title Notes: Added 'resized' (Windows/macOS) and 'moved' (Windows) events to BrowserWindow. feat: Added 'resized' (Windows/macOS) and 'moved' (Windows) events to BrowserWindow. Oct 29, 2020
@codebytere codebytere changed the title feat: Added 'resized' (Windows/macOS) and 'moved' (Windows) events to BrowserWindow. feat: add 'resized' and 'moved' events to BrowserWindow Oct 29, 2020
@jkleinsc
Copy link
Member

The API WG approved this PR at our Nov 9, 2020 meeting.

@jkleinsc jkleinsc merged commit 83d30c5 into electron:master Nov 12, 2020
@release-clerk
Copy link

release-clerk bot commented Nov 12, 2020

Release Notes Persisted

Added 'resized' (Windows/macOS) and 'moved' (Windows) events to BrowserWindow.

@trop
Copy link
Contributor

trop bot commented Nov 12, 2020

I was unable to backport this PR to "10-x-y" cleanly;
you will need to perform this backport manually.

@trop trop bot removed the target/10-x-y label Nov 12, 2020
@trop
Copy link
Contributor

trop bot commented Nov 12, 2020

I have automatically backported this PR to "11-x-y", please check out #26454

@samuelmaddock samuelmaddock deleted the feat/resize-end-event branch November 12, 2020 00:35
@matt-huh
Copy link

I was unable to backport this PR to "10-x-y" cleanly;
you will need to perform this backport manually.

@jkleinsc @codebytere Hi, will this PR not be included in version 10?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BrowserWindow resized event

8 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.