Gdk motion event changed behavior in 2.18



Hi all,

after upgrading GTK+ from 2.16.4 to 2.18.2, an application I was
working on stopped to react to GDK_BUTTON2_MOTION_MASK events. I
resolved by adding GDK_BUTTON_PRESS_MASK but this issue will likely
affect other applications too. A simple test case attached.

Ciao.
-- 
Nicola
/* gcc -o event `pkg-config --cflags --libs gtk+-2.0` event.c */

#include <gtk/gtk.h>

static gboolean
event_grabber(GtkWidget *widget, GdkEvent *event)
{
    g_print("%d\n", event->type);
    return FALSE;
}

int
main(gint argc, gchar **argv)
{
    GtkWidget *window;
    GtkWidget *widget;

    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    widget = gtk_drawing_area_new();
    /* 2.16 works with GDK_BUTTON2_MOTION_MASK only */
    gtk_widget_add_events(widget, GDK_BUTTON_PRESS_MASK|
                                  GDK_BUTTON2_MOTION_MASK);
    g_signal_connect(widget, "motion-notify-event",
                     G_CALLBACK(event_grabber), NULL);
    gtk_container_add(GTK_CONTAINER(window), widget);

    gtk_widget_show_all(window);
    gtk_main();

    return 0;
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]