diff --git a/attic/webview/.clang-format b/attic/webview/.clang-format
new file mode 100644
index 000000000..5dad5a60a
--- /dev/null
+++ b/attic/webview/.clang-format
@@ -0,0 +1,111 @@
+---
+Language: Cpp
+# BasedOnStyle: LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Right
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+ AfterClass: false
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: false
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: false
+ AfterUnion: false
+ AfterExternBlock: false
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: false
+ SplitEmptyFunction: true
+ SplitEmptyRecord: true
+ SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Attach
+BreakBeforeInheritanceComma: false
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeColon
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: true
+ColumnLimit: 80
+CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
+IncludeBlocks: Preserve
+IncludeCategories:
+ - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
+ Priority: 2
+ - Regex: '^(<|"(gtest|gmock|isl|json)/)'
+ Priority: 3
+ - Regex: '.*'
+ Priority: 1
+IncludeIsMainRegex: '(Test)?$'
+IndentCaseLabels: false
+IndentPPDirectives: None
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+ReflowComments: true
+SortIncludes: true
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 8
+UseTab: Never
+...
+
diff --git a/attic/webview/.clang-tidy b/attic/webview/.clang-tidy
new file mode 100644
index 000000000..cc8f6eb3d
--- /dev/null
+++ b/attic/webview/.clang-tidy
@@ -0,0 +1,256 @@
+---
+Checks: 'clang-diagnostic-*,clang-analyzer-*,*'
+HeaderFilterRegex: ''
+AnalyzeTemporaryDtors: false
+User: serge
+CheckOptions:
+ - key: bugprone-argument-comment.StrictMode
+ value: '0'
+ - key: bugprone-assert-side-effect.AssertMacros
+ value: assert
+ - key: bugprone-assert-side-effect.CheckFunctionCalls
+ value: '0'
+ - key: bugprone-dangling-handle.HandleClasses
+ value: 'std::basic_string_view;std::experimental::basic_string_view'
+ - key: bugprone-string-constructor.LargeLengthThreshold
+ value: '8388608'
+ - key: bugprone-string-constructor.WarnOnLargeLength
+ value: '1'
+ - key: cert-dcl59-cpp.HeaderFileExtensions
+ value: ',h,hh,hpp,hxx'
+ - key: cert-err09-cpp.CheckThrowTemporaries
+ value: '1'
+ - key: cert-err61-cpp.CheckThrowTemporaries
+ value: '1'
+ - key: cert-oop11-cpp.IncludeStyle
+ value: llvm
+ - key: cppcoreguidelines-no-malloc.Allocations
+ value: '::malloc;::calloc'
+ - key: cppcoreguidelines-no-malloc.Deallocations
+ value: '::free'
+ - key: cppcoreguidelines-no-malloc.Reallocations
+ value: '::realloc'
+ - key: cppcoreguidelines-owning-memory.LegacyResourceConsumers
+ value: '::free;::realloc;::freopen;::fclose'
+ - key: cppcoreguidelines-owning-memory.LegacyResourceProducers
+ value: '::malloc;::aligned_alloc;::realloc;::calloc;::fopen;::freopen;::tmpfile'
+ - key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader
+ value: ''
+ - key: cppcoreguidelines-pro-bounds-constant-array-index.IncludeStyle
+ value: '0'
+ - key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
+ value: '0'
+ - key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions
+ value: '0'
+ - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
+ value: '0'
+ - key: google-build-namespaces.HeaderFileExtensions
+ value: ',h,hh,hpp,hxx'
+ - key: google-global-names-in-headers.HeaderFileExtensions
+ value: ',h,hh,hpp,hxx'
+ - key: google-readability-braces-around-statements.ShortStatementLines
+ value: '1'
+ - key: google-readability-function-size.BranchThreshold
+ value: '4294967295'
+ - key: google-readability-function-size.LineThreshold
+ value: '4294967295'
+ - key: google-readability-function-size.NestingThreshold
+ value: '4294967295'
+ - key: google-readability-function-size.ParameterThreshold
+ value: '4294967295'
+ - key: google-readability-function-size.StatementThreshold
+ value: '800'
+ - key: google-readability-namespace-comments.ShortNamespaceLines
+ value: '10'
+ - key: google-readability-namespace-comments.SpacesBeforeComments
+ value: '2'
+ - key: google-runtime-int.SignedTypePrefix
+ value: int
+ - key: google-runtime-int.TypeSuffix
+ value: ''
+ - key: google-runtime-int.UnsignedTypePrefix
+ value: uint
+ - key: google-runtime-references.WhiteListTypes
+ value: ''
+ - key: hicpp-braces-around-statements.ShortStatementLines
+ value: '0'
+ - key: hicpp-function-size.BranchThreshold
+ value: '4294967295'
+ - key: hicpp-function-size.LineThreshold
+ value: '4294967295'
+ - key: hicpp-function-size.NestingThreshold
+ value: '4294967295'
+ - key: hicpp-function-size.ParameterThreshold
+ value: '4294967295'
+ - key: hicpp-function-size.StatementThreshold
+ value: '800'
+ - key: hicpp-member-init.IgnoreArrays
+ value: '0'
+ - key: hicpp-move-const-arg.CheckTriviallyCopyableMove
+ value: '1'
+ - key: hicpp-named-parameter.IgnoreFailedSplit
+ value: '0'
+ - key: hicpp-no-malloc.Allocations
+ value: '::malloc;::calloc'
+ - key: hicpp-no-malloc.Deallocations
+ value: '::free'
+ - key: hicpp-no-malloc.Reallocations
+ value: '::realloc'
+ - key: hicpp-special-member-functions.AllowMissingMoveFunctions
+ value: '0'
+ - key: hicpp-special-member-functions.AllowSoleDefaultDtor
+ value: '0'
+ - key: hicpp-use-auto.RemoveStars
+ value: '0'
+ - key: hicpp-use-emplace.ContainersWithPushBack
+ value: '::std::vector;::std::list;::std::deque'
+ - key: hicpp-use-emplace.SmartPointers
+ value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr'
+ - key: hicpp-use-emplace.TupleMakeFunctions
+ value: '::std::make_pair;::std::make_tuple'
+ - key: hicpp-use-emplace.TupleTypes
+ value: '::std::pair;::std::tuple'
+ - key: hicpp-use-equals-default.IgnoreMacros
+ value: '1'
+ - key: hicpp-use-noexcept.ReplacementString
+ value: ''
+ - key: hicpp-use-noexcept.UseNoexceptFalse
+ value: '1'
+ - key: hicpp-use-nullptr.NullMacros
+ value: ''
+ - key: llvm-namespace-comment.ShortNamespaceLines
+ value: '1'
+ - key: llvm-namespace-comment.SpacesBeforeComments
+ value: '1'
+ - key: misc-definitions-in-headers.HeaderFileExtensions
+ value: ',h,hh,hpp,hxx'
+ - key: misc-definitions-in-headers.UseHeaderFileExtension
+ value: '1'
+ - key: misc-misplaced-widening-cast.CheckImplicitCasts
+ value: '0'
+ - key: misc-sizeof-expression.WarnOnSizeOfCompareToConstant
+ value: '1'
+ - key: misc-sizeof-expression.WarnOnSizeOfConstant
+ value: '1'
+ - key: misc-sizeof-expression.WarnOnSizeOfThis
+ value: '1'
+ - key: misc-suspicious-enum-usage.StrictMode
+ value: '0'
+ - key: misc-suspicious-missing-comma.MaxConcatenatedTokens
+ value: '5'
+ - key: misc-suspicious-missing-comma.RatioThreshold
+ value: '0.200000'
+ - key: misc-suspicious-missing-comma.SizeThreshold
+ value: '5'
+ - key: misc-suspicious-string-compare.StringCompareLikeFunctions
+ value: ''
+ - key: misc-suspicious-string-compare.WarnOnImplicitComparison
+ value: '1'
+ - key: misc-suspicious-string-compare.WarnOnLogicalNotComparison
+ value: '0'
+ - key: misc-throw-by-value-catch-by-reference.CheckThrowTemporaries
+ value: '1'
+ - key: modernize-loop-convert.MaxCopySize
+ value: '16'
+ - key: modernize-loop-convert.MinConfidence
+ value: reasonable
+ - key: modernize-loop-convert.NamingStyle
+ value: CamelCase
+ - key: modernize-make-shared.IgnoreMacros
+ value: '1'
+ - key: modernize-make-shared.IncludeStyle
+ value: '0'
+ - key: modernize-make-shared.MakeSmartPtrFunction
+ value: 'std::make_shared'
+ - key: modernize-make-shared.MakeSmartPtrFunctionHeader
+ value: memory
+ - key: modernize-make-unique.IgnoreMacros
+ value: '1'
+ - key: modernize-make-unique.IncludeStyle
+ value: '0'
+ - key: modernize-make-unique.MakeSmartPtrFunction
+ value: 'std::make_unique'
+ - key: modernize-make-unique.MakeSmartPtrFunctionHeader
+ value: memory
+ - key: modernize-pass-by-value.IncludeStyle
+ value: llvm
+ - key: modernize-pass-by-value.ValuesOnly
+ value: '0'
+ - key: modernize-raw-string-literal.ReplaceShorterLiterals
+ value: '0'
+ - key: modernize-replace-auto-ptr.IncludeStyle
+ value: llvm
+ - key: modernize-replace-random-shuffle.IncludeStyle
+ value: llvm
+ - key: modernize-use-auto.RemoveStars
+ value: '0'
+ - key: modernize-use-default-member-init.IgnoreMacros
+ value: '1'
+ - key: modernize-use-default-member-init.UseAssignment
+ value: '0'
+ - key: modernize-use-emplace.ContainersWithPushBack
+ value: '::std::vector;::std::list;::std::deque'
+ - key: modernize-use-emplace.SmartPointers
+ value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr'
+ - key: modernize-use-emplace.TupleMakeFunctions
+ value: '::std::make_pair;::std::make_tuple'
+ - key: modernize-use-emplace.TupleTypes
+ value: '::std::pair;::std::tuple'
+ - key: modernize-use-equals-default.IgnoreMacros
+ value: '1'
+ - key: modernize-use-noexcept.ReplacementString
+ value: ''
+ - key: modernize-use-noexcept.UseNoexceptFalse
+ value: '1'
+ - key: modernize-use-nullptr.NullMacros
+ value: 'NULL'
+ - key: modernize-use-transparent-functors.SafeMode
+ value: '0'
+ - key: modernize-use-using.IgnoreMacros
+ value: '1'
+ - key: objc-forbidden-subclassing.ForbiddenSuperClassNames
+ value: 'ABNewPersonViewController;ABPeoplePickerNavigationController;ABPersonViewController;ABUnknownPersonViewController;NSHashTable;NSMapTable;NSPointerArray;NSPointerFunctions;NSTimer;UIActionSheet;UIAlertView;UIImagePickerController;UITextInputMode;UIWebView'
+ - key: objc-property-declaration.Acronyms
+ value: 'ASCII;PDF;XML;HTML;URL;RTF;HTTP;TIFF;JPG;PNG;GIF;LZW;ROM;RGB;CMYK;MIDI;FTP'
+ - key: performance-faster-string-find.StringLikeClasses
+ value: 'std::basic_string'
+ - key: performance-for-range-copy.WarnOnAllAutoCopies
+ value: '0'
+ - key: performance-inefficient-string-concatenation.StrictMode
+ value: '0'
+ - key: performance-inefficient-vector-operation.VectorLikeClasses
+ value: '::std::vector'
+ - key: performance-move-const-arg.CheckTriviallyCopyableMove
+ value: '1'
+ - key: performance-move-constructor-init.IncludeStyle
+ value: llvm
+ - key: performance-type-promotion-in-math-fn.IncludeStyle
+ value: llvm
+ - key: performance-unnecessary-value-param.IncludeStyle
+ value: llvm
+ - key: readability-braces-around-statements.ShortStatementLines
+ value: '0'
+ - key: readability-function-size.BranchThreshold
+ value: '4294967295'
+ - key: readability-function-size.LineThreshold
+ value: '4294967295'
+ - key: readability-function-size.NestingThreshold
+ value: '4294967295'
+ - key: readability-function-size.ParameterThreshold
+ value: '4294967295'
+ - key: readability-function-size.StatementThreshold
+ value: '800'
+ - key: readability-identifier-naming.IgnoreFailedSplit
+ value: '0'
+ - key: readability-implicit-bool-conversion.AllowIntegerConditions
+ value: '0'
+ - key: readability-implicit-bool-conversion.AllowPointerConditions
+ value: '0'
+ - key: readability-simplify-boolean-expr.ChainedConditionalAssignment
+ value: '0'
+ - key: readability-simplify-boolean-expr.ChainedConditionalReturn
+ value: '0'
+ - key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold
+ value: '3'
+...
+
diff --git a/attic/webview/.gitattributes b/attic/webview/.gitattributes
new file mode 100644
index 000000000..5170675f3
--- /dev/null
+++ b/attic/webview/.gitattributes
@@ -0,0 +1 @@
+*.h linguist-language=c
diff --git a/attic/webview/.gitignore b/attic/webview/.gitignore
new file mode 100644
index 000000000..6307e1aab
--- /dev/null
+++ b/attic/webview/.gitignore
@@ -0,0 +1,7 @@
+# Build atrifacts
+/build
+/examples/minimal-go/minimal-go
+/examples/minimal/minimal
+/examples/minimal/minimal.exe
+/examples/minimal/build
+/examples/timer-cxx/build
diff --git a/attic/webview/.travis.yml b/attic/webview/.travis.yml
new file mode 100644
index 000000000..e94a7765e
--- /dev/null
+++ b/attic/webview/.travis.yml
@@ -0,0 +1,19 @@
+language: go
+
+go:
+ - 1.x
+
+matrix:
+ include:
+ - os: linux
+ before_install:
+ - sudo add-apt-repository ppa:webkit-team/ppa -y
+ - sudo apt-get update
+ - sudo apt-get install libwebkit2gtk-4.0-dev -y
+ env: WEBVIEW=gtk
+ - os: osx
+ osx_image: xcode8.3
+ env: WEBVIEW=cocoa
+
+script:
+ - make example
diff --git a/attic/webview/LICENSE b/attic/webview/LICENSE
new file mode 100644
index 000000000..b18604bf4
--- /dev/null
+++ b/attic/webview/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017 Serge Zaitsev
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/attic/webview/Makefile b/attic/webview/Makefile
new file mode 100644
index 000000000..71cdf57db
--- /dev/null
+++ b/attic/webview/Makefile
@@ -0,0 +1,28 @@
+WEBVIEW_gtk_FLAGS = -DWEBVIEW_GTK -std=c++14 -Wall -Wextra -pedantic $(shell pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0)
+WEBVIEW_cocoa_FLAGS = -DWEBVIEW_COCOA -std=c++14 -Wall -Wextra -pedantic -framework WebKit -mmacosx-version-min=10.11 -DOBJC_OLD_DISPATCH_PROTOTYPES
+WEBVIEW_mshtml_FLAGS := -DWEBVIEW_MSHTML -std=c++14 -luser32 -lole32 -loleaut32 -lcomctl32 -luuid -static
+WEBVIEW_edge_FLAGS := -DWEBVIEW_EDGE
+
+all:
+ @echo "make WEBVIEW=... test - build and run tests"
+ @echo "make WEBVIEW=... lint - run clang-tidy checkers"
+ @echo "make WEBVIEW=... fmt - run clang-format for all sources"
+
+fmt: webview.h
+ clang-format -i $^
+
+check-env:
+ifndef WEBVIEW_$(WEBVIEW)_FLAGS
+ $(error "Unknown WEBVIEW value, use WEBVIEW=gtk|cocoa|mshtml|edge")
+endif
+
+lint: check-env
+ clang-tidy example.cc -- $(WEBVIEW_$(WEBVIEW)_FLAGS)
+
+example: check-env example.cc webview.h
+ $(CXX) example.cc $(WEBVIEW_$(WEBVIEW)_FLAGS) -o example
+
+test: check-env
+ $(CXX) webview_test.cc $(WEBVIEW_$(WEBVIEW)_FLAGS) -o webview_test
+ ./webview_test
+ rm webview_test
diff --git a/attic/webview/example.cc b/attic/webview/example.cc
new file mode 100644
index 000000000..7afcc5794
--- /dev/null
+++ b/attic/webview/example.cc
@@ -0,0 +1,39 @@
+// +build ignore
+
+#include "webview.h"
+
+#ifdef _WIN32
+int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+ LPSTR lpCmdLine, int nCmdShow)
+#else
+int main()
+#endif
+{
+ webview::webview w(true, nullptr);
+ w.set_title("Example");
+ w.set_size(480, 320, true);
+ w.bind("noop", [](std::string s) -> std::string { printf("%s\n", s.c_str());return s; });
+ w.bind("add", [](std::string s) -> std::string {
+ auto a = std::stoi(webview::json_parse(s, "", 0));
+ auto b = std::stoi(webview::json_parse(s, "", 1));
+ return std::to_string(a + b);
+ });
+ w.navigate(R"(data:text/html,
+
+
+
hello
+
+
+ )");
+ w.run();
+ return 0;
+}
diff --git a/attic/webview/example/example.go b/attic/webview/example/example.go
new file mode 100644
index 000000000..d536a07cb
--- /dev/null
+++ b/attic/webview/example/example.go
@@ -0,0 +1,15 @@
+package main
+
+import (
+ "github.com/zserge/webview"
+)
+
+func main() {
+ w := webview.New(true)
+ w.Navigate("https://github.com")
+ w.SetTitle("Hello")
+ w.Dispatch(func() {
+ println("Hello dispatch")
+ })
+ w.Run()
+}
diff --git a/attic/webview/go.mod b/attic/webview/go.mod
new file mode 100644
index 000000000..487f240b9
--- /dev/null
+++ b/attic/webview/go.mod
@@ -0,0 +1,3 @@
+module github.com/zserge/webview
+
+go 1.13
diff --git a/attic/webview/webview.cc b/attic/webview/webview.cc
new file mode 100644
index 000000000..0d861df50
--- /dev/null
+++ b/attic/webview/webview.cc
@@ -0,0 +1 @@
+#include "webview.h"
diff --git a/attic/webview/webview.go b/attic/webview/webview.go
new file mode 100644
index 000000000..32595f26a
--- /dev/null
+++ b/attic/webview/webview.go
@@ -0,0 +1,138 @@
+package webview
+
+/*
+#cgo linux openbsd freebsd CXXFLAGS: -DWEBVIEW_GTK -std=c++14
+#cgo linux openbsd freebsd pkg-config: gtk+-3.0 webkit2gtk-4.0
+
+#cgo darwin CXXFLAGS: -DWEBVIEW_COCOA -std=c++14 -DOBJC_OLD_DISPATCH_PROTOTYPES
+#cgo darwin LDFLAGS: -framework WebKit
+
+#cgo windows CXXFLAGS: -DWEBVIEW_MSHTML
+#cgo windows LDFLAGS: -lole32 -lcomctl32 -loleaut32 -luuid -lgdi32
+
+#define WEBVIEW_HEADER
+#include "webview.h"
+
+#include
+#include
+
+extern void _webviewDispatchGoCallback(void *);
+static inline void _webview_dispatch_cb(webview_t w, void *arg) {
+ _webviewDispatchGoCallback(arg);
+}
+static inline void CgoWebViewDispatch(webview_t w, uintptr_t arg) {
+ webview_dispatch(w, _webview_dispatch_cb, (void *)arg);
+}
+*/
+import "C"
+import (
+ "runtime"
+ "sync"
+ "unsafe"
+)
+
+func init() {
+ // Ensure that main.main is called from the main thread
+ runtime.LockOSThread()
+}
+
+type WebView interface {
+ Run()
+ Terminate()
+ Dispatch(f func())
+ Navigate(url string)
+ SetTitle(title string)
+ Window() unsafe.Pointer
+ Init(js string)
+ Eval(js string)
+ Destroy()
+ /*
+ SetBounds(x, y, width, height int)
+ Bounds() (x, y, width, height int)
+ Bind(name string, v interface{})
+ */
+}
+
+type webview struct {
+ w C.webview_t
+}
+
+var (
+ m sync.Mutex
+ index uintptr
+ dispatch = map[uintptr]func(){}
+)
+
+func boolToInt(b bool) C.int {
+ if b {
+ return 1
+ }
+ return 0
+}
+
+func New(debug bool) WebView { return NewWindow(debug, nil) }
+
+func NewWindow(debug bool, window unsafe.Pointer) WebView {
+ w := &webview{}
+q
+ return w
+}
+
+func (w *webview) Destroy() {
+ C.webview_destroy(w.w)
+}
+
+func (w *webview) Run() {
+ C.webview_run(w.w)
+}
+
+func (w *webview) Terminate() {
+ C.webview_terminate(w.w)
+}
+
+func (w *webview) Window() unsafe.Pointer {
+ return C.webview_get_window(w.w)
+}
+
+func (w *webview) Navigate(url string) {
+ s := C.CString(url)
+ defer C.free(unsafe.Pointer(s))
+ C.webview_navigate(w.w, s)
+}
+
+func (w *webview) SetTitle(title string) {
+ s := C.CString(title)
+ defer C.free(unsafe.Pointer(s))
+ C.webview_set_title(w.w, s)
+}
+
+func (w *webview) Init(js string) {
+ s := C.CString(js)
+ defer C.free(unsafe.Pointer(s))
+ C.webview_init(w.w, s)
+}
+
+func (w *webview) Eval(js string) {
+ s := C.CString(js)
+ defer C.free(unsafe.Pointer(s))
+ C.webview_eval(w.w, s)
+}
+
+func (w *webview) Dispatch(f func()) {
+ m.Lock()
+ for ; dispatch[index] != nil; index++ {
+ }
+ dispatch[index] = f
+ m.Unlock()
+ C.CgoWebViewDispatch(w.w, C.uintptr_t(index))
+}
+
+//export _webviewDispatchGoCallback
+func _webviewDispatchGoCallback(index unsafe.Pointer) {
+ var f func()
+ m.Lock()
+ f = dispatch[uintptr(index)]
+ delete(dispatch, uintptr(index))
+ m.Unlock()
+ f()
+}
diff --git a/attic/webview/webview.h b/attic/webview/webview.h
new file mode 100644
index 000000000..7a20b9541
--- /dev/null
+++ b/attic/webview/webview.h
@@ -0,0 +1,1248 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2017 Serge Zaitsev
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef WEBVIEW_H
+#define WEBVIEW_H
+
+#ifndef WEBVIEW_API
+#define WEBVIEW_API extern
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *webview_t;
+
+// Create a new webview instance
+WEBVIEW_API webview_t webview_create(int debug, void *wnd);
+
+// Destroy a webview
+WEBVIEW_API void webview_destroy(webview_t w);
+
+// Run the main loop
+WEBVIEW_API void webview_run(webview_t w);
+
+// Stop the main loop
+WEBVIEW_API void webview_terminate(webview_t w);
+
+// Post a function to be executed on the main thread
+WEBVIEW_API void
+webview_dispatch(webview_t w, void (*fn)(webview_t w, void *arg), void *arg);
+
+WEBVIEW_API void *webview_get_window(webview_t w);
+
+WEBVIEW_API void webview_set_title(webview_t w, const char *title);
+
+WEBVIEW_API void webview_set_bounds(webview_t w, int x, int y, int width,
+ int height, int flags);
+WEBVIEW_API void webview_get_bounds(webview_t w, int *x, int *y, int *width,
+ int *height, int *flags);
+
+WEBVIEW_API void webview_navigate(webview_t w, const char *url);
+WEBVIEW_API void webview_init(webview_t w, const char *js);
+WEBVIEW_API void webview_eval(webview_t w, const char *js);
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifndef WEBVIEW_HEADER
+
+#if !defined(WEBVIEW_GTK) && !defined(WEBVIEW_COCOA) && \
+ !defined(WEBVIEW_MSHTML) && !defined(WEBVIEW_EDGE)
+#error "please, specify webview backend"
+#endif
+
+#include
+#include
+#include
+#include