Compare commits

..

87 Commits

Author SHA1 Message Date
Lea Anthony d24d82f86d Rename exp -> v3 2023-01-18 21:34:11 +11:00
Lea Anthony 81e9223124 Merge branch 'master' into future/exp 2023-01-18 21:27:30 +11:00
Lea Anthony 2374bb7e0e Update clir 2023-01-18 20:57:31 +11:00
Lea Anthony 4c42ef9710 Create generate bindings command 2023-01-18 20:19:12 +11:00
stffabi b4d64678b5 Basic integration of the assetserver 2023-01-18 09:31:09 +01:00
Lea Anthony a4f729a6a0 Rename parser package.
Fix linting issues
Add README.md
2023-01-18 08:22:31 +11:00
Lea Anthony 8e593e9c35 Start of TS models generation support 2023-01-17 18:57:35 +11:00
Lea Anthony 0a09363db7 Support struct discovery over multiple files 2023-01-17 07:45:41 +11:00
Lea Anthony b0b96c9838 Support struct discovery in methods 2023-01-16 20:30:05 +11:00
Lea Anthony 8bbf5ff3f1 Recursive bound model discovery implemented 2023-01-15 20:25:42 +11:00
Lea Anthony 572fbc9705 Initial parsing to discover bound struct names 2023-01-13 17:35:43 +11:00
Lea Anthony f371b513d1 Fix name of Window menu in role 2023-01-13 17:33:54 +11:00
Lea Anthony e5d3803fc1 Initial runtime builds
Added Taskfile for fast runtime builds
2023-01-08 21:06:31 +11:00
Lea Anthony 06a0377963 Fix frameless
Add rounded corners for frameless
Create NSWindow subclass
Add pre-post build hooks
2023-01-07 11:26:46 +11:00
Lea Anthony 62a5509390 Do not display internal tasks when using wails task list 2023-01-06 20:20:40 +11:00
Lea Anthony 54805d99a0 Remove New from Dialog methods 2023-01-06 20:19:20 +11:00
Lea Anthony d1e2ee452f Integrate Task 2023-01-05 15:02:08 +11:00
Lea Anthony b5127d95ff Add EnableFraudulentWebsiteWarnings feature
Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2023-01-04 20:12:28 +11:00
Lea Anthony 174a31b49a Add run command for running tasks in a Taskfile.yml
Add `generate` command for generating assets
Add build example
2023-01-04 20:01:13 +11:00
Lea Anthony 746b4dfc04 Fix sizes bug
Remove redundant menu package
2023-01-03 05:43:56 +11:00
Lea Anthony e5da0eb5f8 Add icon generation
Add syso generation
Add tests
2023-01-02 21:23:44 +11:00
Lea Anthony f4044ebcd9 Add icon tool 2023-01-02 08:23:29 +11:00
Lea Anthony bc7d8295ba Refactor window -> webviewwindow 2023-01-02 05:48:52 +11:00
Lea Anthony 71fb7fadff Merge branch 'chore/move_assetserver_to_pkg' into future/exp 2022-12-31 13:08:34 +11:00
Lea Anthony be240795e2 Refactor assetserver into pkg 2022-12-31 11:01:24 +11:00
Lea Anthony cf5def05a6 Refactor application API to use options by default. Updated examples. 2022-12-31 10:38:36 +11:00
Lea Anthony ad802a3ad0 Frameless support
applicationShouldTerminateAfterLastWindowClosed support
2022-12-30 14:14:28 +11:00
Lea Anthony 287039a8f3 Task experiment 2022-12-28 19:17:38 +11:00
Lea Anthony ad1d104d85 Add screen support
Co-authored-by: Oleg Gulevskyy <43781031+oleggulevskyy@users.noreply.github.com>
2022-12-28 14:09:13 +11:00
Lea Anthony 92af7455ad Support Show/Hide window
Better demo
window.Run() -> window.Show()
2022-12-27 21:15:43 +11:00
Lea Anthony b6b6acf1d9 Remove debug printfs 2022-12-27 15:31:24 +11:00
Lea Anthony 5187641e25 Remove C.toggleFullscreen 2022-12-27 15:29:57 +11:00
Lea Anthony 41779866c4 Disable fullscreen button if there are size constraints 2022-12-27 13:42:57 +11:00
Lea Anthony f800222781 Allow SetSize to adjust min/max constraints 2022-12-27 09:38:00 +11:00
Lea Anthony 0c364b2813 Fix sizing of window/contentrect
Fix set min/max size
Ignore SetSize when in fullscreen
Disable size constraints when going fullscreen
2022-12-27 09:23:54 +11:00
Lea Anthony 7dbb8c1377 Improve Minimise, Maximise
Add Restore
setAutoenablesItems:NO
2022-12-26 20:21:51 +11:00
Lea Anthony 6a0c101b08 Fix dialog ID issue
Use map instead of uint for dialog IDs
2022-12-24 20:40:34 +11:00
Lea Anthony f240f2100c Refactor mainthread dispatch 2022-12-24 15:35:04 +11:00
Lea Anthony 2b91ced1b7 Support SetPosition
Optimise event listener callbacks
2022-12-24 13:38:48 +11:00
Lea Anthony b7f1defbf3 NavigateToURL -> SetURL
Fixed typo in colour
Removed EnableDevTools
2022-12-23 23:18:28 +11:00
Lea Anthony 2946a0aa25 GetCurrentWindow -> CurrentWindow 2022-12-23 19:55:54 +11:00
Lea Anthony b043126031 Add open file dialog filters
Add clipboard
Fix mouse event handling
2022-12-23 07:34:12 +11:00
Lea Anthony 4d58b56d54 Improve dialogs 2022-12-21 21:30:26 +11:00
Lea Anthony 025e8d7645 Add SaveFileDialog
Add Toolbar Styles
Add Invisible Titlebar option with drag support
2022-12-20 21:49:19 +11:00
Lea Anthony e7abe1c606 Add Webview navigation events
Add HTML/JS/CSS in config
Add RenderHTML()
Tidy up window delegate
2022-12-19 21:17:50 +11:00
Lea Anthony ea1f086289 OpenDialog attach to window & multiple files selection 2022-12-19 08:26:59 +11:00
Lea Anthony b1e8f2f887 Start of file dialogs 2022-12-18 23:06:31 +11:00
Lea Anthony 45adc49683 Add application icon support
Add message dialog support
Add default icons
Add png to byte slice task
Fixed kitchen sink
2022-12-18 13:06:03 +11:00
Lea Anthony 2409984aab Add application about dialog
Add application icon support
2022-12-18 00:40:53 +11:00
Lea Anthony 8f9eeb8055 Improve menu demo 2022-12-17 20:49:58 +11:00
Lea Anthony a8d5f185c2 Fix resizing bug
Refactor some application setters
2022-12-17 20:49:46 +11:00
Lea Anthony bbb418f98f Fix submenu radio processing 2022-12-17 20:49:04 +11:00
Lea Anthony f8eb680559 Add Window & Help menus
Fix min/max sizing
2022-12-17 19:56:29 +11:00
Lea Anthony da5fa806d7 Add Zoom In/Out & Actual size roles 2022-12-16 21:28:16 +11:00
Lea Anthony 88f6a3d1b9 Refactor and support more roles 2022-12-16 21:09:31 +11:00
Lea Anthony 475880c0a8 Add services, hide, hideothers, unhide role
Add application.Name()
refactor roles
Add app menu role
2022-12-16 21:06:49 +11:00
Lea Anthony faf418eac0 Add global reference for application
Add default application meu for Mac
Add window example
Fix invalid accelerator error logging
2022-12-15 21:21:19 +11:00
Lea Anthony f35b8dfec5 Refactor Application
Add SetActivationPolicy
Added labels to menus
2022-12-15 18:06:09 +11:00
Lea Anthony 14fcfb8348 Refactor event types 2022-12-15 18:03:01 +11:00
Lea Anthony f84c4aca72 Refactor message processing functions 2022-12-15 08:01:49 +11:00
Lea Anthony dad7798da9 New Systray example 2022-12-15 08:01:21 +11:00
Lea Anthony 79af667b7a Support Menu Accelerators 2022-12-15 08:00:49 +11:00
Lea Anthony d84cb5b190 Fix enabled menuitem 2022-12-14 19:15:58 +11:00
Lea Anthony 7c18f25508 Support radio menuitems
Support systemtray destroy()
2022-12-14 19:03:27 +11:00
Lea Anthony 085de606ee Support submenus 2022-12-14 08:48:17 +11:00
Lea Anthony c7ac90def4 Support template icons 2022-12-14 08:26:52 +11:00
Lea Anthony bb36ce61bc Refactor dispatching 2022-12-14 07:52:10 +11:00
Lea Anthony a35a876094 Add support for system tray + menus 2022-12-13 21:54:12 +11:00
Lea Anthony f38c6c6d1c Add Fatal() 2022-12-11 20:05:00 +11:00
Lea Anthony f6a16950f2 Add Window methods Width(), Height(), Size() + Position()
Fix main thread locking issue
Add Window aliases
2022-12-11 19:57:20 +11:00
Lea Anthony ddb2f63f7b Support Window aliases 2022-12-11 14:39:53 +11:00
Lea Anthony bf8e541221 Support Window events
Convert events to uint
Rename system events to application events
2022-12-11 13:01:38 +11:00
Lea Anthony 4a2cf597c2 Fix resizable 2022-12-11 11:26:21 +11:00
Lea Anthony 27370559d3 Refactor Is* methods
Add more events
2022-12-11 11:09:52 +11:00
Lea Anthony a134bfac42 Add Center
Add more events
2022-12-10 22:34:15 +11:00
Lea Anthony d5e21d5003 Fix race condition in closing window during navigating
Add sane defaults
2022-12-09 08:22:17 +11:00
Lea Anthony 85abb1122f Add main thread dispatching
Make `window.Run` operate on main thread
2022-12-09 07:47:47 +11:00
Lea Anthony 0257362a86 Support per-window message dispatching 2022-12-08 23:06:27 +11:00
Lea Anthony 1872672d0c Support appearance 2022-12-08 18:20:04 +11:00
Lea Anthony 644655662e Support toolbar config 2022-12-08 18:09:02 +11:00
Lea Anthony 508bbb4fb4 Support Min/Max/Fullscreen, BackgroundColour 2022-12-08 17:25:39 +11:00
Lea Anthony cb9df61a98 Support MacBackdrop type
Fix devtools window error
2022-12-08 07:47:04 +11:00
Lea Anthony ab976e56af Support ExecJS 2022-12-07 23:58:45 +11:00
Lea Anthony df1cc2ee0b Support EnableDevTools 2022-12-07 23:52:16 +11:00
Lea Anthony af6daa273e Support min/max window size 2022-12-07 23:44:19 +11:00
Lea Anthony 05803fb5d5 Add more Window API 2022-12-07 23:30:20 +11:00
Lea Anthony 5a37091bb0 Initial play around 2022-12-07 21:55:09 +11:00
2657 changed files with 88015 additions and 56266 deletions
-511
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
runtime/assets/default.html
+30
View File
@@ -0,0 +1,30 @@
{
"env": {
"browser": true,
"es6": true,
"node": true,
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2016,
"sourceType": "module",
},
"rules": {
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
}
-4
View File
@@ -1,9 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Discord Chat
url: https://discord.gg/BrRSWTaxVK
about: Ask questions and discuss with other Wails users in real time.
- name: GitHub Community Discussions
url: https://github.com/wailsapp/wails/discussions
about: If your question is not a feature or a bug, please go to the discussion panel and retrieve if your question already exists before submitting.
+1 -1
View File
@@ -1,4 +1,4 @@
name: Build + Test v2
name: Build + Test
on:
push:
+15
View File
@@ -0,0 +1,15 @@
name: Label sponsors
on:
pull_request:
types: [ opened ]
issues:
types: [ opened ]
jobs:
build:
name: is-sponsor-label
if: github.repository == 'wailsapp/wails'
runs-on: ubuntu-latest
steps:
- uses: JasonEtco/is-sponsor-label-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,9 +1,8 @@
name: Upload Source Documents
name: Push Checks
on:
push:
branches: [master]
workflow_dispatch:
jobs:
push_files_to_crowdin:
@@ -14,28 +13,25 @@ jobs:
- uses: actions/checkout@v2
- name: Verify Changed files
id: changed-files
uses: tj-actions/changed-files@v35
uses: tj-actions/verify-changed-files@v11.1
id: verify-changed-files
with:
files: |
website/**/*.mdx
website/**/*.md
website/**/*.json
- name: Setup Nodejs
- name: Set node
if: steps.verify-changed-files.outputs.files_changed != 'true'
uses: actions/setup-node@v2
with:
node-version: 18.x
node-version: 16.x
- name: Setup Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload source documents
if: steps.changed-files.outputs.any_changed == 'true'
- name: Push files
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
working-directory: ./website
run: task crowdin:push
run: |
cd website
corepack enable
pnpm install
pnpm run crowdin push -b master
@@ -1,4 +1,4 @@
name: Sync Translations
name: Sync Translated Documents
on:
workflow_dispatch:
@@ -10,30 +10,22 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup Nodejs
- name: Set node
uses: actions/setup-node@v2
with:
node-version: 18.x
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
node-version: 16.x
- name: Sync Translated Documents
run: cd scripts && chmod 755 ./sync-translated-documents.sh && ./sync-translated-documents.sh
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
working-directory: ./website
run: task crowdin:pull
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "docs: sync translations"
title: "docs: sync translations"
commit-message: "docs: sync documents"
title: "docs: sync documents"
body: "- [x] Sync translated documents"
branch: chore/sync-translations
labels: translation
branch: feature/documents
delete-branch: true
draft: true
-2
View File
@@ -34,5 +34,3 @@ v2/cmd/wails/internal/commands/initialise/templates/testtemplates/
/v3/.task
/v3/examples/build/bin/testapp
/websitev3/site/
/v3/examples/plugins/bin/testapp
+34
View File
@@ -0,0 +1,34 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
builds:
- env:
- CGO_ENABLED=0
goos:
- windows
- linux
- darwin
goarch:
- 386
- amd64
ignore:
- goos: darwin
goarch: 386
main: ./cmd/wails/main.go
archive:
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
+6
View File
@@ -0,0 +1,6 @@
jshint:
config_file: .jshintrc
eslint:
enabled: true
config_file: .eslintrc
ignore_file: .eslintignore
+3
View File
@@ -0,0 +1,3 @@
{
"esversion": 6
}
+2 -3
View File
@@ -26,8 +26,8 @@
<a href="https://github.com/avelino/awesome-go" rel="nofollow">
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome" />
</a>
<a href="https://discord.gg/BrRSWTaxVK">
<img alt="Discord" src="https://dcbadge.vercel.app/api/server/BrRSWTaxVK?style=flat"/>
<a href="https://app.slack.com/client/T029RQSE6/CJ4P9F7MZ">
<img alt="Slack" src="https://img.shields.io/badge/slack-gophers%2Fwails%20-blue?logo=slack"/>
</a>
<br/>
<a href="https://github.com/wailsapp/wails/actions/workflows/build-and-test.yml" rel="nofollow">
@@ -58,7 +58,6 @@
- [スポンサー](#スポンサー)
- [始め方](#始め方)
- [FAQ](#faq)
- [スター数の推移](#スター数の推移)
- [コントリビューター](#コントリビューター)
- [特記事項](#特記事項)
- [スペシャルサンクス](#スペシャルサンクス)
+2 -3
View File
@@ -26,8 +26,8 @@
<a href="https://github.com/avelino/awesome-go" rel="nofollow">
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome" />
</a>
<a href="https://discord.gg/BrRSWTaxVK">
<img alt="Discord" src="https://dcbadge.vercel.app/api/server/BrRSWTaxVK?style=flat"/>
<a href="https://app.slack.com/client/T029RQSE6/CJ4P9F7MZ">
<img alt="Slack" src="https://img.shields.io/badge/slack-gophers%2Fwails%20-blue?logo=slack"/>
</a>
<br/>
<a href="https://github.com/wailsapp/wails/actions/workflows/build-and-test.yml" rel="nofollow">
@@ -57,7 +57,6 @@
- [시작하기](#시작하기)
- [스폰서](#스폰서)
- [FAQ](#faq)
- [Stargazers 성장 추세](#stargazers-성장-추세)
- [기여자](#기여자)
- [라이센스](#라이센스)
- [영감](#영감)
+2 -7
View File
@@ -24,8 +24,8 @@
<a href="https://github.com/avelino/awesome-go" rel="nofollow">
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome" />
</a>
<a href="https://discord.gg/BrRSWTaxVK">
<img alt="Discord" src="https://dcbadge.vercel.app/api/server/BrRSWTaxVK?style=flat"/>
<a href="https://app.slack.com/client/T029RQSE6/CJ4P9F7MZ">
<img alt="Slack" src="https://img.shields.io/badge/slack-gophers%2Fwails%20-blue?logo=slack"/>
</a>
<br/>
<a href="https://github.com/wailsapp/wails/actions/workflows/build-and-test.yml" rel="nofollow">
@@ -55,7 +55,6 @@
- [Getting Started](#getting-started)
- [Sponsors](#sponsors)
- [FAQ](#faq)
- [Stargazers over time](#stargazers-over-time)
- [Contributors](#contributors)
- [License](#license)
- [Inspiration](#inspiration)
@@ -95,10 +94,6 @@ The installation instructions are on the [official website](https://wails.io/doc
This project is supported by these kind people / companies:
<img src="website/static/img/sponsors.svg" style="width:100%;max-width:800px;"/>
<p align="center">
<img src="https://wails.io/img/sponsor/jetbrains-grayscale.webp" style="width: 100px"/>
</p>
## FAQ
- Is this an alternative to Electron?
+2 -3
View File
@@ -26,8 +26,8 @@
<a href="https://github.com/avelino/awesome-go" rel="nofollow">
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome" />
</a>
<a href="https://discord.gg/BrRSWTaxVK">
<img alt="Discord" src="https://dcbadge.vercel.app/api/server/BrRSWTaxVK?style=flat"/>
<a href="https://app.slack.com/client/T029RQSE6/CJ4P9F7MZ">
<img alt="Slack" src="https://img.shields.io/badge/slack-gophers%2Fwails%20-blue?logo=slack"/>
</a>
<br/>
<a href="https://github.com/wailsapp/wails/actions/workflows/build-and-test.yml" rel="nofollow">
@@ -57,7 +57,6 @@
- [快速入门](#快速入门)
- [赞助商](#赞助商)
- [常见问题](#常见问题)
- [星星增长趋势](#星星增长趋势)
- [贡献者](#贡献者)
- [许可证](#许可证)
- [灵感](#灵感)
-24
View File
@@ -1,24 +0,0 @@
# https://taskfile.dev
version: "3"
vars:
GREETING: Hello, World!
tasks:
contributors:check:
cmds:
- npx -y all-contributors-cli check
contributors:update:
cmds:
- go run v3/tasks/contribs/main.go
contributors:build:
cmds:
- npx -y all-contributors-cli generate
release:
dir: v2/tools/release
cmds:
- go run release.go {{.CLI_ARGS}}
+174
View File
@@ -0,0 +1,174 @@
package wails
import (
"os"
"syscall"
"github.com/syossan27/tebata"
"github.com/wailsapp/wails/cmd"
"github.com/wailsapp/wails/lib/binding"
"github.com/wailsapp/wails/lib/event"
"github.com/wailsapp/wails/lib/interfaces"
"github.com/wailsapp/wails/lib/ipc"
"github.com/wailsapp/wails/lib/logger"
"github.com/wailsapp/wails/lib/renderer"
wailsruntime "github.com/wailsapp/wails/runtime"
)
// -------------------------------- Compile time Flags ------------------------------
// BuildMode indicates what mode we are in
var BuildMode = cmd.BuildModeProd
// Runtime is the Go Runtime struct
type Runtime = wailsruntime.Runtime
// Store is a state store used for syncing with
// the front end
type Store = wailsruntime.Store
// CustomLogger is a specialised logger
type CustomLogger = logger.CustomLogger
// ----------------------------------------------------------------------------------
// App defines the main application struct
type App struct {
config *AppConfig // The Application configuration object
cli *cmd.Cli // In debug mode, we have a cli
renderer interfaces.Renderer // The renderer is what we will render the app to
logLevel string // The log level of the app
ipc interfaces.IPCManager // Handles the IPC calls
log *logger.CustomLogger // Logger
bindingManager interfaces.BindingManager // Handles binding of Go code to renderer
eventManager interfaces.EventManager // Handles all the events
runtime interfaces.Runtime // The runtime object for registered structs
}
// CreateApp creates the application window with the given configuration
// If none given, the defaults are used
func CreateApp(optionalConfig ...*AppConfig) *App {
var userConfig *AppConfig
if len(optionalConfig) > 0 {
userConfig = optionalConfig[0]
}
result := &App{
logLevel: "debug",
renderer: renderer.NewWebView(),
ipc: ipc.NewManager(),
bindingManager: binding.NewManager(),
eventManager: event.NewManager(),
log: logger.NewCustomLogger("App"),
}
appconfig, err := newConfig(userConfig)
if err != nil {
result.log.Fatalf("Cannot use custom HTML: %s", err.Error())
}
result.config = appconfig
// Set up the CLI if not in release mode
if BuildMode != cmd.BuildModeProd {
result.cli = result.setupCli()
} else {
// Disable Inspector in release mode
result.config.DisableInspector = true
}
// Platform specific init
platformInit()
return result
}
// Run the app
func (a *App) Run() error {
if BuildMode != cmd.BuildModeProd {
return a.cli.Run()
}
a.logLevel = "error"
err := a.start()
if err != nil {
a.log.Error(err.Error())
}
return err
}
func (a *App) start() error {
// Set the log level
logger.SetLogLevel(a.logLevel)
// Log starup
a.log.Info("Starting")
// Check if we are to run in bridge mode
if BuildMode == cmd.BuildModeBridge {
a.renderer = renderer.NewBridge()
}
// Initialise the renderer
err := a.renderer.Initialise(a.config, a.ipc, a.eventManager)
if err != nil {
return err
}
// Start signal handler
t := tebata.New(os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)
t.Reserve(func() {
a.log.Debug("SIGNAL CAUGHT! Starting Shutdown")
a.renderer.Close()
})
// Start event manager and give it our renderer
a.eventManager.Start(a.renderer)
// Start the IPC Manager and give it the event manager and binding manager
a.ipc.Start(a.eventManager, a.bindingManager)
// Create the runtime
a.runtime = wailsruntime.NewRuntime(a.eventManager, a.renderer)
// Start binding manager and give it our renderer
err = a.bindingManager.Start(a.renderer, a.runtime)
if err != nil {
return err
}
// Defer the shutdown
defer a.shutdown()
// run the renderer
err = a.renderer.Run()
if err != nil {
return err
}
return nil
}
// shutdown the app
func (a *App) shutdown() {
// Make sure this is only called once
a.log.Debug("Shutting down")
// Shutdown Binding Manager
a.bindingManager.Shutdown()
// Shutdown IPC Manager
a.ipc.Shutdown()
// Shutdown Event Manager
a.eventManager.Shutdown()
a.log.Debug("Cleanly Shutdown")
}
// Bind allows the user to bind the given object
// with the application
func (a *App) Bind(object interface{}) {
a.bindingManager.Bind(object)
}
+8
View File
@@ -0,0 +1,8 @@
//go:build linux || darwin || !windows
// +build linux darwin !windows
package wails
func platformInit() {
}
+28
View File
@@ -0,0 +1,28 @@
//go:build windows || !linux || !darwin
// +build windows !linux !darwin
package wails
import (
"fmt"
"log"
"syscall"
)
func platformInit() {
err := SetProcessDPIAware()
if err != nil {
log.Fatalf(err.Error())
}
}
// SetProcessDPIAware via user32.dll
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setprocessdpiaware
// Also, thanks Jack Mordaunt! https://github.com/wailsapp/wails/issues/293
func SetProcessDPIAware() error {
status, r, err := syscall.NewLazyDLL("user32.dll").NewProc("SetProcessDPIAware").Call()
if status == 0 {
return fmt.Errorf("exit status %d: %v %v", status, r, err)
}
return nil
}

Some files were not shown because too many files have changed in this diff Show More