diff --git a/v2/internal/ffenestri/ffenestri.go b/v2/internal/ffenestri/ffenestri.go index 1aed0d7b2..15205b727 100644 --- a/v2/internal/ffenestri/ffenestri.go +++ b/v2/internal/ffenestri/ffenestri.go @@ -40,7 +40,6 @@ type Application struct { // Logger logger logger.CustomLogger - } func (a *Application) saveMemoryReference(mem unsafe.Pointer) { @@ -131,7 +130,6 @@ func (a *Application) Run(incomingDispatcher Dispatcher, bindings string, debug // Set debug if needed C.SetDebug(app, a.bool2Cint(debug)) - // TODO: Move frameless to Linux options if a.config.Frameless { C.DisableFrame(a.app) } diff --git a/v2/internal/ffenestri/ffenestri_windows.cpp b/v2/internal/ffenestri/ffenestri_windows.cpp index 36f25e734..93209b9b2 100644 --- a/v2/internal/ffenestri/ffenestri_windows.cpp +++ b/v2/internal/ffenestri/ffenestri_windows.cpp @@ -144,6 +144,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { break; } case WM_SIZE: { + if ( app == NULL ) { + return 0; + } if( app->webviewController != nullptr) { RECT bounds; GetClientRect(app->window, &bounds); @@ -385,7 +388,7 @@ void Run(struct Application* app, int argc, char **argv) { // Configure translucency DWORD dwExStyle = 0; - if ( app->windowBackgroundIsTranslucent ) { + if ( app->windowBackgroundIsTranslucent) { dwExStyle = WS_EX_NOREDIRECTIONBITMAP; wc.hbrBackground = CreateSolidBrush(RGB(255,255,255)); } @@ -393,13 +396,16 @@ void Run(struct Application* app, int argc, char **argv) { RegisterClassEx(&wc); // Process window style - DWORD windowStyle = WS_OVERLAPPEDWINDOW; + DWORD windowStyle = WS_OVERLAPPEDWINDOW | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; + if (app->resizable == 0) { windowStyle &= ~WS_MAXIMIZEBOX; windowStyle &= ~WS_THICKFRAME; } if ( app->frame == 0 ) { - windowStyle = WS_POPUP; + windowStyle &= ~WS_OVERLAPPEDWINDOW; + windowStyle &= ~WS_CAPTION; + windowStyle |= WS_POPUP; } // Create the window. @@ -424,7 +430,7 @@ void Run(struct Application* app, int argc, char **argv) { } // Credit: https://stackoverflow.com/a/35482689 - if( app->disableWindowIcon ) { + if( app->disableWindowIcon && app->frame == 1 ) { int extendedStyle = GetWindowLong(app->window, GWL_EXSTYLE); SetWindowLong(app->window, GWL_EXSTYLE, extendedStyle | WS_EX_DLGMODALFRAME); SetWindowPos(nullptr, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); @@ -441,7 +447,9 @@ void Run(struct Application* app, int argc, char **argv) { // Private setTitle as we're on the main thread - setTitle(app, app->title); + if( app->frame == 1) { + setTitle(app, app->title); + } // Store application pointer in window handle SetWindowLongPtr(app->window, GWLP_USERDATA, (LONG_PTR)app);