Compare commits

...

2 Commits

Author SHA1 Message Date
Lea Anthony
71dc137194 fiX: unicode fixes for windows 2019-11-01 10:19:06 +11:00
Lea Anthony
13e6bd2178 fix: misc fixes 2019-11-01 10:15:21 +11:00
9 changed files with 46 additions and 32 deletions

View File

@@ -9,4 +9,4 @@
last 2 versions last 2 versions
Firefox ESR Firefox ESR
not dead not dead
not IE 9-11 # For IE 9-11 support, remove 'not'. IE 9-11 # For IE 9-11 support, remove 'not'.

View File

@@ -13,7 +13,7 @@ package webview
#cgo linux openbsd freebsd CFLAGS: -DWEBVIEW_GTK=1 -Wno-deprecated-declarations #cgo linux openbsd freebsd CFLAGS: -DWEBVIEW_GTK=1 -Wno-deprecated-declarations
#cgo linux openbsd freebsd pkg-config: gtk+-3.0 webkit2gtk-4.0 #cgo linux openbsd freebsd pkg-config: gtk+-3.0 webkit2gtk-4.0
#cgo windows CFLAGS: -DWEBVIEW_WINAPI=1 -std=c99 -DUNICODE=1 #cgo windows CFLAGS: -DWEBVIEW_WINAPI=1 -std=c99 -DUNICODE=1 -D_UNICODE=1
#cgo windows LDFLAGS: -lole32 -lcomctl32 -loleaut32 -luuid -lgdi32 #cgo windows LDFLAGS: -lole32 -lcomctl32 -loleaut32 -luuid -lgdi32
#cgo darwin CFLAGS: -DWEBVIEW_COCOA=1 -x objective-c #cgo darwin CFLAGS: -DWEBVIEW_COCOA=1 -x objective-c

View File

@@ -58,6 +58,7 @@ extern "C"
#elif defined(WEBVIEW_WINAPI) #elif defined(WEBVIEW_WINAPI)
#define CINTERFACE #define CINTERFACE
#include <windows.h> #include <windows.h>
#include <tchar.h>
#include <commctrl.h> #include <commctrl.h>
#include <exdisp.h> #include <exdisp.h>
@@ -1350,8 +1351,8 @@ struct webview_priv
} }
#define WEBVIEW_KEY_FEATURE_BROWSER_EMULATION \ #define WEBVIEW_KEY_FEATURE_BROWSER_EMULATION \
"Software\\Microsoft\\Internet " \ _T("Software\\Microsoft\\Internet " \
"Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION" "Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION")
static int webview_fix_ie_compat_mode() static int webview_fix_ie_compat_mode()
{ {
@@ -1363,7 +1364,7 @@ struct webview_priv
{ {
return -1; return -1;
} }
for (p = &appname[strlen(appname) - 1]; p != appname && *p != '\\'; p--) for (p = &appname[_tcslen(appname) - 1]; p != appname && *p != _T('\\'); p--)
{ {
} }
p++; p++;
@@ -1872,14 +1873,30 @@ struct webview_priv
type |= MB_ICONERROR; type |= MB_ICONERROR;
break; break;
} }
#ifdef UNICODE
WCHAR *wtitle = webview_to_utf16(title);
WCHAR *warg = webview_to_utf16(arg);
MessageBox(w->priv.hwnd, warg, wtitle, type);
GlobalFree(warg);
GlobalFree(wtitle);
#else
MessageBox(w->priv.hwnd, arg, title, type); MessageBox(w->priv.hwnd, arg, title, type);
#endif
#endif #endif
} }
} }
WEBVIEW_API void webview_terminate(struct webview *w) { PostQuitMessage(0); } WEBVIEW_API void webview_terminate(struct webview *w) { PostQuitMessage(0); }
WEBVIEW_API void webview_exit(struct webview *w) { OleUninitialize(); } WEBVIEW_API void webview_exit(struct webview *w) { OleUninitialize(); }
WEBVIEW_API void webview_print_log(const char *s) { OutputDebugString(s); } WEBVIEW_API void webview_print_log(const char *s) {
#ifdef UNICODE
WCHAR *ws = webview_to_utf16(s);
OutputDebugString(ws);
GlobalFree(ws);
#else
OutputDebugString(s);
#endif
}
#endif /* WEBVIEW_WINAPI */ #endif /* WEBVIEW_WINAPI */

View File

@@ -15,10 +15,7 @@
"error", "error",
"tab" "tab"
], ],
"linebreak-style": [ "linebreak-style": 0,
"error",
"unix"
],
"quotes": [ "quotes": [
"error", "error",
"single" "single"
@@ -28,4 +25,4 @@
"always" "always"
] ]
} }
} }

View File

@@ -32,6 +32,6 @@ function OpenFile(filename) {
} }
module.exports = { module.exports = {
OpenURL, OpenURL: OpenURL,
OpenFile OpenFile: OpenFile
}; };

View File

@@ -80,10 +80,10 @@ function Acknowledge(eventName) {
} }
module.exports = { module.exports = {
OnMultiple, OnMultiple: OnMultiple,
On, On: On,
Once, Once: Once,
Emit, Emit: Emit,
Heartbeat, Heartbeat: Heartbeat,
Acknowledge Acknowledge: Acknowledge
}; };

View File

@@ -62,9 +62,9 @@ function Fatal(message) {
} }
module.exports = { module.exports = {
Debug, Debug: Debug,
Info, Info: Info,
Warning, Warning: Warning,
Error, Error: Error,
Fatal Fatal: Fatal
}; };

View File

@@ -15,8 +15,8 @@ const Events = require('./events');
const Init = require('./init'); const Init = require('./init');
module.exports = { module.exports = {
Log, Log: Log,
Browser, Browser: Browser,
Events, Events: Events,
Init Init: Init
}; };

View File

@@ -1,6 +1,6 @@
{ {
"name": "@wailsapp/runtime", "name": "@wailsapp/runtime",
"version": "1.0.6", "version": "1.0.8",
"description": "Wails Javascript runtime library", "description": "Wails Javascript runtime library",
"main": "main.js", "main": "main.js",
"types": "runtime.d.ts", "types": "runtime.d.ts",