Skip to content

Commit

Permalink
Update pager when a window moves or maximizes
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Jan 21, 2024
1 parent 841562a commit 1853adc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/x11/win/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,17 @@ func (c *client) SetDesktop(id int) {

start := c.Position()
fyne.NewAnimation(canvas.DurationStandard, func(f float32) {
newY := start.Y + off*f
newY := start.Y - off*f

c.Move(fyne.NewPos(start.X, newY))

type moveNotifier interface {
NotifyWindowMoved(win fynedesk.Window)
}
if mover, ok := fynedesk.Instance().WindowManager().(moveNotifier); ok {
mover.NotifyWindowMoved(c)
}

}).Start()
}

Expand Down
6 changes: 6 additions & 0 deletions internal/x11/wm/desk.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,12 @@ func (x *x11WM) RootID() xproto.Window {
return x.rootID
}

func (x *x11WM) NotifyWindowMoved(win fynedesk.Window) {
for _, l := range x.listeners {
go l.WindowMoved(win)
}
}

func (x *x11WM) hideWindow(win xproto.Window) {
c := x.clientForWin(win)
if c == nil || win == c.FrameID() {
Expand Down
9 changes: 9 additions & 0 deletions internal/x11/wm/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ func (x *x11WM) handleMouseMotion(ev xproto.MotionNotifyEvent) {
}
if ev.State&xproto.ButtonMask1 != 0 {
c.(x11.XWin).NotifyMouseDrag(ev.RootX, ev.RootY)
x.NotifyWindowMoved(c)
} else {
c.(x11.XWin).NotifyMouseMotion(ev.RootX, ev.RootY)
}
Expand Down Expand Up @@ -335,6 +336,12 @@ func (x *x11WM) handleStateActionRequest(ev xproto.ClientMessageEvent, removeSta
addState()
}
}
for _, c := range x.clients {
if c.(x11.XWin).ChildID() == ev.Window {
x.NotifyWindowMoved(c)
break
}
}
}

func (x *x11WM) handleVisibilityChange(ev xproto.VisibilityNotifyEvent) {
Expand Down Expand Up @@ -426,4 +433,6 @@ func (x *x11WM) moveResize(moveX, moveY int16, c x11.XWin) {
x.moveResizingLastX = moveX
x.moveResizingLastY = moveY
c.QueueMoveResizeGeometry(x.moveResizingX, x.moveResizingY, uint(w), uint(h))

x.NotifyWindowMoved(c)
}

0 comments on commit 1853adc

Please sign in to comment.