ThinBridge / Chronos

Chromiumベースの業務ブラウザ
Other
5 stars 3 forks source link

Follow to latest beta CEF #94

Closed HashidaTKS closed 1 year ago

HashidaTKS commented 1 year ago

Which issue(s) this PR fixes:

93

What this PR does / why we need it:

最新のCEFに追従。

How to verify the fixed issue:

Describe the following information to help that the tester able to do it.

The steps to verify:

1. 2.

Expected result:

Describe the obvious situation to verify.

HashidaTKS commented 1 year ago

文字化けしている。c_str()関係の直し方が悪いのだろう。。。

image

HashidaTKS commented 1 year ago

LPCTSTR hoge = fuga.ToWString().c_str() だと、ToWString()で新しく作られた文字列が保存されていなくて解放されてしまうから駄目なのかぁ。。。

HashidaTKS commented 1 year ago

うーん、そもそもCefStringTraitsUTF16じゃなくてCefStringTraitsWideが使われているべきなのでは?

HashidaTKS commented 1 year ago

https://magpcss.org/ceforum/apidocs3/projects/(default)/cef_string.h.html

// Build with the UTF16 string type as default.
// #define CEF_STRING_TYPE_UTF16 1

// Build with the wide string type as default.
#define CEF_STRING_TYPE_WIDE 1

というように直してsetup-cefを再実行し、Chronos側に型変換関係のいくつかの修正を入れれば動く。 動くのだが、上記の部分のコメントにあるように、CEF全体のリビルドが必要とあるので、本当にこれで大丈夫なのか疑問である。

HashidaTKS commented 1 year ago

(自分でCEFをビルドしている場合は大丈夫。公式のパッケージを使っている現在の自動ビルドでは駄目な気がする。)

HashidaTKS commented 1 year ago

うーん、動いているけど、何故無事に動いているのか疑問。

setup-cef.batではlibcef_dll_wrapperしか作っていなくて、libcef.dllなどはパッケージに含まれるものを使っている。 このとき、libcef.dllはCEF_STRING_TYPE_UTF16 1の状態でビルドされているはずで、libcef_dll_wrapperはCEF_STRING_TYPE_WIDE 1でビルドされることになる。 文字列型に違いがあるので、どこかで文字化けなり何か起きそうなのだが、特に問題なく動いている。

HashidaTKS commented 1 year ago

https://magpcss.org/ceforum/viewtopic.php?f=6&t=19507&p=53846#p53846

ちょっとよくわからないのでフォーラムで聞いてみた。

HashidaTKS commented 1 year ago

On Windows, wchar_t is UTF-16 so you can reinterpret_cast<> between wchar_t and char16_t.

とのことなので、単にcastするようにしてみる。

ashie commented 1 year ago

ありがとうございます!