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 602773 - GdkEventKey.is_modifier is 0 for Shift, Ctrl, Alt keys
GdkEventKey.is_modifier is 0 for Shift, Ctrl, Alt keys
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.18.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2009-11-23 20:18 UTC by Adam Dingle
Modified: 2016-09-17 20:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GDK W32: Set is_modifier field in GdkKeyEvent (1.35 KB, patch)
2016-09-17 15:15 UTC, LRN
committed Details | Review

Description Adam Dingle 2009-11-23 20:18:23 UTC
On Windows, when a key-press-event is received after the user presses Shift, Ctrl or Alt, the GdkEventKey.is_modifier flag is 0.  It should be 1.

To see the problem, build the following program and press a key such as Shift.  I'm using GTK 2.18.3 on Windows 7.

== test.c ==

// build with: gcc -Wall test.c `pkg-config --cflags --libs gtk+-2.0` -o test

#include <stdio.h>
#include <gtk/gtk.h>

static gboolean key_press_event(GtkWidget *widget, GdkEventKey *event) {
    printf("is_modifier = %u\n", event->is_modifier);
    return TRUE;
}

int main(int argc, char *argv[]) {
    gtk_init(&argc, &argv);

    GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_show_all(window);

    g_signal_connect(G_OBJECT(window), "key-press-event",
                     G_CALLBACK(key_press_event), NULL);

    gtk_main();
    return 0;
}

== end ==
Comment 1 LRN 2016-09-17 15:15:54 UTC
Created attachment 335764 [details] [review]
GDK W32: Set is_modifier field in GdkKeyEvent

This hardcodes Control, Alt and Shift as modifier keys.
Comment 2 Ignacio Casal Quinteiro (nacho) 2016-09-17 15:29:39 UTC
Review of attachment 335764 [details] [review]:

Looks good.
Comment 3 LRN 2016-09-17 20:24:56 UTC
Attachment 335764 [details] pushed as 0274b2c - GDK W32: Set is_modifier field in GdkKeyEvent