Skip to content

Commit

Permalink
Merge branch 'master' into add-french-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nejos97 authored Oct 3, 2023
2 parents a8a2afb + f6c82dc commit 56fc7b5
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion v2/internal/frontend/desktop/darwin/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification {
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
if (self.alwaysOnTop) {
[self.mainWindow setLevel:NSStatusWindowLevel];
[self.mainWindow setLevel:NSFloatingWindowLevel];
}
if ( !self.startHidden ) {
[self.mainWindow makeKeyAndOrderFront:self];
Expand Down
1 change: 1 addition & 0 deletions v2/internal/frontend/desktop/darwin/WailsContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
struct Preferences {
bool *tabFocusesLinks;
bool *textInteractionEnabled;
bool *fullscreenEnabled;
};

- (void) CreateWindow:(int)width :(int)height :(bool)frameless :(bool)resizable :(bool)fullscreen :(bool)fullSizeContent :(bool)hideTitleBar :(bool)titlebarAppearsTransparent :(bool)hideTitle :(bool)useToolbar :(bool)hideToolbarSeparator :(bool)webviewIsTransparent :(bool)hideWindowOnClose :(NSString *)appearance :(bool)windowIsTranslucent :(int)minWidth :(int)minHeight :(int)maxWidth :(int)maxHeight :(bool)fraudulentWebsiteWarningEnabled :(struct Preferences)preferences;
Expand Down
8 changes: 7 additions & 1 deletion v2/internal/frontend/desktop/darwin/WailsContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ - (void) CreateWindow:(int)width :(int)height :(bool)frameless :(bool)resizable
config.preferences.textInteractionEnabled = *preferences.textInteractionEnabled;
}
}

if (@available(macOS 12.3, *)) {
if (preferences.fullscreenEnabled != NULL) {
config.preferences.elementFullscreenEnabled = *preferences.fullscreenEnabled;
}
}

// [config.preferences setValue:[NSNumber numberWithBool:true] forKey:@"developerExtrasEnabled"];

Expand Down Expand Up @@ -406,7 +412,7 @@ - (void) UnMaximise {

- (void) SetAlwaysOnTop:(int)onTop {
if (onTop) {
[self.mainWindow setLevel:NSStatusWindowLevel];
[self.mainWindow setLevel:NSFloatingWindowLevel];
} else {
[self.mainWindow setLevel:NSNormalWindowLevel];
}
Expand Down
4 changes: 4 additions & 0 deletions v2/internal/frontend/desktop/darwin/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ func NewWindow(frontendOptions *options.App, debug bool, devtools bool) *Window
if mac.Preferences.TextInteractionEnabled.IsSet() {
preferences.textInteractionEnabled = bool2CboolPtr(mac.Preferences.TextInteractionEnabled.Get())
}

if mac.Preferences.FullscreenEnabled.IsSet() {
preferences.fullscreenEnabled = bool2CboolPtr(mac.Preferences.FullscreenEnabled.Get())
}
}

windowIsTranslucent = bool2Cint(mac.WindowIsTranslucent)
Expand Down
3 changes: 3 additions & 0 deletions v2/pkg/options/mac/preferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ type Preferences struct {
// A Boolean value that indicates whether to allow people to select or otherwise interact with text.
// Set to true by default.
TextInteractionEnabled u.Bool
// A Boolean value that indicates whether a web view can display content full screen.
// Set to false by default
FullscreenEnabled u.Bool
}
6 changes: 5 additions & 1 deletion website/docs/guides/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,8 @@ you can make the webview background transparent using the following config:
If you have installed WebView2, but the `wails doctor` command shows that it is not installed, it is likely that the
WebView2 runtime installed was for a different architecture. You can download the correct runtime from [here](https://developer.microsoft.com/en-us/microsoft-edge/webview2/).

Source: https://github.com/wailsapp/wails/issues/2917
Source: https://github.com/wailsapp/wails/issues/2917

## WebVie2wProcess failed with kind

If your Windows app generates this kind of error, you can check out what the error means [here](https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2processfailedkind?view=webview2-winrt-1.0.2045.28).
3 changes: 3 additions & 0 deletions website/docs/reference/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -812,13 +812,15 @@ You can specify the webview preferences.
type Preferences struct {
TabFocusesLinks u.Bool
TextInteractionEnabled u.Bool
FullscreenEnabled u.Bool
}
```

| Name | Description |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| TabFocusesLinks | A Boolean value that indicates whether pressing the tab key changes the focus to links and form controls. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/2818595-tabfocuseslinks?language=objc) |
| TextInteractionEnabled | A Boolean value that indicates whether to allow people to select or otherwise interact with text. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/3727362-textinteractionenabled?language=objc) |
| FullscreenEnabled | A Boolean value that indicates whether a web view can display content full screen. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/3917769-elementfullscreenenabled?language=objc) |

Example:

Expand All @@ -827,6 +829,7 @@ Mac: &mac.Options{
Preferences: &mac.Preferences{
TabFocusesLinks: mac.Enabled,
TextInteractionEnabled: mac.Disabled,
FullscreenEnabled: mac.Enabled,
}
}
```
Expand Down
3 changes: 2 additions & 1 deletion website/src/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added support for enabling/disabling swipe gestures for Windows WebView2. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2878)
- When building with `-devtools` flag, CMD/CTRL+SHIFT+F12 can be used to open the devtools. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2915)
- Added support for setting some of the Webview preferences, `textInteractionEnabled` and `tabFocusesLinks` on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2937)
- Added support for enabling/disabling fullscreen of the Webview on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2953)

### Changed

- AssetServer requests are now processed asynchronously without blocking the main thread on Windows. Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2926)
- AssetServer requests are now processed concurrently by spawning a goroutine per request. Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2926)
- Now building with `-devtools` flag doesn't enable the default context-menu. Changed by @mmghv in [PR](https://github.com/wailsapp/wails/pull/2923)

- Change Window Level. Changed by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/2944)
#### Fixed

- Fixed typo on docs/reference/options page. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2887)
Expand Down

0 comments on commit 56fc7b5

Please sign in to comment.