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

[windows] Don't show menu for frameless window

This commit is contained in:
Lea Anthony 2023-10-09 17:35:28 +11:00
parent bf13afd895
commit f07e4093be
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -192,7 +192,7 @@ func (w *windowsWebviewWindow) run() {
var appMenu w32.HMENU var appMenu w32.HMENU
// Process Menu // Process Menu
if !options.Windows.DisableMenu { if !options.Windows.DisableMenu && !options.Frameless {
theMenu := globalApplication.ApplicationMenu theMenu := globalApplication.ApplicationMenu
// Create the menu if we have one // Create the menu if we have one
if w.parent.options.Windows.Menu != nil { if w.parent.options.Windows.Menu != nil {
@ -253,6 +253,7 @@ func (w *windowsWebviewWindow) run() {
if !options.Windows.DisableIcon { if !options.Windows.DisableIcon {
// App icon ID is 3 // App icon ID is 3
icon, err := NewIconFromResource(w32.GetModuleHandle(""), uint16(3)) icon, err := NewIconFromResource(w32.GetModuleHandle(""), uint16(3))
println("icon", icon)
if err == nil { if err == nil {
w.setIcon(icon) w.setIcon(icon)
} }
@ -314,6 +315,11 @@ func (w *windowsWebviewWindow) run() {
w.Focus() w.Focus()
} }
if options.Frameless {
// Trigger a resize to ensure the window is sized correctly
w.chromium.Resize()
}
if !options.Hidden { if !options.Hidden {
w.show() w.show()
w.update() w.update()
@ -789,10 +795,6 @@ func (w *windowsWebviewWindow) getScreen() (*Screen, error) {
} }
func (w *windowsWebviewWindow) setFrameless(b bool) { func (w *windowsWebviewWindow) setFrameless(b bool) {
// If the window is already frameless, don't do anything
if w.parent.options.Frameless == b {
return
}
// Remove or add the frame // Remove or add the frame
if b { if b {
w32.SetWindowLong(w.hwnd, w32.GWL_STYLE, w32.WS_VISIBLE|w32.WS_POPUP) w32.SetWindowLong(w.hwnd, w32.GWL_STYLE, w32.WS_VISIBLE|w32.WS_POPUP)