mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
app: [Windows] restore double-click restore for custom title bars
Keep custom move areas mapped to HTCAPTION even when the window is maximized so custom title bars preserve the standard Windows behavior where double-click restores the window. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+26
-28
@@ -494,34 +494,32 @@ func getModifiers() key.Modifiers {
|
|||||||
// hitTest returns the non-client area hit by the point, needed to
|
// hitTest returns the non-client area hit by the point, needed to
|
||||||
// process WM_NCHITTEST.
|
// process WM_NCHITTEST.
|
||||||
func (w *window) hitTest(x, y int) uintptr {
|
func (w *window) hitTest(x, y int) uintptr {
|
||||||
if w.config.Mode != Windowed {
|
if w.config.Mode == Windowed {
|
||||||
// Only windowed mode should allow resizing.
|
// Check for resize handle before system actions; otherwise it can be impossible to
|
||||||
return windows.HTCLIENT
|
// resize a custom-decorations window when the system move area is flush with the
|
||||||
}
|
// edge of the window.
|
||||||
// Check for resize handle before system actions; otherwise it can be impossible to
|
top := y <= w.borderSize.Y
|
||||||
// resize a custom-decorations window when the system move area is flush with the
|
bottom := y >= w.config.Size.Y-w.borderSize.Y
|
||||||
// edge of the window.
|
left := x <= w.borderSize.X
|
||||||
top := y <= w.borderSize.Y
|
right := x >= w.config.Size.X-w.borderSize.X
|
||||||
bottom := y >= w.config.Size.Y-w.borderSize.Y
|
switch {
|
||||||
left := x <= w.borderSize.X
|
case top && left:
|
||||||
right := x >= w.config.Size.X-w.borderSize.X
|
return windows.HTTOPLEFT
|
||||||
switch {
|
case top && right:
|
||||||
case top && left:
|
return windows.HTTOPRIGHT
|
||||||
return windows.HTTOPLEFT
|
case bottom && left:
|
||||||
case top && right:
|
return windows.HTBOTTOMLEFT
|
||||||
return windows.HTTOPRIGHT
|
case bottom && right:
|
||||||
case bottom && left:
|
return windows.HTBOTTOMRIGHT
|
||||||
return windows.HTBOTTOMLEFT
|
case top:
|
||||||
case bottom && right:
|
return windows.HTTOP
|
||||||
return windows.HTBOTTOMRIGHT
|
case bottom:
|
||||||
case top:
|
return windows.HTBOTTOM
|
||||||
return windows.HTTOP
|
case left:
|
||||||
case bottom:
|
return windows.HTLEFT
|
||||||
return windows.HTBOTTOM
|
case right:
|
||||||
case left:
|
return windows.HTRIGHT
|
||||||
return windows.HTLEFT
|
}
|
||||||
case right:
|
|
||||||
return windows.HTRIGHT
|
|
||||||
}
|
}
|
||||||
p := f32.Pt(float32(x), float32(y))
|
p := f32.Pt(float32(x), float32(y))
|
||||||
if a, ok := w.w.ActionAt(p); ok && a == system.ActionMove {
|
if a, ok := w.w.ActionAt(p); ok && a == system.ActionMove {
|
||||||
|
|||||||
Reference in New Issue
Block a user