Indicator scroll event says direction UP on 12.10 even when scrolling down

Bug #1075152 reported by Peter Levi
82
This bug affects 18 people
Affects Status Importance Assigned to Milestone
Application Indicators
Confirmed
Undecided
Unassigned
indicator-application (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I am using AppIndicator via Python. On Ubuntu 12.10 (stock install, python-appindicator: Installed: 12.10.0-0ubuntu1) when I listen for scroll event signals, the direction is always reported as UP, never as DOWN - even when scrolling down. This was working on 12.04.

My application variety depends on this functionality, here is the relevant bug report for it: https://bugs.launchpad.net/variety/+bug/1071598

Here is sample code to demonstrate the problem (OK on 12.04, buggy on 12.10):

from gi.repository import Gtk, Gdk, AppIndicator3

if __name__ == "__main__":
    menu = Gtk.Menu()
    quit = Gtk.MenuItem("Quit")
    quit.connect("activate", Gtk.main_quit)
    menu.append(quit)
    menu.show_all()

    def scroll(ind, steps, direction):
        print steps, direction
        if direction != Gdk.ScrollDirection.UP:
            print "Things seem ok"

    indicator = AppIndicator3.Indicator.new('testscroll', '', AppIndicator3.IndicatorCategory.APPLICATION_STATUS)
    indicator.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
    indicator.set_icon("/usr/share/pixmaps/firefox.png")
    indicator.connect("scroll-event", scroll)
    indicator.set_menu(menu)
    Gtk.main()

Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) wrote :

I am unable to run your sample code on 12.10. What am I missing?

alan@wopr:~$ python scroll.py
Traceback (most recent call last):
  File "scroll.py", line 1, in <module>
    from gi.repository import Gtk, Gdk, AppIndicator3
  File "/usr/lib/python2.7/dist-packages/gi/importer.py", line 76, in load_module
    dynamic_module._load()
  File "/usr/lib/python2.7/dist-packages/gi/module.py", line 244, in _load
    overrides_modules = __import__('gi.overrides', fromlist=[self._namespace])
  File "/usr/lib/python2.7/dist-packages/gi/overrides/Gtk.py", line 1624, in <module>
    raise RuntimeError("Gtk couldn't be initialized")
RuntimeError: Gtk couldn't be initialized
alan@wopr:~$

Revision history for this message
Peter Levi (peterlevi) wrote :

Hm, I'm running it on a fairly stock Ubuntu 12.10 installation, only Variety is installed. So you probably need some of the dependencies of Variety, let's see - can you please try installing gir1.2-gtk-3.0. If this is not enough, you may simply install Variety (sudo add-apt-repository ppa:peterlevi/ppa && sudo apt-get update && sudo apt-get install variety), it will fetch the other dependencies too...

If you manage to run it, a firefox indicator icon should appear, scrolling back and forth over it will print the scroll direction in the terminal.

Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) wrote :

That was it, yes, confirmed the issue here too.

Changed in indicator-application:
status: New → Confirmed
Revision history for this message
GdH (georgdh) wrote :

5 month and still no fix, not even in 13.04. I haven't noticed the change in API documentation... For users I'm the idiot, whose app doesn't work properly. Please fix this.

Revision history for this message
Peter Levi (peterlevi) wrote :

Is anyone going to look at this and at least make some note here on the state of things?? 13.04 is here and this is still present.

Revision history for this message
Mendhak (mendhak) wrote :

I'm not well versed in C, but I think this is where the signal is being emitted or defined.

http://bazaar.launchpad.net/~indicator-applet-developers/libindicator/trunk.13.10/view/head:/libindicator/indicator-object.c#L202

I did a grep on the source code but couldn't see where 'INDICATOR_OBJECT_TYPE_SCROLL_DIRECTION' was being defined. Could that be a reason or does that variable get 'added in' at a later point?

Revision history for this message
Ian Dawson (ian-dawson-uk) wrote :

I think my code looks similar... :

IndAp.connect("scroll-event", scrollEvt)
...
def scrollEvt(ind, steps, direction):
etc

ind = is the app indicator object
steps always seems to give me a "1"
direction seems to give a "0" for up and a "1" for down.

I am on Ubuntu 12.04

Revision history for this message
Peter Levi (peterlevi) wrote :

12.04 is not a problem, things work there. 12.10, 13.04 have the bug, not sure about 13.10.
It seems to me the problem is in the Python bindings, not in the underlying layer, as other applications seem to get scroll events just fine.

Revision history for this message
GdH (georgdh) wrote :

This is definitely problem in the Python binding, appindicator works fine in C and Vala.

Revision history for this message
Dabo Ross (daboross) wrote :

I've just encountered this, anyone figured anything about it so far?

This is my test indicator: http://hasteb.in/nuyokanobe.py

This is the output for scrolling up, down, left and right: http://hasteb.in/biqadakoqo.py

Revision history for this message
Jason Conti (jconti) wrote :

The problem is the annotation to scroll-event in http://bazaar.launchpad.net/~indicator-applet-developers/libappindicator/trunk.13.10/view/head:/src/app-indicator.c

It is type Gdk.ScrollDirection. This was a change between 12.04 and 12.10. If you drop the annotation it will work by unpacking an int instead (as can be seen in the example output from 12.04 above).

So ultimately a problem in the python gi, since it doesn't seem able to deal with the ScrollDirection enum, but the trigger is the annotation in libappindicator. (Though I haven't tested in 13.10 yet)

Revision history for this message
Dex (dex-stb) wrote :

14.04

still affected

Revision history for this message
Magnus Brink (mangethegamer) wrote :

14.04. 1 1/2 years since i first noticed this bug.

Revision history for this message
Peter Levi (peterlevi) wrote :

I reported the bug on Gnome's bugzilla for the pygobject product:
https://bugzilla.gnome.org/show_bug.cgi?id=732470

Let's see if this would make someone pay some attention to this long-standing issue.

Revision history for this message
Peter Levi (peterlevi) wrote :

This comment from a pygobject developer casts more insight and claims the problem is in libappindicator:

https://bugzilla.gnome.org/show_bug.cgi?id=732470#c5

Citing:
"The issue seems to be related to libappindicator using a GI annotation for the
scroll-events direction with (type Gdk.ScrollDirection), whereas the signal is
created using G_TYPE_UINT as the GValue argument type [1]. Emitting
'scroll-event' either with dbus or Python as Christoph has shown passes a
GValue holding an integer. When pygobject receives the signal, it tries to
marshal this GValue as an enum based on the introspection information (using
g_value_get_enum) which is what causes the assertion shown above. Beyond the
assertion warning, g_value_get_enum() also returns 0 which ends up being
GTK_SCROLL_UP (very similar to bug 693664).

We could hack around this in pygobject by also accepting integer types as valid
enum values, but I believe the root of the problem lies in libappindicator
using an annotation which differs in fundamental type than what the signal
describes for its GValue marshaller (G_TYPE_ENUM vs. G_TYPE_UINT).

[1]
http://bazaar.launchpad.net/~indicator-applet-developers/libappindicator/trunk.14.10/view/head:/src/app-indicator.c#L526
"

Revision history for this message
henczati (henczati) wrote :

+1 on Lubuntu/LXDE.

Variety Version: 0.4.20
Desktop Environment: LXDE
OS: Lubuntu 14.04 amd64

$ apt-cache policy gir1.2-appindicator3-0.1 indicator-application indicator-application-gtk2 libappindicator1 libappindicator3-1 libindicator3-7 libindicator7 lxpanel-indicator-applet-plugin | sed '/^[^ ]/ {n;p}; d'
gir1.2-appindicator3-0.1:
  Installed: 12.10.1+13.10.20130920-0ubuntu4
indicator-application:
  Installed: 12.10.1+14.04.20140407-0ubuntu1
indicator-application-gtk2:
  Installed: 12.10.0.1-0ubuntu2
libappindicator1:
  Installed: 12.10.1+13.10.20130920-0ubuntu4
libappindicator3-1:
  Installed: 12.10.1+13.10.20130920-0ubuntu4
libindicator3-7:
  Installed: 12.10.2+14.04.20140402-0ubuntu1
libindicator7:
  Installed: 12.10.2+14.04.20140402-0ubuntu1
lxpanel-indicator-applet-plugin:
  Installed: 0.6.1-0ubuntu3

Ted Gould (ted)
Changed in indicator-application (Ubuntu):
status: New → Confirmed
Mathew Hodson (mhodson)
tags: removed: scroll
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.