Mouse wheel in Gtk+-2.0



Hi, the following program works as I expect in Gtk+-1.2 as I get output for
buttons 1-3 and the wheel buttons 4 and 5.  But when compiled under Gtk+-2.0
the callback is never called for wheel button events, only for buttons 1-3.

Does something need to be set up differently for Gtk+-2.0?

Thanks,

Bill

----------------------

static gint
cb_button_press(GtkWidget *widget, GdkEventButton *ev)
        {
        printf("Mouse button %d pressed.\n", ev->button);
        return TRUE;
        }

gint main(gint argc, gchar *argv[])
        {
        GtkWidget *window, *drawing_area;
    
        gtk_init (&argc, &argv);

        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        drawing_area = gtk_drawing_area_new();
        gtk_container_add (GTK_CONTAINER(window), drawing_area);
        gtk_widget_set_events(drawing_area,
                        GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK);
        gtk_widget_show_all(window);
        gtk_signal_connect(GTK_OBJECT(drawing_area), "button_press_event",
                (GtkSignalFunc) cb_button_press, NULL);

        gtk_main ();
    
        return(0);
        }



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