mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
Stubs in place to compile
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
package features
|
||||
|
||||
// Features holds generic and platform specific feature flags
|
||||
type Features struct {
|
||||
Linux *Linux
|
||||
}
|
||||
|
||||
// New creates a new Features object
|
||||
func New() *Features {
|
||||
return &Features{
|
||||
Linux: &Linux{},
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
package features
|
||||
|
||||
// Linux holds linux specific feature flags
|
||||
type Linux struct {
|
||||
type Features struct {
|
||||
}
|
||||
|
||||
// New creates a new Features object
|
||||
func New() *Features {
|
||||
return &Features{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package ffenestri
|
||||
|
||||
/*
|
||||
|
||||
#cgo darwin CFLAGS: -DFFENESTRI_DARWIN=1
|
||||
#cgo darwin LDFLAGS: -framework WebKit -lobjc
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "ffenestri.h"
|
||||
|
||||
|
||||
*/
|
||||
import "C"
|
||||
import "github.com/wailsapp/wails/v2/internal/features"
|
||||
|
||||
func (a *Application) processOSFeatureFlags(features *features.Features) {
|
||||
|
||||
}
|
||||
@@ -21,7 +21,6 @@
|
||||
#define NSResizableWindowMask 8
|
||||
|
||||
// References to assets
|
||||
extern const unsigned char userhtml;
|
||||
extern const unsigned char *assets[];
|
||||
extern const unsigned char runtime;
|
||||
extern const char *icon[];
|
||||
@@ -370,6 +369,22 @@ gboolean executeMethod(gpointer data) {
|
||||
}
|
||||
*/
|
||||
|
||||
// DisableFrame disables the window frame
|
||||
void DisableFrame(void *appPointer)
|
||||
{
|
||||
// TBD
|
||||
}
|
||||
|
||||
void SetMinWindowSize(void *appPointer, int minWidth, int minHeight)
|
||||
{
|
||||
// TBD
|
||||
}
|
||||
|
||||
void SetMaxWindowSize(void *appPointer, int maxWidth, int maxHeight)
|
||||
{
|
||||
// TBD
|
||||
}
|
||||
|
||||
void ExecJS(void *appPointer, char *js) {
|
||||
Debug("ExecJS Called: %s", js);
|
||||
struct Application *app = (struct Application*) appPointer;
|
||||
@@ -711,7 +726,7 @@ void Run(void *applicationPointer, int argc, char **argv) {
|
||||
msg(mainWindow, s("makeKeyAndOrderFront:"), NULL);
|
||||
|
||||
// Load HTML
|
||||
id html = msg(c("NSURL"), s("URLWithString:"), msg(c("NSString"), s("stringWithUTF8String:"), &userhtml));
|
||||
id html = msg(c("NSURL"), s("URLWithString:"), msg(c("NSString"), s("stringWithUTF8String:"), assets[0]));
|
||||
Debug("HTML: %p", html);
|
||||
msg(wkwebview, s("loadRequest:"), msg(c("NSURLRequest"), s("requestWithURL:"), html));
|
||||
|
||||
@@ -720,7 +735,7 @@ void Run(void *applicationPointer, int argc, char **argv) {
|
||||
Debug("Loading Internal Code");
|
||||
// We want to evaluate the internal code plus runtime before the assets
|
||||
const char *temp = concat(invoke, app->bindings);
|
||||
const char *internalCode = concat(temp, &runtime);
|
||||
const char *internalCode = concat(temp, (const char*)&runtime);
|
||||
Debug("Internal code: %s", internalCode);
|
||||
free((void*)temp);
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -160,9 +160,9 @@ func (a *AssetBundle) WriteToCFile(targetDir string) (string, error) {
|
||||
}
|
||||
|
||||
if assetVariables.Length() > 0 {
|
||||
cdata.WriteString(fmt.Sprintf("\nconst char *assets[] = { %s, 0x00 };", assetVariables.Join(", ")))
|
||||
cdata.WriteString(fmt.Sprintf("\nconst unsigned char *assets[] = { %s, 0x00 };", assetVariables.Join(", ")))
|
||||
} else {
|
||||
cdata.WriteString("\nconst char *assets[] = { 0x00 };")
|
||||
cdata.WriteString("\nconst unsigned char *assets[] = { 0x00 };")
|
||||
}
|
||||
|
||||
// Save file
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
_ __ _ __
|
||||
| | / /___ _(_) /____
|
||||
| | /| / / __ `/ / / ___/
|
||||
| |/ |/ / /_/ / / (__ )
|
||||
|__/|__/\__,_/_/_/____/
|
||||
The lightweight framework for web-like apps
|
||||
(c) Lea Anthony 2019-present
|
||||
*/
|
||||
/* jshint esversion: 6 */
|
||||
|
||||
/**
|
||||
* Initialises platform specific code
|
||||
*/
|
||||
|
||||
export const System = {
|
||||
Platform: "darwin",
|
||||
AppType: "desktop"
|
||||
}
|
||||
|
||||
export function SendMessage(message) {
|
||||
window.webkit.messageHandlers.external.postMessage(message);
|
||||
}
|
||||
|
||||
export function Init() {
|
||||
|
||||
// Setup drag handler
|
||||
// Based on code from: https://github.com/patr0nus/DeskGap
|
||||
window.addEventListener('mousedown', function (e) {
|
||||
var currentElement = e.target;
|
||||
while (currentElement != null) {
|
||||
if (currentElement.hasAttribute('data-wails-no-drag')) {
|
||||
break;
|
||||
} else if (currentElement.hasAttribute('data-wails-drag')) {
|
||||
window.webkit.messageHandlers.windowDrag.postMessage(null);
|
||||
break;
|
||||
}
|
||||
currentElement = currentElement.parentElement;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -59,7 +59,7 @@ func Build(options *Options) (string, error) {
|
||||
}
|
||||
|
||||
// Check platform
|
||||
validPlatforms := slicer.String([]string{"linux"})
|
||||
validPlatforms := slicer.String([]string{"linux", "darwin"})
|
||||
if !validPlatforms.Contains(options.Platform) {
|
||||
return "", fmt.Errorf("platform %s not supported", options.Platform)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user