5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-17 01:19:29 +08:00

261 korean fonts (#273)

* fix: linting

* chore: bump version

* fix: unicode text for Windows
This commit is contained in:
Lea Anthony 2019-10-25 12:33:29 +11:00 committed by GitHub
parent 0819207e33
commit 85a64914aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 11 deletions

View File

@ -1,4 +1,4 @@
package cmd package cmd
// Version - Wails version // Version - Wails version
const Version = "v0.18.9-pre" const Version = "v0.18.7-pre"

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 #cgo windows CFLAGS: -DWEBVIEW_WINAPI=1 -std=c99 -DUNICODE=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

@ -1038,7 +1038,7 @@ struct webview_priv
return S_FALSE; return S_FALSE;
} }
static const TCHAR *classname = "WebView"; static const TCHAR *classname = TEXT("WebView");
static const SAFEARRAYBOUND ArrayBound = {1, 0}; static const SAFEARRAYBOUND ArrayBound = {1, 0};
static IOleClientSiteVtbl MyIOleClientSiteTable = { static IOleClientSiteVtbl MyIOleClientSiteTable = {
@ -1227,7 +1227,7 @@ struct webview_priv
} }
VariantInit(&myURL); VariantInit(&myURL);
myURL.vt = VT_BSTR; myURL.vt = VT_BSTR;
#ifndef UNICODE // #ifndef UNICODE
{ {
wchar_t *buffer = webview_to_utf16(webPageName); wchar_t *buffer = webview_to_utf16(webPageName);
if (buffer == NULL) if (buffer == NULL)
@ -1237,9 +1237,9 @@ struct webview_priv
myURL.bstrVal = SysAllocString(buffer); myURL.bstrVal = SysAllocString(buffer);
GlobalFree(buffer); GlobalFree(buffer);
} }
#else // #else
myURL.bstrVal = SysAllocString(webPageName); // myURL.bstrVal = SysAllocString(webPageName);
#endif // #endif
if (!myURL.bstrVal) if (!myURL.bstrVal)
{ {
badalloc: badalloc:
@ -1277,7 +1277,7 @@ struct webview_priv
if (!SafeArrayAccessData(sfArray, (void **)&pVar)) if (!SafeArrayAccessData(sfArray, (void **)&pVar))
{ {
pVar->vt = VT_BSTR; pVar->vt = VT_BSTR;
#ifndef UNICODE // #ifndef UNICODE
{ {
wchar_t *buffer = webview_to_utf16(url); wchar_t *buffer = webview_to_utf16(url);
if (buffer == NULL) if (buffer == NULL)
@ -1287,9 +1287,9 @@ struct webview_priv
bstr = SysAllocString(buffer); bstr = SysAllocString(buffer);
GlobalFree(buffer); GlobalFree(buffer);
} }
#else // #else
bstr = SysAllocString(string); // bstr = SysAllocString(url);
#endif // #endif
if ((pVar->bstrVal = bstr)) if ((pVar->bstrVal = bstr))
{ {
htmlDoc2->lpVtbl->write(htmlDoc2, sfArray); htmlDoc2->lpVtbl->write(htmlDoc2, sfArray);
@ -1404,6 +1404,7 @@ struct webview_priv
{ {
return -1; return -1;
} }
ZeroMemory(&wc, sizeof(WNDCLASSEX)); ZeroMemory(&wc, sizeof(WNDCLASSEX));
wc.cbSize = sizeof(WNDCLASSEX); wc.cbSize = sizeof(WNDCLASSEX);
wc.hInstance = hInstance; wc.hInstance = hInstance;
@ -1431,10 +1432,24 @@ struct webview_priv
rect.bottom = rect.bottom - rect.top + top; rect.bottom = rect.bottom - rect.top + top;
rect.top = top; rect.top = top;
#ifdef UNICODE
wchar_t *u16title = webview_to_utf16(w->title);
if (u16title == NULL)
{
return -1;
}
w->priv.hwnd = w->priv.hwnd =
CreateWindowEx(0, classname, u16title, style, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top,
HWND_DESKTOP, NULL, hInstance, (void *)w);
#else
w->priv.hwnd =
CreateWindowEx(0, classname, w->title, style, rect.left, rect.top, CreateWindowEx(0, classname, w->title, style, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top, rect.right - rect.left, rect.bottom - rect.top,
HWND_DESKTOP, NULL, hInstance, (void *)w); HWND_DESKTOP, NULL, hInstance, (void *)w);
#endif
if (w->priv.hwnd == 0) if (w->priv.hwnd == 0)
{ {
OleUninitialize(); OleUninitialize();
@ -1445,7 +1460,14 @@ struct webview_priv
DisplayHTMLPage(w); DisplayHTMLPage(w);
#ifdef UNICODE
SetWindowText(w->priv.hwnd, u16title);
GlobalFree(u16title);
#else
SetWindowText(w->priv.hwnd, w->title); SetWindowText(w->priv.hwnd, w->title);
#endif
ShowWindow(w->priv.hwnd, SW_SHOWDEFAULT); ShowWindow(w->priv.hwnd, SW_SHOWDEFAULT);
UpdateWindow(w->priv.hwnd); UpdateWindow(w->priv.hwnd);
SetFocus(w->priv.hwnd); SetFocus(w->priv.hwnd);