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

[Bug]: BrowserWindow.getTrafficLightPosition() returns { x: 0, y: 0 } #34969

Closed
3 tasks done
bpasero opened this issue Jul 19, 2022 · 6 comments · Fixed by #37094
Closed
3 tasks done

[Bug]: BrowserWindow.getTrafficLightPosition() returns { x: 0, y: 0 } #34969

bpasero opened this issue Jul 19, 2022 · 6 comments · Fixed by #37094

Comments

@bpasero
Copy link
Contributor

bpasero commented Jul 19, 2022

Preflight Checklist

Electron Version

18.3.5

What operating system are you using?

macOS

Operating System Version

12.4

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Expected Behavior

Either BrowserWindow.getTrafficLightPosition() should return undefined if not specified or the actual value it has.

Actual Behavior

BrowserWindow.getTrafficLightPosition() returns { x: 0, y: 0 } when not set custom.

Testcase Gist URL

No response

Additional Information

No response

bpasero referenced this issue in microsoft/vscode Jul 19, 2022
* add 4px extra space to title bar part when CC is enabled
* trigger relayout when toggling CC so that new height is taken into account
* macos: manually position traffic lights so that they line-up with CC
@codebytere
Copy link
Member

codebytere commented Jul 19, 2022

This was done initially for backwards compatibility reasons - @zcbenz do you think we might want to change this?

@ckerr
Copy link
Member

ckerr commented Jul 19, 2022

The docs say:

win.getTrafficLightPosition() macOS

Returns Point - The custom position for the traffic light buttons in frameless window.

This doc isn't as clear as it could be (it should be explicit on what gets returned when there's no custom value) but I agree it ought to be undefined -- (a) that follows more to the spirit of the existing docs, and (b) otherwise there's an edge case because it's impossible to know whether a return value of (0, 0) indicates a custom value or is just the default.

@MarshallOfSound
Copy link
Member

This was done initially for backwards compatibility reasons - @zcbenz do you think we might want to change this?

Changing this isn't viable, it would be an undetectable breaking change for lots of apps. We could add a new API getCustomTrafficLightPosition (or something similarly named) that returns null when their is no custom position and update the setter that takes null as a valid argument to reset the position to the system default.

Updating the setter is semver/minor but changing an existing getter to potentially return null is semver/major. Adding a new API and deprecating the old one for removal in ~two releases is probably the best option.

@zcbenz
Copy link
Member

zcbenz commented Jul 25, 2022

The API behaved this way since it was introduced, so basically all existing apps are relying on it and we can not just change the behavior. I agree we should introduce a new API and deprecate this one.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Oct 23, 2022
@bpasero
Copy link
Contributor Author

bpasero commented Nov 7, 2022

bump

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

Successfully merging a pull request may close this issue.

5 participants