Stubs in place to compile

This commit is contained in:
Lea Anthony
2020-09-15 19:55:51 -05:00
committed by Travis McLane
parent 852bbd148c
commit e831bc75c6
9 changed files with 93 additions and 11 deletions
@@ -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{},
}
}
+7 -2
View File
@@ -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{
}
}
+18
View File
@@ -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) {
}
+18 -3
View File
@@ -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
+2 -2
View File
@@ -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
+41
View File
@@ -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;
}
});
}
+1 -1
View File
@@ -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)
}