mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
app: [Windows] ensure custom window decorations allow resize
This commit fixes a platform inconsistency that prevented custom-decorated windows from being resizable on edges where their custom decorations placed a draggable system.ActionInputOp. The prior behavior always checked for this action type before checking if the cursor was potentially in a window resize area, which meant that for windows with material.Decorations, it was impossible to resize those windows from their top edge. The system.ActionMove handler would always win. This is not the case on platforms like macOS, so this commit makes the behavior consistent by prioritizing resize over drag. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
+8
-8
@@ -451,23 +451,18 @@ func (w *window) hitTest(x, y int) uintptr {
|
||||
if w.config.Mode == Fullscreen {
|
||||
return windows.HTCLIENT
|
||||
}
|
||||
p := f32.Pt(float32(x), float32(y))
|
||||
if a, ok := w.w.ActionAt(p); ok && a == system.ActionMove {
|
||||
return windows.HTCAPTION
|
||||
}
|
||||
if w.config.Mode != Windowed {
|
||||
// Only windowed mode should allow resizing.
|
||||
return windows.HTCLIENT
|
||||
}
|
||||
// Check for resize handle before system actions; otherwise it can be impossible to
|
||||
// resize a custom-decorations window when the system move area is flush with the
|
||||
// edge of the window.
|
||||
top := y <= w.borderSize.Y
|
||||
bottom := y >= w.config.Size.Y-w.borderSize.Y
|
||||
left := x <= w.borderSize.X
|
||||
right := x >= w.config.Size.X-w.borderSize.X
|
||||
switch {
|
||||
default:
|
||||
fallthrough
|
||||
case !top && !bottom && !left && !right:
|
||||
return windows.HTCLIENT
|
||||
case top && left:
|
||||
return windows.HTTOPLEFT
|
||||
case top && right:
|
||||
@@ -485,6 +480,11 @@ func (w *window) hitTest(x, y int) uintptr {
|
||||
case right:
|
||||
return windows.HTRIGHT
|
||||
}
|
||||
p := f32.Pt(float32(x), float32(y))
|
||||
if a, ok := w.w.ActionAt(p); ok && a == system.ActionMove {
|
||||
return windows.HTCAPTION
|
||||
}
|
||||
return windows.HTCLIENT
|
||||
}
|
||||
|
||||
func (w *window) pointerButton(btn pointer.Buttons, press bool, lParam uintptr, kmods key.Modifiers) {
|
||||
|
||||
Reference in New Issue
Block a user