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

feat: add windows options supports DisablePinchZoom configuration(#2021) #3115

Merged
merged 5 commits into from
Dec 15, 2023

Conversation

tuuzed
Copy link
Contributor

@tuuzed tuuzed commented Dec 11, 2023

Add windows options supports IsPinchZoomEnabled configuration(#2021)

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  • Windows
  • macOS
  • Linux

Test Configuration

Please paste the output of wails doctor. If you are unable to run this command, please describe your environment in as much detail as possible.

Checklist:

  • I have updated website/src/pages/changelog.mdx with details of this PR
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Summary by CodeRabbit

  • New Features

    • Introduced an option to disable pinch zoom gestures on Windows.
    • Added support for Apple Silicon hardware detection in the wails doctor utility.
  • Documentation

    • Updated documentation to include the new DisablePinchZoom option.
    • Extended the BackdropType enum documentation with a new Tabbed value description.
    • Fixed incorrect function name reference in the Chinese documentation for WindowSetSize.
  • Bug Fixes

    • Corrected function naming inconsistency in the Chinese version of the documentation from WindowSetSize to WindowGetSize.

Copy link
Contributor

coderabbitai bot commented Dec 11, 2023

Walkthrough

The recent updates introduce a new configuration option to disable pinch zoom on Windows and extend the visual backdrop types with a Tabbed variant. Documentation has been corrected for function naming inaccuracies, and the changelog highlights contributions from the community, including Apple Silicon hardware detection.

Changes

File Path Change Summary
v2/internal/frontend/desktop/windows/frontend.go Added conditional logic for IsPinchZoomEnabled setting.
v2/pkg/options/windows/windows.go Added DisablePinchZoom field to Options struct.
website/docs/reference/options.mdx Documented new DisablePinchZoom option and Tabbed backdrop type.
website/i18n/zh-Hans/.../current/reference/runtime/window.mdx Corrected function name in documentation comments.
website/i18n/zh-Hans/.../version-v2.6.0/reference/runtime/window.mdx Renamed function from WindowSetSize to WindowGetSize.
website/i18n/zh-Hans/.../version-v2.7.0/reference/runtime/window.mdx Updated function name and description to WindowGetSize.
website/src/pages/changelog.mdx Added entries for DisablePinchZoom feature and Apple Silicon detection.

🐰✨
A hop of code on Windows pane,
Pinch zoom's gone, Tabbed arrives in its reign.
Docs align with truth's sweet name,
And Silicon's detected, in the changelog's frame. 🌟📜

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can reply to a review comment made by CodeRabbit.
  • You can tag CodeRabbit on specific lines of code or files in the PR by tagging @coderabbitai in a comment.
  • You can tag @coderabbitai in a PR comment and ask one-off questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between ae99d7a and c69b656.
Files selected for processing (2)
  • v2/internal/frontend/desktop/windows/frontend.go (1 hunks)
  • v2/pkg/options/windows/windows.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • v2/pkg/options/windows/windows.go
Additional comments: 1
v2/internal/frontend/desktop/windows/frontend.go (1)
  • 543-551: Please ensure that the PR checklist is completed. This includes updating the changelog, adhering to the coding style, commenting the code, updating documentation, and ensuring that no new warnings are introduced. It's important to follow the project's contribution guidelines for a consistent and maintainable codebase.

v2/internal/frontend/desktop/windows/frontend.go Outdated Show resolved Hide resolved
@tuuzed tuuzed changed the title feat: add windows options supports IsPinchZoomSupported configurati… feat: add windows options supports IsPinchZoomEnabled configuration(#2021) Dec 11, 2023
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5849fc6 and b54eec4.
Files selected for processing (3)
  • website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/runtime/window.mdx (1 hunks)
  • website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.6.0/reference/runtime/window.mdx (1 hunks)
  • website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.7.0/reference/runtime/window.mdx (1 hunks)
Files skipped from review due to trivial changes (1)
  • website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/runtime/window.mdx
Additional comments: 2
website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.6.0/reference/runtime/window.mdx (1)
  • 105-110: The documentation for WindowSetSize and WindowGetSize appears to be correct and consistent with the rest of the documentation. The addition of WindowGetSize is a new section and does not replace WindowSetSize. Ensure that the implementation of WindowGetSize in the codebase matches this documentation.
website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-v2.7.0/reference/runtime/window.mdx (1)
  • 105-110: It appears that the documentation for WindowSetSize has been retained and a new section for WindowGetSize has been added. This contradicts the PR overview which mentioned an alteration from WindowSetSize to WindowGetSize. Please confirm if the addition of WindowGetSize is intended and that WindowSetSize should remain unchanged.

@leaanthony
Copy link
Member

Thanks for this. Please could you invert the logic: IsPinchZoomDisabled to ensure default bahaviour is consistent? Please could you also add an entry to the changelog located at website/src/pages/changelog.mdx. Thanks 🙏

@leaanthony leaanthony added the awaiting feedback More information is required from the requestor label Dec 12, 2023
@tuuzed tuuzed changed the title feat: add windows options supports IsPinchZoomEnabled configuration(#2021) feat: add windows options supports DisablePinchZoom configuration(#2021) Dec 13, 2023
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5849fc6 and e79e478.
Files selected for processing (4)
  • v2/internal/frontend/desktop/windows/frontend.go (1 hunks)
  • v2/pkg/options/windows/windows.go (1 hunks)
  • website/docs/reference/options.mdx (2 hunks)
  • website/src/pages/changelog.mdx (1 hunks)
Additional comments: 3
v2/internal/frontend/desktop/windows/frontend.go (1)
  • 543-549: Using log.Fatal to handle errors when setting Chromium settings is appropriate, as failing to apply these settings could result in the application being in an inconsistent state. However, ensure that this level of error handling is consistent with the rest of the application's error strategy.
v2/pkg/options/windows/windows.go (1)
  • 68-75: The addition of the DisablePinchZoom field to the Options struct is consistent with the PR's objective to control pinch zoom functionality on Windows. Ensure that all related documentation, including the changelog, is updated to reflect this new feature and that the PR checklist is completed.
website/docs/reference/options.mdx (1)
  • 578-579: The BackdropType enum has been extended with a new value Tabbed. Please ensure that the documentation is updated to reflect this new value.

Comment on lines 17 to 19
### Added

- Added windows options supports `DisablePinchZoom` configuration. Added by @tuuzed in [PR](https://github.com/wailsapp/wails/pull/3115)
Copy link
Contributor

Choose a reason for hiding this comment

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

There appears to be a discrepancy between the feature name mentioned in the summary (IsPinchZoomEnabled) and the one in the changelog (DisablePinchZoom). Please verify that the changelog entry matches the actual implementation in the codebase and update it accordingly to ensure consistency.

Comment on lines 543 to +549
if err != nil {
log.Fatal(err)
}
err = settings.PutIsPinchZoomEnabled(!opts.DisablePinchZoom)
if err != nil {
log.Fatal(err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The implementation of the IsPinchZoomEnabled feature uses a negation of opts.DisablePinchZoom to set the value. This logic assumes that the DisablePinchZoom field exists and is a boolean. Ensure that the DisablePinchZoom field is properly documented, and its default value aligns with the intended functionality of IsPinchZoomEnabled. Additionally, consider handling the potential absence of opts or opts.DisablePinchZoom to avoid a nil pointer dereference.

@tuuzed
Copy link
Contributor Author

tuuzed commented Dec 13, 2023

Thanks for this. Please could you invert the logic: IsPinchZoomDisabled to ensure default bahaviour is consistent? Please could you also add an entry to the changelog located at website/src/pages/changelog.mdx. Thanks 🙏

All right, IsPinchZoomEnable has been renamed as DisablePinchZoom to ensure consistency with default behavior. Also modified the changelog and updated the document.

Copy link
Member

@leaanthony leaanthony left a comment

Choose a reason for hiding this comment

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

Great job! 🙏

@leaanthony leaanthony merged commit 8efaaff into wailsapp:master Dec 15, 2023
4 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e79e478 and f6df2c5.
Files selected for processing (1)
  • website/src/pages/changelog.mdx (1 hunks)
Files skipped from review due to trivial changes (1)
  • website/src/pages/changelog.mdx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback More information is required from the requestor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants