mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 01:45:36 +00:00
app: [Windows] support app.Decorated(false)
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+12
-14
@@ -197,24 +197,19 @@ func (w *window) update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check the window mode.
|
// Check the window mode.
|
||||||
mode := w.config.Mode
|
|
||||||
p := windows.GetWindowPlacement(w.hwnd)
|
p := windows.GetWindowPlacement(w.hwnd)
|
||||||
style := windows.GetWindowLong(w.hwnd, windows.GWL_STYLE)
|
style := windows.GetWindowLong(w.hwnd, windows.GWL_STYLE)
|
||||||
if style&windows.WS_OVERLAPPEDWINDOW == 0 {
|
if p.IsMinimized() {
|
||||||
mode = Fullscreen
|
w.config.Mode = Minimized
|
||||||
|
} else if p.IsMaximized() {
|
||||||
|
w.config.Mode = Maximized
|
||||||
|
} else if style&windows.WS_OVERLAPPEDWINDOW == 0 {
|
||||||
size = image.Point{
|
size = image.Point{
|
||||||
X: int(r.Right - r.Left),
|
X: int(r.Right - r.Left),
|
||||||
Y: int(r.Bottom - r.Top),
|
Y: int(r.Bottom - r.Top),
|
||||||
}
|
}
|
||||||
} else if p.IsMinimized() {
|
|
||||||
mode = Minimized
|
|
||||||
} else if p.IsMaximized() {
|
|
||||||
mode = Maximized
|
|
||||||
} else {
|
|
||||||
mode = Windowed
|
|
||||||
}
|
}
|
||||||
w.config.Size = size
|
w.config.Size = size
|
||||||
w.config.Mode = mode
|
|
||||||
w.w.Event(ConfigEvent{Config: w.config})
|
w.w.Event(ConfigEvent{Config: w.config})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,26 +582,29 @@ func (w *window) Configure(options []Option) {
|
|||||||
metric := configForDPI(dpi)
|
metric := configForDPI(dpi)
|
||||||
w.config.apply(metric, options)
|
w.config.apply(metric, options)
|
||||||
windows.SetWindowText(w.hwnd, w.config.Title)
|
windows.SetWindowText(w.hwnd, w.config.Title)
|
||||||
// Decorations are never disabled.
|
|
||||||
w.config.Decorated = true
|
|
||||||
|
|
||||||
style := windows.GetWindowLong(w.hwnd, windows.GWL_STYLE)
|
style := windows.GetWindowLong(w.hwnd, windows.GWL_STYLE)
|
||||||
var showMode int32
|
var showMode int32
|
||||||
var x, y, width, height int32
|
var x, y, width, height int32
|
||||||
swpStyle := uintptr(windows.SWP_NOZORDER | windows.SWP_FRAMECHANGED)
|
swpStyle := uintptr(windows.SWP_NOZORDER | windows.SWP_FRAMECHANGED)
|
||||||
|
winStyle := uintptr(windows.WS_OVERLAPPEDWINDOW)
|
||||||
|
style &^= winStyle
|
||||||
|
if !w.config.Decorated {
|
||||||
|
winStyle = 0
|
||||||
|
}
|
||||||
switch w.config.Mode {
|
switch w.config.Mode {
|
||||||
case Minimized:
|
case Minimized:
|
||||||
swpStyle |= windows.SWP_NOMOVE | windows.SWP_NOSIZE
|
swpStyle |= windows.SWP_NOMOVE | windows.SWP_NOSIZE
|
||||||
showMode = windows.SW_SHOWMINIMIZED
|
showMode = windows.SW_SHOWMINIMIZED
|
||||||
|
|
||||||
case Maximized:
|
case Maximized:
|
||||||
style |= windows.WS_OVERLAPPEDWINDOW
|
style |= winStyle
|
||||||
swpStyle |= windows.SWP_NOMOVE | windows.SWP_NOSIZE
|
swpStyle |= windows.SWP_NOMOVE | windows.SWP_NOSIZE
|
||||||
showMode = windows.SW_SHOWMAXIMIZED
|
showMode = windows.SW_SHOWMAXIMIZED
|
||||||
|
|
||||||
case Windowed:
|
case Windowed:
|
||||||
windows.SetWindowText(w.hwnd, w.config.Title)
|
windows.SetWindowText(w.hwnd, w.config.Title)
|
||||||
style |= windows.WS_OVERLAPPEDWINDOW
|
style |= winStyle
|
||||||
showMode = windows.SW_SHOWNORMAL
|
showMode = windows.SW_SHOWNORMAL
|
||||||
// Get target for client areaa size.
|
// Get target for client areaa size.
|
||||||
width = int32(w.config.Size.X)
|
width = int32(w.config.Size.X)
|
||||||
|
|||||||
Reference in New Issue
Block a user