Skip to content

Commit

Permalink
Merge pull request lxn#747 from evangwt/master
Browse files Browse the repository at this point in the history
MainWindow: fix ignore WM_SIZE causes statusbar invisible when created
  • Loading branch information
lxn authored Jan 12, 2021
2 parents 5023cd5 + 395de3d commit c389da5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ Simon Rozman <simon@rozman.si>
Tim Dufrane <tim.dufrane@gmail.com>
Vincent Vanackere <vincent.vanackere@gmail.com>
xoviat <xoviat@gmail.com>
evangwt <evangwt@gmail.com>
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 c389da5

Please sign in to comment.