Skip to content

Commit

Permalink
MainWindow: fix ignore WM_SIZE causes statusbar invisable when created
Browse files Browse the repository at this point in the history
  • Loading branch information
evangwt committed Dec 21, 2020
1 parent 98655d0 commit 68674fe
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions mainwindow.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,20 +220,27 @@ func (mw *MainWindow) SetFullscreen(fullscreen bool) error {

func (mw *MainWindow) WndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr) uintptr {
switch msg {
case win.WM_WINDOWPOSCHANGED:
wp := (*win.WINDOWPOS)(unsafe.Pointer(lParam))

if wp.Flags&win.SWP_NOSIZE != 0 {
break
case win.WM_WINDOWPOSCHANGED, win.WM_SIZE:
if win.WM_WINDOWPOSCHANGED == msg {
wp := (*win.WINDOWPOS)(unsafe.Pointer(lParam))
if wp.Flags&win.SWP_NOSIZE != 0 {
break
}
}

cb := mw.ClientBoundsPixels()

if mw.toolBar != nil {
mw.toolBar.SetBoundsPixels(Rectangle{0, 0, cb.Width, mw.toolBar.HeightPixels()})
bounds := Rectangle{0, 0, cb.Width, mw.toolBar.HeightPixels()}
if mw.toolBar.BoundsPixels() != bounds {
mw.toolBar.SetBoundsPixels(bounds)
}
}

mw.statusBar.SetBoundsPixels(Rectangle{0, cb.Y + cb.Height, cb.Width, mw.statusBar.HeightPixels()})
bounds := Rectangle{0, cb.Y + cb.Height, cb.Width, mw.statusBar.HeightPixels()}
if mw.statusBar.BoundsPixels() != bounds {
mw.statusBar.SetBoundsPixels(bounds)
}

case win.WM_INITMENUPOPUP:
mw.menu.updateItemsWithImageForWindow(mw)
Expand Down

0 comments on commit 68674fe

Please sign in to comment.