Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71ce3b5d75 | ||
|
|
b056b4c436 | ||
|
|
42b55d41df | ||
|
|
ec0ce767d9 | ||
|
|
ec3caa02d2 | ||
|
|
6b39eba14c |
15
main.go
15
main.go
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/gotk3/gotk3/gtk"
|
||||
)
|
||||
|
||||
const version = "0.4.5"
|
||||
const version = "0.4.6"
|
||||
|
||||
var (
|
||||
appDirs []string
|
||||
@@ -32,6 +32,7 @@ var (
|
||||
preferredApps map[string]interface{}
|
||||
exclusions []string
|
||||
hyprlandMonitors []monitor
|
||||
beenScrolled bool
|
||||
)
|
||||
|
||||
var categoryNames = [...]string{
|
||||
@@ -518,6 +519,18 @@ func main() {
|
||||
resultWindow.SetEvents(int(gdk.ALL_EVENTS_MASK))
|
||||
resultWindow.SetPolicy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
|
||||
// On touch screen we don't want the button-release-event to launch the app if the user just wanted to scroll the
|
||||
// window. Let's forbid doing so if the content has been scrolled. We will reset the value on button-press-event.
|
||||
// Resolves https://github.com/nwg-piotr/nwg-drawer/issues/110
|
||||
vAdj := resultWindow.GetVAdjustment()
|
||||
vAdj.Connect("value-changed", func() {
|
||||
beenScrolled = true
|
||||
})
|
||||
hAdj := resultWindow.GetHAdjustment()
|
||||
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,19 @@ func flowBoxButton(entry desktopEntry) *gtk.Button {
|
||||
r := substring(desc, 0, 117)
|
||||
desc = fmt.Sprintf("%s…", string(r))
|
||||
}
|
||||
|
||||
button.Connect("button-press-event", func() {
|
||||
// if not scrolled from now on, we will allow launching apps on button-release-event
|
||||
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