fix(ui): avoid leaking paned notify callbacks
Use ConnectNotifyWithDetail for notify::position wiring and align resize defaults ordering in docs.
- commit
- 2738642c959da5f48aba5d96e309da93ae0ff698
- author
- brice · · 2025-12-26 08:20 UTC
- parent
- 1dfccc3
- signature
- unsigned
2 files · +7 -8
M docs/CONFIG.md +4 -4
| @@ -256,10 +256,10 @@ cancel = ["escape"] | |||
| 256 | 256 | **Default resize mode actions:** | |
| 257 | 257 | ```toml | |
| 258 | 258 | [workspace.resize_mode.actions] | |
| 259 | - | resize-increase-left = ["arrowleft", "h"] | |
| 260 | - | resize-increase-down = ["arrowdown", "j"] | |
| 261 | - | resize-increase-up = ["arrowup", "k"] | |
| 262 | - | resize-increase-right = ["arrowright", "l"] | |
| 259 | + | resize-increase-left = ["h", "arrowleft"] | |
| 260 | + | resize-increase-down = ["j", "arrowdown"] | |
| 261 | + | resize-increase-up = ["k", "arrowup"] | |
| 262 | + | resize-increase-right = ["l", "arrowright"] | |
| 263 | 263 | resize-decrease-left = ["H"] | |
| 264 | 264 | resize-decrease-down = ["J"] | |
| 265 | 265 | resize-decrease-up = ["K"] | |
| @@ -256,10 +256,10 @@ cancel = ["escape"] | |||||
| 256 | **Default resize mode actions:** | 256 | **Default resize mode actions:** | ||
| 257 | ```toml | 257 | ```toml | ||
| 258 | [workspace.resize_mode.actions] | 258 | [workspace.resize_mode.actions] | ||
| 259 | - | resize-increase-left = ["arrowleft", "h"] | 259 | + | resize-increase-left = ["h", "arrowleft"] |
| 260 | - | resize-increase-down = ["arrowdown", "j"] | 260 | + | resize-increase-down = ["j", "arrowdown"] |
| 261 | - | resize-increase-up = ["arrowup", "k"] | 261 | + | resize-increase-up = ["k", "arrowup"] |
| 262 | - | resize-increase-right = ["arrowright", "l"] | 262 | + | resize-increase-right = ["l", "arrowright"] |
| 263 | resize-decrease-left = ["H"] | 263 | resize-decrease-left = ["H"] | ||
| 264 | resize-decrease-down = ["J"] | 264 | resize-decrease-down = ["J"] | ||
| 265 | resize-decrease-up = ["K"] | 265 | resize-decrease-up = ["K"] | ||
M internal/ui/layout/gtk_widgets.go +3 -4
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | package layout | |
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | - | "github.com/jwijenbergh/purego" | |
| 5 | 4 | "github.com/jwijenbergh/puregotk/v4/gdk" | |
| 6 | 5 | "github.com/jwijenbergh/puregotk/v4/gobject" | |
| 7 | 6 | "github.com/jwijenbergh/puregotk/v4/graphene" | |
| @@ -165,10 +164,10 @@ func (p *gtkPaned) ConnectMap(callback func()) uint32 { | |||
| 165 | 164 | } | |
| 166 | 165 | ||
| 167 | 166 | func (p *gtkPaned) ConnectNotifyPosition(callback func()) uint32 { | |
| 168 | - | cbPtr := purego.NewCallback(func() { | |
| 167 | + | cb := func(_ gobject.Object, _ uintptr) { | |
| 169 | 168 | callback() | |
| 170 | - | }) | |
| 171 | - | return gobject.SignalConnect(p.inner.GoPointer(), "notify::position", cbPtr) | |
| 169 | + | } | |
| 170 | + | return p.inner.ConnectNotifyWithDetail("position", &cb) | |
| 172 | 171 | } | |
| 173 | 172 | ||
| 174 | 173 | func (p *gtkPaned) AddTickCallback(callback func() bool) uint { | |
| @@ -1,7 +1,6 @@ | |||||
| 1 | package layout | 1 | package layout | ||
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | - | "github.com/jwijenbergh/purego" | |||
| 5 | "github.com/jwijenbergh/puregotk/v4/gdk" | 4 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 6 | "github.com/jwijenbergh/puregotk/v4/gobject" | 5 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/graphene" | 6 | "github.com/jwijenbergh/puregotk/v4/graphene" | ||
| @@ -165,10 +164,10 @@ func (p *gtkPaned) ConnectMap(callback func()) uint32 { | |||||
| 165 | } | 164 | } | ||
| 166 | 165 | ||||
| 167 | func (p *gtkPaned) ConnectNotifyPosition(callback func()) uint32 { | 166 | func (p *gtkPaned) ConnectNotifyPosition(callback func()) uint32 { | ||
| 168 | - | cbPtr := purego.NewCallback(func() { | 167 | + | cb := func(_ gobject.Object, _ uintptr) { |
| 169 | callback() | 168 | callback() | ||
| 170 | - | }) | 169 | + | } |
| 171 | - | return gobject.SignalConnect(p.inner.GoPointer(), "notify::position", cbPtr) | 170 | + | return p.inner.ConnectNotifyWithDetail("position", &cb) |
| 172 | } | 171 | } | ||
| 173 | 172 | ||||
| 174 | func (p *gtkPaned) AddTickCallback(callback func() bool) uint { | 173 | func (p *gtkPaned) AddTickCallback(callback func() bool) uint { | ||