Skip to content

Commit 95ed0a9

Browse files
committed
Add cursor hiding
Update gotk3 dep When in fullscreen the cursor will now hide when the hud hides Updated gotk3 to get the latest changes
1 parent 1f0c5eb commit 95ed0a9

File tree

6 files changed

+37
-4
lines changed

6 files changed

+37
-4
lines changed

cmd/cbxv/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
const (
1515
NAME = "cbxv"
16-
VERSION = "0.5.1"
16+
VERSION = "0.5.2"
1717
)
1818

1919
// Update listens for messages on the message channel and

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.18
44

55
require (
66
github.com/gen2brain/go-unarr v0.2.0
7-
github.com/gotk3/gotk3 v0.6.2
7+
github.com/gotk3/gotk3 v0.6.3
88
github.com/pdfcpu/pdfcpu v0.6.0
99
)
1010

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
github.com/gen2brain/go-unarr v0.2.0 h1:sYKSjbeNSuZgudd59iGAbMbr113XRFoA7Rt9XWA+QVE=
22
github.com/gen2brain/go-unarr v0.2.0/go.mod h1:hoHheVuf0KT8/hfvkEL7GMwj2h7fq0lF72NdyySdr3c=
3-
github.com/gotk3/gotk3 v0.6.2 h1:sx/PjaKfKULJPTPq8p2kn2ZbcNFxpOJqi4VLzMbEOO8=
4-
github.com/gotk3/gotk3 v0.6.2/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
3+
github.com/gotk3/gotk3 v0.6.3 h1:+Ke4WkM1TQUNOlM2TZH6szqknqo+zNbX3BZWVXjSHYw=
4+
github.com/gotk3/gotk3 v0.6.3/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
55
github.com/hhrutter/lzw v1.0.0 h1:laL89Llp86W3rRs83LvKbwYRx6INE8gDn0XNb1oXtm0=
66
github.com/hhrutter/lzw v1.0.0/go.mod h1:2HC6DJSn/n6iAZfgM3Pg+cP1KxeWc3ezG8bBqW5+WEo=
77
github.com/hhrutter/tiff v1.0.1 h1:MIus8caHU5U6823gx7C6jrfoEvfSTGtEFRiM8/LOzC0=

internal/ui/pageview.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ func NewPageView(m *model.Model, u *UI, messenger util.Messenger) View {
5858
if !v.hudHidden && !v.hudKeepAlive {
5959
v.hdrControl.container.Hide()
6060
v.navControl.container.Hide()
61+
if m.Fullscreen {
62+
v.ui.HideCursor()
63+
}
6164
u.MainWindow.QueueDraw()
6265
v.hudHidden = true
6366
} else {
@@ -82,6 +85,7 @@ func (v *PageView) newHUD(m *model.Model, u *UI) *gtk.Overlay {
8285
v.navControl = NewNavControl(m, u)
8386
o.AddOverlay(v.hdrControl.container)
8487
o.AddOverlay(v.navControl.container)
88+
v.ui.ShowCursor()
8589
v.hudHidden = false
8690

8791
return o
@@ -103,6 +107,7 @@ func (v *PageView) Connect(m *model.Model, u *UI) {
103107
}
104108

105109
v.hud.ShowAll()
110+
v.ui.ShowCursor()
106111
v.hudHidden = false
107112
v.hudKeepAlive = true
108113
return true
@@ -153,6 +158,7 @@ func (v *PageView) initRenderer(m *model.Model) {
153158
//reset the hud hiding
154159
v.hdrControl.container.Show()
155160
v.navControl.container.Show()
161+
v.ui.ShowCursor()
156162
v.hudHidden = false
157163
v.hudKeepAlive = true
158164
}
@@ -173,6 +179,7 @@ func (v *PageView) initRenderer(m *model.Model) {
173179
}
174180
//reset the hud hiding
175181
v.hud.ShowAll()
182+
v.ui.ShowCursor()
176183
v.hudHidden = false
177184
v.hudKeepAlive = true
178185
return r

internal/ui/stripview.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func NewStripView(m *model.Model, u *UI) View {
4444

4545
v.scrollbars.Connect("scroll-event", func() {
4646
v.hud.ShowAll()
47+
v.ui.ShowCursor()
4748
v.hudHidden = false
4849
v.hudKeepAlive = true
4950
})
@@ -63,6 +64,9 @@ func NewStripView(m *model.Model, u *UI) View {
6364
v.hdrControl.container.Hide()
6465
v.navControl.container.Hide()
6566
u.MainWindow.QueueDraw()
67+
if m.Fullscreen {
68+
u.HideCursor()
69+
}
6670
v.hudHidden = true
6771
} else {
6872
v.hudKeepAlive = false
@@ -84,6 +88,7 @@ func (v *StripView) Connect(m *model.Model, u *UI) {
8488
}
8589

8690
v.hud.ShowAll()
91+
u.ShowCursor()
8792
v.hudHidden = false
8893
v.hudKeepAlive = true
8994
})
@@ -142,6 +147,7 @@ func (v *StripView) newHUD(m *model.Model, u *UI) *gtk.Overlay {
142147
v.navControl = NewStripViewNavControl(m, u)
143148
o.AddOverlay(v.hdrControl.container)
144149
o.AddOverlay(v.navControl.container)
150+
u.ShowCursor()
145151
v.hudHidden = false
146152

147153
return o

internal/ui/ui.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,26 @@ func (u *UI) DisplayErrorDlg(message string) {
8787
dlg.Run()
8888
}
8989

90+
func (u *UI) ShowCursor() {
91+
d, _ := gdk.DisplayGetDefault()
92+
c, _ := gdk.CursorNewFromName(d, "default")
93+
w, err := u.MainWindow.GetWindow()
94+
if err != nil {
95+
return
96+
}
97+
w.SetCursor(c)
98+
}
99+
100+
func (u *UI) HideCursor() {
101+
d, _ := gdk.DisplayGetDefault()
102+
c, _ := gdk.CursorNewFromName(d, "none")
103+
w, err := u.MainWindow.GetWindow()
104+
if err != nil {
105+
return
106+
}
107+
w.SetCursor(c)
108+
}
109+
90110
func (u *UI) Render(m *model.Model) {
91111
glib.IdleAdd(func() {
92112
u.View.Render(m)

0 commit comments

Comments
 (0)