mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 23:51:44 +08:00
[v2] go fmt + windowIsTranslucent
This commit is contained in:
parent
00639677f5
commit
be87d73da8
@ -1,3 +1,4 @@
|
|||||||
|
//go:build linux || darwin || !windows
|
||||||
// +build linux darwin !windows
|
// +build linux darwin !windows
|
||||||
|
|
||||||
package wails
|
package wails
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build windows || !linux || !darwin
|
||||||
// +build windows !linux !darwin
|
// +build windows !linux !darwin
|
||||||
|
|
||||||
package wails
|
package wails
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,3 +1,4 @@
|
|||||||
|
//go:build dev
|
||||||
// +build dev
|
// +build dev
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build dev
|
||||||
// +build dev
|
// +build dev
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build windows
|
||||||
// +build windows
|
// +build windows
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package interfaces
|
package interfaces
|
||||||
|
|
||||||
// Runtime interface
|
// Runtime interface
|
||||||
type Runtime interface {}
|
type Runtime interface{}
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -8,7 +8,6 @@ import (
|
|||||||
"github.com/wailsapp/wails/v2"
|
"github.com/wailsapp/wails/v2"
|
||||||
"github.com/wailsapp/wails/v2/pkg/logger"
|
"github.com/wailsapp/wails/v2/pkg/logger"
|
||||||
"github.com/wailsapp/wails/v2/pkg/options"
|
"github.com/wailsapp/wails/v2/pkg/options"
|
||||||
"github.com/wailsapp/wails/v2/pkg/options/mac"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -29,16 +28,11 @@ func main() {
|
|||||||
Frameless: false,
|
Frameless: false,
|
||||||
StartHidden: false,
|
StartHidden: false,
|
||||||
HideWindowOnClose: false,
|
HideWindowOnClose: false,
|
||||||
RGBA: 0x000000FF,
|
RGBA: &options.RGBA{0, 0, 0, 255},
|
||||||
Windows: &windows.Options{
|
Windows: &windows.Options{
|
||||||
WebviewIsTransparent: true,
|
WebviewIsTransparent: true,
|
||||||
WindowBackgroundIsTranslucent: true,
|
WindowIsTranslucent: true,
|
||||||
DisableWindowIcon: true,
|
DisableWindowIcon: true,
|
||||||
},
|
|
||||||
Mac: &mac.Options{
|
|
||||||
WebviewIsTransparent: true,
|
|
||||||
WindowBackgroundIsTranslucent: true,
|
|
||||||
TitleBar: mac.TitleBarHiddenInset(),
|
|
||||||
},
|
},
|
||||||
LogLevel: logger.DEBUG,
|
LogLevel: logger.DEBUG,
|
||||||
OnStartup: app.startup,
|
OnStartup: app.startup,
|
||||||
|
@ -35,18 +35,18 @@ HideWindowOnClose: false,
|
|||||||
RGBA: 0x000000FF,
|
RGBA: 0x000000FF,
|
||||||
Assets: assets,
|
Assets: assets,
|
||||||
Windows: &windows.Options{
|
Windows: &windows.Options{
|
||||||
WebviewIsTransparent: true,
|
WebviewIsTransparent: true,
|
||||||
WindowBackgroundIsTranslucent: true,
|
WindowIsTranslucent: true,
|
||||||
DisableWindowIcon: true,
|
DisableWindowIcon: true,
|
||||||
},
|
},
|
||||||
LogLevel: logger.DEBUG,
|
LogLevel: logger.DEBUG,
|
||||||
OnStartup: app.startup,
|
OnStartup: app.startup,
|
||||||
OnShutdown: app.shutdown,
|
OnShutdown: app.shutdown,
|
||||||
Bind: []interface{}{
|
Bind: []interface{}{
|
||||||
app,
|
app,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,12 +32,12 @@ func main() {
|
|||||||
Frameless: false,
|
Frameless: false,
|
||||||
StartHidden: false,
|
StartHidden: false,
|
||||||
HideWindowOnClose: false,
|
HideWindowOnClose: false,
|
||||||
RGBA: 0x000000FF,
|
RGBA: &options.RGBA{0, 0, 0, 255},
|
||||||
Assets: assets,
|
Assets: assets,
|
||||||
Windows: &windows.Options{
|
Windows: &windows.Options{
|
||||||
WebviewIsTransparent: false,
|
WebviewIsTransparent: false,
|
||||||
WindowBackgroundIsTranslucent: false,
|
WindowIsTranslucent: false,
|
||||||
DisableWindowIcon: false,
|
DisableWindowIcon: false,
|
||||||
},
|
},
|
||||||
LogLevel: logger.DEBUG,
|
LogLevel: logger.DEBUG,
|
||||||
OnStartup: app.startup,
|
OnStartup: app.startup,
|
||||||
|
@ -21,7 +21,7 @@ require (
|
|||||||
github.com/leaanthony/debme v1.2.1
|
github.com/leaanthony/debme v1.2.1
|
||||||
github.com/leaanthony/go-ansi-parser v1.0.1
|
github.com/leaanthony/go-ansi-parser v1.0.1
|
||||||
github.com/leaanthony/go-common-file-dialog v1.0.3
|
github.com/leaanthony/go-common-file-dialog v1.0.3
|
||||||
github.com/leaanthony/go-webview2 v0.0.0-20210912034341-849718dc22d7
|
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934
|
||||||
github.com/leaanthony/gosod v1.0.1
|
github.com/leaanthony/gosod v1.0.1
|
||||||
github.com/leaanthony/idgen v1.0.0
|
github.com/leaanthony/idgen v1.0.0
|
||||||
github.com/leaanthony/slicer v1.5.0
|
github.com/leaanthony/slicer v1.5.0
|
||||||
|
@ -125,8 +125,8 @@ github.com/leaanthony/go-ansi-parser v1.0.1 h1:97v6c5kYppVsbScf4r/VZdXyQ21KQIfeQ
|
|||||||
github.com/leaanthony/go-ansi-parser v1.0.1/go.mod h1:7arTzgVI47srICYhvgUV4CGd063sGEeoSlych5yeSPM=
|
github.com/leaanthony/go-ansi-parser v1.0.1/go.mod h1:7arTzgVI47srICYhvgUV4CGd063sGEeoSlych5yeSPM=
|
||||||
github.com/leaanthony/go-common-file-dialog v1.0.3 h1:O0uGjKnWtdEADGrkg+TyAAbZylykMwwx/MNEXn9fp+Y=
|
github.com/leaanthony/go-common-file-dialog v1.0.3 h1:O0uGjKnWtdEADGrkg+TyAAbZylykMwwx/MNEXn9fp+Y=
|
||||||
github.com/leaanthony/go-common-file-dialog v1.0.3/go.mod h1:TGhEc9eSJgRsupZ+iH1ZgAOnEo9zp05cRH2j08RPrF0=
|
github.com/leaanthony/go-common-file-dialog v1.0.3/go.mod h1:TGhEc9eSJgRsupZ+iH1ZgAOnEo9zp05cRH2j08RPrF0=
|
||||||
github.com/leaanthony/go-webview2 v0.0.0-20210912034341-849718dc22d7 h1:8IvKTQk33VBpncfgezD6BKutv5kCSZbDIcCNHOT9T4w=
|
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934 h1:nK/JTPyJi5QRqYjVZjXgtN4/dhg2qtngoLxLDVn429k=
|
||||||
github.com/leaanthony/go-webview2 v0.0.0-20210912034341-849718dc22d7/go.mod h1:lS5ds4bruPk9d7lzdF/OH31Z0YCerI6MmHNFGsWoUnM=
|
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934/go.mod h1:lS5ds4bruPk9d7lzdF/OH31Z0YCerI6MmHNFGsWoUnM=
|
||||||
github.com/leaanthony/gosod v1.0.1 h1:F+4c3DmEBfigi7oAswCV2RpQ+k4DcNbhuCZUGdBHacQ=
|
github.com/leaanthony/gosod v1.0.1 h1:F+4c3DmEBfigi7oAswCV2RpQ+k4DcNbhuCZUGdBHacQ=
|
||||||
github.com/leaanthony/gosod v1.0.1/go.mod h1:W8RyeSFBXu7RpIxPGEJfW4moSyGGEjlJMLV25wEbAdU=
|
github.com/leaanthony/gosod v1.0.1/go.mod h1:W8RyeSFBXu7RpIxPGEJfW4moSyGGEjlJMLV25wEbAdU=
|
||||||
github.com/leaanthony/idgen v1.0.0 h1:IZreR+JGEzFV4yeVuBZA25gM0keUoFy+RDUldncQ+Jw=
|
github.com/leaanthony/idgen v1.0.0 h1:IZreR+JGEzFV4yeVuBZA25gM0keUoFy+RDUldncQ+Jw=
|
||||||
|
@ -46,7 +46,7 @@ extern void UpdateTrayMenuLabel(struct Application*, const char* JSON);
|
|||||||
extern void AddContextMenu(struct Application*, char *contextMenuJSON);
|
extern void AddContextMenu(struct Application*, char *contextMenuJSON);
|
||||||
extern void UpdateContextMenu(struct Application*, char *contextMenuJSON);
|
extern void UpdateContextMenu(struct Application*, char *contextMenuJSON);
|
||||||
extern void WebviewIsTransparent(struct Application*);
|
extern void WebviewIsTransparent(struct Application*);
|
||||||
extern void WindowBackgroundIsTranslucent(struct Application*);
|
extern void WindowIsTranslucent(struct Application*);
|
||||||
extern void* GetWindowHandle(struct Application*);
|
extern void* GetWindowHandle(struct Application*);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -135,7 +135,7 @@ struct Application {
|
|||||||
int fullSizeContent;
|
int fullSizeContent;
|
||||||
int useToolBar;
|
int useToolBar;
|
||||||
int hideToolbarSeparator;
|
int hideToolbarSeparator;
|
||||||
int windowBackgroundIsTranslucent;
|
int WindowIsTranslucent;
|
||||||
int hasURLHandlers;
|
int hasURLHandlers;
|
||||||
const char *startupURL;
|
const char *startupURL;
|
||||||
|
|
||||||
@ -293,8 +293,8 @@ void Show(struct Application *app) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowBackgroundIsTranslucent(struct Application *app) {
|
void WindowIsTranslucent(struct Application *app) {
|
||||||
app->windowBackgroundIsTranslucent = 1;
|
app->WindowIsTranslucent = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sends messages to the backend
|
// Sends messages to the backend
|
||||||
@ -1534,7 +1534,7 @@ void Run(struct Application *app, int argc, char **argv) {
|
|||||||
applyWindowColour(app);
|
applyWindowColour(app);
|
||||||
|
|
||||||
// Process translucency
|
// Process translucency
|
||||||
if (app->windowBackgroundIsTranslucent) {
|
if (app->WindowIsTranslucent) {
|
||||||
makeWindowBackgroundTranslucent(app);
|
makeWindowBackgroundTranslucent(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1775,7 +1775,7 @@ void* NewApplication(const char *title, int width, int height, int resizable, in
|
|||||||
result->useToolBar = 0;
|
result->useToolBar = 0;
|
||||||
result->hideToolbarSeparator = 0;
|
result->hideToolbarSeparator = 0;
|
||||||
result->appearance = NULL;
|
result->appearance = NULL;
|
||||||
result->windowBackgroundIsTranslucent = 0;
|
result->WindowIsTranslucent = 0;
|
||||||
|
|
||||||
// Window data
|
// Window data
|
||||||
result->delegate = NULL;
|
result->delegate = NULL;
|
||||||
|
@ -57,8 +57,8 @@ func (a *Application) processPlatformSettings() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if window should be translucent
|
// Check if window should be translucent
|
||||||
if mac.WindowBackgroundIsTranslucent {
|
if mac.WindowIsTranslucent {
|
||||||
C.WindowBackgroundIsTranslucent(a.app)
|
C.WindowIsTranslucent(a.app)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process menu
|
// Process menu
|
||||||
|
@ -138,7 +138,7 @@ void HideToolbarSeparator(struct Application* app);
|
|||||||
void DisableFrame(struct Application* app);
|
void DisableFrame(struct Application* app);
|
||||||
void SetAppearance(struct Application* app, const char *);
|
void SetAppearance(struct Application* app, const char *);
|
||||||
void WebviewIsTransparent(struct Application* app);
|
void WebviewIsTransparent(struct Application* app);
|
||||||
void WindowBackgroundIsTranslucent(struct Application* app);
|
void WindowIsTranslucent(struct Application* app);
|
||||||
void SetTray(struct Application* app, const char *, const char *, const char *);
|
void SetTray(struct Application* app, const char *, const char *, const char *);
|
||||||
//void SetContextMenus(struct Application* app, const char *);
|
//void SetContextMenus(struct Application* app, const char *);
|
||||||
void AddTrayMenu(struct Application* app, const char *);
|
void AddTrayMenu(struct Application* app, const char *);
|
||||||
|
@ -862,7 +862,7 @@ void UpdateTrayMenuLabel(struct Application* app, const char* JSON) {}
|
|||||||
void AddContextMenu(struct Application* app, char *contextMenuJSON) {}
|
void AddContextMenu(struct Application* app, char *contextMenuJSON) {}
|
||||||
void UpdateContextMenu(struct Application* app, char *contextMenuJSON) {}
|
void UpdateContextMenu(struct Application* app, char *contextMenuJSON) {}
|
||||||
void WebviewIsTransparent(struct Application* app) {}
|
void WebviewIsTransparent(struct Application* app) {}
|
||||||
void WindowBackgroundIsTranslucent(struct Application* app) {}
|
void WindowIsTranslucent(struct Application* app) {}
|
||||||
void OpenDialog(struct Application* app, char *callbackID, char *title, char *filters, char *defaultFilename, char *defaultDir, int allowFiles, int allowDirs, int allowMultiple, int showHiddenFiles, int canCreateDirectories, int resolvesAliases, int treatPackagesAsDirectories) {}
|
void OpenDialog(struct Application* app, char *callbackID, char *title, char *filters, char *defaultFilename, char *defaultDir, int allowFiles, int allowDirs, int allowMultiple, int showHiddenFiles, int canCreateDirectories, int resolvesAliases, int treatPackagesAsDirectories) {}
|
||||||
void SaveDialog(struct Application* app, char *callbackID, char *title, char *filters, char *defaultFilename, char *defaultDir, int showHiddenFiles, int canCreateDirectories, int treatPackagesAsDirectories) {}
|
void SaveDialog(struct Application* app, char *callbackID, char *title, char *filters, char *defaultFilename, char *defaultDir, int showHiddenFiles, int canCreateDirectories, int treatPackagesAsDirectories) {}
|
||||||
void MessageDialog(struct Application* app, char *callbackID, char *type, char *title, char *message, char *icon, char *button1, char *button2, char *button3, char *button4, char *defaultButton, char *cancelButton) {}
|
void MessageDialog(struct Application* app, char *callbackID, char *type, char *title, char *message, char *icon, char *button1, char *button2, char *button3, char *button4, char *defaultButton, char *cancelButton) {}
|
||||||
|
@ -105,7 +105,7 @@ struct Application *NewApplication(const char *title, int width, int height, int
|
|||||||
result->logLevel = logLevel;
|
result->logLevel = logLevel;
|
||||||
result->hideWindowOnClose = hideWindowOnClose;
|
result->hideWindowOnClose = hideWindowOnClose;
|
||||||
result->webviewIsTranparent = false;
|
result->webviewIsTranparent = false;
|
||||||
result->windowBackgroundIsTranslucent = false;
|
result->WindowIsTranslucent = false;
|
||||||
result->disableWindowIcon = false;
|
result->disableWindowIcon = false;
|
||||||
|
|
||||||
// Min/Max Width/Height
|
// Min/Max Width/Height
|
||||||
@ -465,7 +465,7 @@ bool initWebView2(struct Application *app, int debugEnabled, messageCallback cb)
|
|||||||
wvColor.G = app->backgroundColour.G;
|
wvColor.G = app->backgroundColour.G;
|
||||||
wvColor.B = app->backgroundColour.B;
|
wvColor.B = app->backgroundColour.B;
|
||||||
wvColor.A = app->backgroundColour.A == 0 ? 0 : 255;
|
wvColor.A = app->backgroundColour.A == 0 ? 0 : 255;
|
||||||
if( app->windowBackgroundIsTranslucent ) {
|
if( app->WindowIsTranslucent ) {
|
||||||
wvColor.A = 0;
|
wvColor.A = 0;
|
||||||
}
|
}
|
||||||
HRESULT result = wc2->put_DefaultBackgroundColor(wvColor);
|
HRESULT result = wc2->put_DefaultBackgroundColor(wvColor);
|
||||||
@ -538,7 +538,7 @@ void Run(struct Application* app, int argc, char **argv) {
|
|||||||
|
|
||||||
// Configure translucency
|
// Configure translucency
|
||||||
DWORD dwExStyle = 0;
|
DWORD dwExStyle = 0;
|
||||||
if ( app->windowBackgroundIsTranslucent) {
|
if ( app->WindowIsTranslucent) {
|
||||||
dwExStyle = WS_EX_NOREDIRECTIONBITMAP;
|
dwExStyle = WS_EX_NOREDIRECTIONBITMAP;
|
||||||
wc.hbrBackground = CreateSolidBrush(RGB(255,255,255));
|
wc.hbrBackground = CreateSolidBrush(RGB(255,255,255));
|
||||||
}
|
}
|
||||||
@ -590,7 +590,7 @@ void Run(struct Application* app, int argc, char **argv) {
|
|||||||
SetWindowPos(nullptr, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
|
SetWindowPos(nullptr, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( app->windowBackgroundIsTranslucent ) {
|
if ( app->WindowIsTranslucent ) {
|
||||||
|
|
||||||
// Enable the translucent background effect
|
// Enable the translucent background effect
|
||||||
enableTranslucentBackground(app);
|
enableTranslucentBackground(app);
|
||||||
@ -877,8 +877,8 @@ void WebviewIsTransparent(struct Application *app) {
|
|||||||
app->webviewIsTranparent = true;
|
app->webviewIsTranparent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowBackgroundIsTranslucent(struct Application *app) {
|
void WindowIsTranslucent(struct Application *app) {
|
||||||
app->windowBackgroundIsTranslucent = true;
|
app->WindowIsTranslucent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ func (a *Application) processPlatformSettings() error {
|
|||||||
C.WebviewIsTransparent(a.app)
|
C.WebviewIsTransparent(a.app)
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.WindowBackgroundIsTranslucent {
|
if config.WindowIsTranslucent {
|
||||||
C.WindowBackgroundIsTranslucent(a.app)
|
C.WindowIsTranslucent(a.app)
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.DisableWindowIcon {
|
if config.DisableWindowIcon {
|
||||||
|
@ -43,7 +43,7 @@ struct Application{
|
|||||||
int frame;
|
int frame;
|
||||||
char *startupURL;
|
char *startupURL;
|
||||||
bool webviewIsTranparent;
|
bool webviewIsTranparent;
|
||||||
bool windowBackgroundIsTranslucent;
|
bool WindowIsTranslucent;
|
||||||
COREWEBVIEW2_COLOR backgroundColour;
|
COREWEBVIEW2_COLOR backgroundColour;
|
||||||
bool disableWindowIcon;
|
bool disableWindowIcon;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/leaanthony/slicer"
|
||||||
"log"
|
"log"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -42,8 +43,6 @@ type Frontend struct {
|
|||||||
servingFromDisk bool
|
servingFromDisk bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.Logger, appBindings *binding.Bindings, dispatcher frontend.Dispatcher) *Frontend {
|
func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.Logger, appBindings *binding.Bindings, dispatcher frontend.Dispatcher) *Frontend {
|
||||||
|
|
||||||
result := &Frontend{
|
result := &Frontend{
|
||||||
@ -241,14 +240,24 @@ func (f *Frontend) Quit() {
|
|||||||
winc.Exit()
|
winc.Exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
ctrlZ int = 90
|
||||||
|
ctrlX = 88
|
||||||
|
ctrlC = 67
|
||||||
|
ctrlV = 86
|
||||||
|
)
|
||||||
|
|
||||||
func (f *Frontend) setupChromium() {
|
func (f *Frontend) setupChromium() {
|
||||||
chromium := edge.NewChromium()
|
chromium := edge.NewChromium()
|
||||||
f.chromium = chromium
|
f.chromium = chromium
|
||||||
chromium.MessageCallback = f.processMessage
|
chromium.MessageCallback = f.processMessage
|
||||||
chromium.WebResourceRequestedCallback = f.processRequest
|
chromium.WebResourceRequestedCallback = f.processRequest
|
||||||
chromium.NavigationCompletedCallback = f.navigationCompleted
|
chromium.NavigationCompletedCallback = f.navigationCompleted
|
||||||
chromium.AcceleratorKeyCallback = func(_ uint) {
|
|
||||||
// TODO: Link to standard application shortcuts
|
acceleratorsWebviewShouldProcess := slicer.Int([]int{ctrlV, ctrlC, ctrlX, ctrlZ})
|
||||||
|
chromium.AcceleratorKeyCallback = func(vkey uint) bool {
|
||||||
|
// We want webview to handle ctrl-C, ctrl-Z, ctrl-v, ctrl-x
|
||||||
|
return !acceleratorsWebviewShouldProcess.Contains(int(vkey))
|
||||||
}
|
}
|
||||||
chromium.Embed(f.mainWindow.Handle())
|
chromium.Embed(f.mainWindow.Handle())
|
||||||
chromium.Resize()
|
chromium.Resize()
|
||||||
|
@ -26,7 +26,7 @@ func NewWindow(parent winc.Controller, options *options.App) *Window {
|
|||||||
var exStyle int
|
var exStyle int
|
||||||
if options.Windows != nil {
|
if options.Windows != nil {
|
||||||
exStyle = w32.WS_EX_CONTROLPARENT | w32.WS_EX_APPWINDOW
|
exStyle = w32.WS_EX_CONTROLPARENT | w32.WS_EX_APPWINDOW
|
||||||
if options.Windows.WindowBackgroundIsTranslucent {
|
if options.Windows.WindowIsTranslucent {
|
||||||
exStyle |= w32.WS_EX_NOREDIRECTIONBITMAP
|
exStyle |= w32.WS_EX_NOREDIRECTIONBITMAP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ func NewWindow(parent winc.Controller, options *options.App) *Window {
|
|||||||
result.SetMaxSize(options.MaxWidth, options.MaxHeight)
|
result.SetMaxSize(options.MaxWidth, options.MaxHeight)
|
||||||
|
|
||||||
if options.Windows != nil {
|
if options.Windows != nil {
|
||||||
if options.Windows.WindowBackgroundIsTranslucent {
|
if options.Windows.WindowIsTranslucent {
|
||||||
result.SetTranslucentBackground()
|
result.SetTranslucentBackground()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,10 +10,10 @@ const (
|
|||||||
|
|
||||||
// Options are options specific to Mac
|
// Options are options specific to Mac
|
||||||
type Options struct {
|
type Options struct {
|
||||||
TitleBar *TitleBar
|
TitleBar *TitleBar
|
||||||
Appearance AppearanceType
|
Appearance AppearanceType
|
||||||
WebviewIsTransparent bool
|
WebviewIsTransparent bool
|
||||||
WindowBackgroundIsTranslucent bool
|
WindowIsTranslucent bool
|
||||||
ActivationPolicy ActivationPolicy
|
ActivationPolicy ActivationPolicy
|
||||||
URLHandlers map[string]func(string)
|
URLHandlers map[string]func(string)
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package windows
|
|||||||
|
|
||||||
// Options are options specific to Windows
|
// Options are options specific to Windows
|
||||||
type Options struct {
|
type Options struct {
|
||||||
WebviewIsTransparent bool
|
WebviewIsTransparent bool
|
||||||
WindowBackgroundIsTranslucent bool
|
WindowIsTranslucent bool
|
||||||
DisableWindowIcon bool
|
DisableWindowIcon bool
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user