check if window scrolled #110
This commit is contained in:
10
main.go
10
main.go
@@ -32,6 +32,7 @@ var (
|
||||
preferredApps map[string]interface{}
|
||||
exclusions []string
|
||||
hyprlandMonitors []monitor
|
||||
beenScrolled bool
|
||||
)
|
||||
|
||||
var categoryNames = [...]string{
|
||||
@@ -518,6 +519,15 @@ func main() {
|
||||
resultWindow.SetEvents(int(gdk.ALL_EVENTS_MASK))
|
||||
resultWindow.SetPolicy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
|
||||
vAdj := resultWindow.GetVAdjustment()
|
||||
vAdj.Connect("value-changed", func() {
|
||||
beenScrolled = true
|
||||
})
|
||||
hAdj := resultWindow.GetVAdjustment()
|
||||
hAdj.Connect("value-changed", func() {
|
||||
beenScrolled = true
|
||||
})
|
||||
|
||||
resultWindow.Connect("button-release-event", func(_ *gtk.ScrolledWindow, event *gdk.Event) bool {
|
||||
btnEvent := gdk.EventButtonNewFromEvent(event)
|
||||
if btnEvent.Button() == 3 {
|
||||
|
||||
@@ -264,11 +264,18 @@ func flowBoxButton(entry desktopEntry) *gtk.Button {
|
||||
r := substring(desc, 0, 117)
|
||||
desc = fmt.Sprintf("%s…", string(r))
|
||||
}
|
||||
|
||||
button.Connect("button-press-event", func() {
|
||||
beenScrolled = false
|
||||
})
|
||||
|
||||
button.Connect("button-release-event", func(btn *gtk.Button, e *gdk.Event) bool {
|
||||
btnEvent := gdk.EventButtonNewFromEvent(e)
|
||||
if btnEvent.Button() == 1 {
|
||||
launch(exec, terminal)
|
||||
return true
|
||||
if !beenScrolled {
|
||||
launch(exec, terminal)
|
||||
return true
|
||||
}
|
||||
} else if btnEvent.Button() == 3 {
|
||||
pinItem(ID)
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user