Skip to content
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

fix: window ordering on mac #29857

Merged
merged 1 commit into from Jul 9, 2021
Merged

fix: window ordering on mac #29857

merged 1 commit into from Jul 9, 2021

Conversation

deepak1556
Copy link
Member

@deepak1556 deepak1556 commented Jun 23, 2021

Description of Change

Fixes #29758

The call to NativeWidgetMac::Activate added in #29204 tries to set the visibility state of the window via NativeWidgetNSWindowBridge with state kShowAndActivateWindow which eventually calls [NSWindow makeKeyAndOrderFront:]

This is all fine for normal cases, but under the following situations it triggers a series of windowDidBecomeKey: notifications that messes with window ordering.

  1. When opening panels the main window takes key status and captures the input events
  2. When in fullscreen opening a second window does not inherit the fullscreen behavior
  3. Custom window switchers are unable to switch between windows

Since we are making the widget call in the key window notification code path, it is safe to remove this redundant call that is causing the above incorrect behaviors.

Checklist

Release Notes

Notes: fix key window status on mac when opening panels or using custom window switchers

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jun 23, 2021
@deepak1556 deepak1556 added semver/patch backwards-compatible bug fixes target/12-x-y labels Jun 23, 2021
const w2 = new BrowserWindow();
await delay();
expect(w2.isFullScreen()).to.be.true('isFullScreen');
});
Copy link
Member

Choose a reason for hiding this comment

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

should we add more tests for the other behaviors you mentioned?

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 couldn't find a good way to automate tests for scenarios 1 and 3. Scenario 1) requires to check that the Quick Panel from the OS receives the input event and Scenario 3) requires a custom window switcher like https://alt-tab-macos.netlify.app/ for example.

@nornagon
Copy link
Member

Is this possibly related? #28348

@deepak1556
Copy link
Member Author

Is this possibly related? #28348

Nope it is unrelated.

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jun 24, 2021
@deepak1556 deepak1556 requested a review from nornagon July 1, 2021 03:29
@deepak1556
Copy link
Member Author

Failing tests are unrelated, merging.

@deepak1556 deepak1556 merged commit ccfde6c into main Jul 9, 2021
@deepak1556 deepak1556 deleted the robo/fix_mac_focus branch July 9, 2021 20:38
@release-clerk
Copy link

release-clerk bot commented Jul 9, 2021

Release Notes Persisted

fix key window status on mac when opening panels or using custom window switchers

@trop
Copy link
Contributor

trop bot commented Jul 9, 2021

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

@trop
Copy link
Contributor

trop bot commented Jul 9, 2021

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

@miniak
Copy link
Contributor

miniak commented Jul 9, 2021

/trop run backport-to 13-x-y

@trop
Copy link
Contributor

trop bot commented Jul 9, 2021

The backport process for this PR has been manually initiated - sending your PR to 13-x-y!

@trop
Copy link
Contributor

trop bot commented Jul 9, 2021

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

@codebytere
Copy link
Member

Backported in #29234 - missed owing to bad syntax for backport pr body

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: App hijacks focus from win.previewFile since v12.0.9
5 participants