app: guarantee a ConfigEvent for every Window.Configure call

Not only is the client guaranteed a ConfigEvent, but app.Window
can assume that an unsupported decoration change will be corrected
(by a ConfigEvent with Decorated forced to the supported value).

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-06-25 13:57:46 +02:00
parent c5e07ba01f
commit 69e4a3cff3
8 changed files with 10 additions and 36 deletions
+3 -12
View File
@@ -188,7 +188,6 @@ func createNativeWindow() (*window, error) {
// It reads the window style and size/position and updates w.config.
// If anything has changed it emits a ConfigEvent to notify the application.
func (w *window) update() {
var triggerEvent bool
r := windows.GetWindowRect(w.hwnd)
size := image.Point{
X: int(r.Right - r.Left - w.deltas.width),
@@ -210,17 +209,9 @@ func (w *window) update() {
} else {
mode = Windowed
}
if size != w.config.Size {
w.config.Size = size
triggerEvent = true
}
if mode != w.config.Mode {
w.config.Mode = mode
triggerEvent = true
}
if triggerEvent {
w.w.Event(ConfigEvent{Config: w.config})
}
w.config.Size = size
w.config.Mode = mode
w.w.Event(ConfigEvent{Config: w.config})
}
func windowProc(hwnd syscall.Handle, msg uint32, wParam, lParam uintptr) uintptr {