Skip to content

Commit

Permalink
Fixed MSVC compiler support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny committed Mar 1, 2024
1 parent 7577ec6 commit 122c863
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
5 changes: 5 additions & 0 deletions c/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ fn main() {
******************************* */
if target.contains("windows") {
bgbuilder = bgbuilder.clang_arg("-DBW_WIN32");
if target.contains("msvc") {
build.flag("/MT");
}

// Win32 API
build
Expand Down Expand Up @@ -275,6 +278,8 @@ fn main() {
println!("cargo:rustc-link-search={}/libcef_dll_wrapper", &cef_path);
println!("cargo:rustc-link-search={}/Release", &cef_path);
if target.contains("msvc") {
build_se.flag("/MT");

println!("cargo:rustc-link-search={}", &cef_path);
println!(
"cargo:rustc-link-search={}/libcef_dll_wrapper/Release",
Expand Down
4 changes: 4 additions & 0 deletions c/src/application/cef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ void bw_ApplicationEngineImpl_free( bw_ApplicationEngineImpl* app ) {
delete (CefRefPtr<CefClient>*)app->cef_client;
}

void bw_ApplicationImpl_free( bw_ApplicationImpl* app ) {

}



#ifdef CEF_X11
Expand Down
5 changes: 0 additions & 5 deletions c/src/application/cef_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ BOOL bw_ApplicationImpl_dispatch( bw_Application* app, bw_ApplicationDispatchDat
return TRUE;
}

void bw_ApplicationImpl_free( bw_ApplicationImpl* app ) {
UNUSED( app );
CefShutdown();
}

int bw_ApplicationImpl_run( bw_Application* app, bw_ApplicationImpl_ReadyHandlerData* ready_handler_data ) {
bw_Application_assertCorrectThread( app );

Expand Down
3 changes: 2 additions & 1 deletion c/src/browser_window/cef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ void bw_BrowserWindowCef_connectToWin32Window( bw_BrowserWindow* bw, CefWindowIn

RECT rect;
GetClientRect( bw->window->impl.handle, &rect );
info.SetAsChild( bw->window->impl.handle, rect );
CefRect crect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
info.SetAsChild( bw->window->impl.handle, crect );
}
#endif

Expand Down
7 changes: 4 additions & 3 deletions c/src/cef/client_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,13 @@ class ClientHandler : public CefClient, public CefLifeSpanHandler, public CefLoa
void openDevTools(CefRefPtr<CefBrowser> browser, bw_BrowserWindow* bw) {
CefWindowInfo info;
#ifdef BW_WIN32
info.SetAsPopup(browser, "Dev Tools" );
#endif
//info.SetAsPopup(browser->GetWindowHandle(), "Dev Tools" );
browser->GetHost()->ShowDevTools(info, this, CefBrowserSettings(), CefPoint());
#else
//browser->GetHost()->ShowDevTools(info, this, CefBrowserSettings(), CefPoint());

#ifndef NDEBUG
printf("Dev Tools are disabled for CEF in BrowserWindow, because it is broken. Use remote debugging instead.\n");
#endif
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion c/src/err.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef struct bw_Err {
{ bw_Err r; r.code = CODE; r.data = (const void*)DATA_PTR; r.alloc_message = MSG_FUNC; return r; }

#define BW_ERR_DECLARE(VAR_NAME, CODE, DATA_PTR, MSG_FUNC) \
bw_Err VAR_NAME = { .code = CODE, .data = DATA_PTR, .alloc_message = MSG_FUNC };
bw_Err VAR_NAME = { CODE, DATA_PTR, MSG_FUNC };

#define BW_ERR_RETURN_SUCCESS \
BW_ERR_RETURN( BW_ERR_CODE_SUCCESS, 0, bw_Err_msg_success )
Expand Down

0 comments on commit 122c863

Please sign in to comment.