Files
magpie/internal/gui/glide_other.go
T
lainbo 9bfb7a5870 fix(gui): keep the full-screen window's title bar when the Dock is set to Hide
With Dock on "Hide", magpie runs as an Accessory app. A full-screen
window's title bar comes down only with the menu bar, and an Accessory app
has none, so the full-screen main window had no close, minimize or
full-screen button, and only Esc left full screen.

magpie now joins the Dock as a window starts entering full screen, from a
native NSWindowWillEnterFullScreenNotification observer: Wails hands that
event to Go later, and switching once the window is full screen doesn't
bring the title bar back. dock counts a full-screen main window (inDock),
so reopening the app or changing the Dock setting during full screen keeps
magpie in the Dock, and WindowDidExitFullScreen applies the setting again.

TestFullscreenKeepsDock checks inDock; it doesn't compile on main. On
macOS 27.0.1 with Dock on "Hide", main stays out of the Dock in full screen
with no title bar; this branch joins the Dock with the title bar and its
buttons, and leaves it after the green button, View > Toggle Full Screen
or Esc.

Fixes #763
2026-10-05 17:37:49 +08:00

35 lines
1.2 KiB
Go

//go:build !darwin && !nogui
package gui
import "github.com/wailsapp/wails/v3/pkg/application"
// The Dock is the Mac's; elsewhere magpie stays in the tray.
func dockPolicy(bool) application.ActivationPolicy { return application.ActivationPolicyAccessory }
func setDock(bool, bool) {}
func dockOnFullscreen() {}
// glidePanel steps the shown panel to height a frame at a time, keeping it
// by the tray icon as it goes.
func (h *host) glidePanel(height int, g Glide) bool {
w := h.panel
_, from := w.Size()
gen := h.glides.Add(1)
go stepGlide(g, from, height, func() bool { return h.glides.Load() == gen }, func(v int) {
application.InvokeSync(func() {
if h.panel == w { // not let go meanwhile (lightweight mode)
w.SetSize(h.panelW(), v)
_ = h.tray.PositionWindow(w, 6)
}
})
})
return true
}
// TintPanel: the page paints the panel's tint itself here.
func (h *host) TintPanel(c [4]uint8, ms int) bool { return false }
// setPageZoom zooms w's page to z, as a browser zooms (WebView2's zoom
// factor, WebKitGTK's zoom level): the text size.
func setPageZoom(w *application.WebviewWindow, z float64) { w.SetZoom(z) }