Repository: lutris/lutris

Issue:
Do not change configuration with mouse wheel scrolling.
There is no need to change options in 'Configure" menu with mouse wheel scrolling.
Current behavior creates situations when user can mess up their configuration just by scrolling through options and not realize it because UI doesn't make it very obvious.
Plus this duality of the scrolling action is just annoying because you have to dodge the selection boxes to just navigate through the menu.


Discussion:
This is annoying because it's a default behavior of Gtk and patching it out is not obvious. We plan to re-organize the UI to make this less of an issue, we'll see if this is something we want to implement on the new UI.
When doing scroll, both `scroll-event` and `changed` events are triggered.

```python
combobox.connect('scroll-event', self.on_combobox_scroll)
# -----------
    def on_combobox_scroll(self, combobox, event):
        print("on_combobox_scroll")
        print(event)
        combobox.set_active(combobox.get_active())

    def on_combobox_change(self, combobox, option):
        print("on_combobox_change")
```

https://github.com/lutris/lutris/blob/decc08873fe3d14c48615414dc4e6148c513340d/lutris/gui/config_boxes.py#L262

The idea would be:
* When `scroll-event` happens, set a **property** `scroll=True`.
* When `changed` happens, if `scroll=True`, set to `False` and don't make changes.

But I don't know where to save that property :thinking: 

Also the window won't move, so if the user keeps scrolling, it won't move up or down.
just connecting the combobox's `scroll-event` signal to a `return true` callback should do the trick: https://mail.gnome.org/archives/gtk-app-devel-list/2016-May/msg00066.html

quote from https://developer.gnome.org/gtk-tutorial/stable/x182.html:

> The value returned from this function indicates whether the event should be propagated further by the GTK event handling mechanism. Returning TRUE indicates that the event has been handled, and that it should not propagate further. Returning FALSE continues the normal event handling.

this might (no idea, didn't test it, but "not propagated further" sounds like it) mean it actually stops scrolling then though, in that case the callback would have to re-emit the signal to the scrolling container before returning true to essentially just "skip" the combobox

Resolving patch:
diff --git a/lutris/gui/config_boxes.py b/lutris/gui/config_boxes.py
--- a/lutris/gui/config_boxes.py
+++ b/lutris/gui/config_boxes.py
@@ -252,6 +252,7 @@ def generate_combobox(self, option_name, choices, label,
                 combobox.set_active_id(default)
 
         combobox.connect('changed', self.on_combobox_change, option_name)
+        combobox.connect('scroll-event', self.on_combobox_scroll)
         label = Label(label)
         label.set_alignment(0.5, 0.5)
         combobox.set_valign(Gtk.Align.CENTER)
@@ -259,6 +260,11 @@ def generate_combobox(self, option_name, choices, label,
         self.wrapper.pack_start(combobox, True, True, 0)
         self.option_widget = combobox
 
+    def on_combobox_scroll(self, combobox, event):
+        """ Do not change options when scrolling
+            with cursor inside a ComboBox. #1024 """
+        return True
+
     def on_combobox_change(self, combobox, option):
         """Action triggered on combobox 'changed' signal."""
         if combobox.get_has_entry():


Test patch: