diff --git a/v2/internal/ffenestri/ffenestri_windows.cpp b/v2/internal/ffenestri/ffenestri_windows.cpp index ddc869ef..bec59cb4 100644 --- a/v2/internal/ffenestri/ffenestri_windows.cpp +++ b/v2/internal/ffenestri/ffenestri_windows.cpp @@ -62,6 +62,7 @@ struct Application *NewApplication(const char *title, int width, int height, int result->hideWindowOnClose = hideWindowOnClose; result->webviewIsTranparent = false; result->windowBackgroundIsTranslucent = false; + result->disableWindowIcon = false; // Min/Max Width/Height result->minWidth = 0; @@ -373,9 +374,10 @@ void Run(struct Application* app, int argc, char **argv) { wc.hInstance = GetModuleHandle(NULL); wc.lpszClassName = CLASS_NAME; - // TODO: Make configurable - wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(100)); - wc.hIconSm = LoadIcon(wc.hInstance, MAKEINTRESOURCE(100)); + if( app->disableWindowIcon == false ) { + wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(100)); + wc.hIconSm = LoadIcon(wc.hInstance, MAKEINTRESOURCE(100)); + } // Configure translucency DWORD dwExStyle = 0; @@ -417,6 +419,13 @@ void Run(struct Application* app, int argc, char **argv) { return; } + // Credit: https://stackoverflow.com/a/35482689 + if( app->disableWindowIcon ) { + 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); + } + if ( app->windowBackgroundIsTranslucent ) { // Enable the translucent background effect @@ -442,7 +451,6 @@ void Run(struct Application* app, int argc, char **argv) { // private center() as we are on main thread center(app); -// SetLayeredWindowAttributes(app->window,RGB(255,255,255),0,LWA_COLORKEY); ShowWindow(app->window, startVisibility); UpdateWindow(app->window); SetFocus(app->window); @@ -559,6 +567,10 @@ void Show(struct Application* app) { ); } +void DisableWindowIcon(struct Application* app) { + app->disableWindowIcon = true; +} + void center(struct Application* app) { HMONITOR currentMonitor = MonitorFromWindow(app->window, MONITOR_DEFAULTTONEAREST); diff --git a/v2/internal/ffenestri/ffenestri_windows.go b/v2/internal/ffenestri/ffenestri_windows.go index 26371064..f8b19dd4 100644 --- a/v2/internal/ffenestri/ffenestri_windows.go +++ b/v2/internal/ffenestri/ffenestri_windows.go @@ -9,6 +9,8 @@ import "C" #include "ffenestri.h" +extern void DisableWindowIcon(struct Application* app); + */ import "C" @@ -28,6 +30,10 @@ func (a *Application) processPlatformSettings() error { C.WindowBackgroundIsTranslucent(a.app) } + if config.DisableWindowIcon { + C.DisableWindowIcon(a.app) + } + //// Process menu ////applicationMenu := options.GetApplicationMenu(a.config) //applicationMenu := a.menuManager.GetApplicationMenuJSON() diff --git a/v2/internal/ffenestri/ffenestri_windows.h b/v2/internal/ffenestri/ffenestri_windows.h index c7ad4a4c..b4a008f3 100644 --- a/v2/internal/ffenestri/ffenestri_windows.h +++ b/v2/internal/ffenestri/ffenestri_windows.h @@ -45,6 +45,7 @@ struct Application{ bool webviewIsTranparent; bool windowBackgroundIsTranslucent; COREWEBVIEW2_COLOR backgroundColour; + bool disableWindowIcon; // placeholders char* bindings; @@ -69,6 +70,7 @@ void completed(struct Application* app); // Callback extern "C" { + void DisableWindowIcon(struct Application* app); void messageFromWindowCallback(const char *); } diff --git a/v2/pkg/options/windows/windows.go b/v2/pkg/options/windows/windows.go index 5e39fda5..827e4c05 100644 --- a/v2/pkg/options/windows/windows.go +++ b/v2/pkg/options/windows/windows.go @@ -4,4 +4,5 @@ package windows type Options struct { WebviewIsTransparent bool WindowBackgroundIsTranslucent bool + DisableWindowIcon bool }