mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
io/system: add ActionInputOp to register window move gesture areas
The app.Window.Perform(ActionMove) is the wrong abstraction for initiating a move gesture: Windows needs to know the move gesture area at pointer move, and macOS needs to know the pointer button down event that triggers the move gesture. This change replaces Perform(ActionMove) with a new system.ActionInputOp that marks an area movable. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -12,7 +12,6 @@ import (
|
||||
|
||||
// Decorations handles the states of window decorations.
|
||||
type Decorations struct {
|
||||
move gesture.Drag
|
||||
clicks []Clickable
|
||||
resize [8]struct {
|
||||
gesture.Hover
|
||||
@@ -25,13 +24,8 @@ type Decorations struct {
|
||||
// LayoutMove lays out the widget that makes a window movable.
|
||||
func (d *Decorations) LayoutMove(gtx layout.Context, w layout.Widget) layout.Dimensions {
|
||||
dims := w(gtx)
|
||||
d.move.Events(gtx.Metric, gtx, gesture.Both)
|
||||
st := clip.Rect{Max: dims.Size}.Push(gtx.Ops)
|
||||
d.move.Add(gtx.Ops)
|
||||
if d.move.Pressed() {
|
||||
d.actions |= system.ActionMove
|
||||
}
|
||||
st.Pop()
|
||||
defer clip.Rect{Max: dims.Size}.Push(gtx.Ops).Pop()
|
||||
system.ActionInputOp(system.ActionMove).Add(gtx.Ops)
|
||||
return dims
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user