After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 752784 - Gdk.EventKey.is_modifier is always 0
Gdk.EventKey.is_modifier is always 0
Status: RESOLVED NOTABUG
Product: pygobject
Classification: Bindings
Component: gobject
3.16.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2015-07-23 14:22 UTC by David
Modified: 2016-03-03 07:55 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description David 2015-07-23 14:22:29 UTC
As the summary says.  Im using the latest arch package 3.16.  Simple test case (just press a modifier):

from gi.repository import Gtk


def onKeyPress(wid, ev):
    print(ev.is_modifier)

win = Gtk.Window()
win.connect("delete_event", Gtk.main_quit)
win.connect("key_press_event", onKeyPress)
win.show_all()

Gtk.main()
Comment 1 David 2015-07-24 11:57:06 UTC
I just installed from git.  The bug is there too.
Comment 2 Simon Feltman 2016-03-03 07:55:54 UTC
The "is_modifier" field is a bit of a misnomer, please read through [1]. What you want is the "state" field:

    def onKeyPress(wid, ev):
        print(ev.state & Gdk.ModifierType.SHIFT_MASK)


[1] https://lazka.github.io/pgi-docs/#Gdk-3.0/structs/EventKey.html