Gtk::Widget->set_events( ) example won't work



I'm having trouble with some lines which appear in the Gtk-Perl tutorial
at http://personal.riverusers.com/~swilhelm/gtkperl-tutorial/pixmap.html

My setup:
        $ uname -a ; cat /etc/redhat-release 
                Linux speare9 2.4.18-4smp #1 SMP ... i686 unknown
                Red Hat Linux release 7.3 (Valhalla)
        $ rpm -qa | grep gtk+
                gtk+-1.2.10-15
                gtk+10-1.0.6-10
                gtk+-devel-1.2.10-15
        $ rpm -qa | grep Gtk
                Gtk-Perl-0.7008-13

The tutorial states,
        To make the wheelbarrow image sensitive, we could attach the
        button press event signal to make it do something. The
        following few lines would make the picture sensitive to a
        mouse button being pressed which makes the application
        terminate.

        $window->set_events( [ $window->get_events(),
                             'button_press_mask' ] );
        $window->signal_connect( "button_press_event",
                                 sub { Gtk->exit( 0 ); } );

However, I cannot get the set_events() call to work.  Perhaps the API
has changed?  My $window is a realize()'d Gtk::Pixmap instance.  The
error is:

        invalid GdkEventMask value HASH(0x81bcecc), expecting:
        exposure-mask, pointer-motion-mask, pointer-motion-hint-mask,
        button-motion-mask, button1-motion-mask, button2-motion-mask,
        button3-motion-mask, button-press-mask, button-release-mask,
        key-press-mask, key-release-mask, enter-notify-mask,
        leave-notify-mask, focus-change-mask, structure-mask,
        property-change-mask, visibility-notify-mask,
        proximity-in-mask, proximity-out-mask, substructure-mask,
        all-events-mask,  at ./innaminute_applet line 71.

With some google work, I find that Gtk::Widget::set_events() expects the
widget and an argument of type Gtk::Gdk::EventMask, not a list
reference, and not a string.  Changing the example from
'button_press_mask' to 'button-press-mask' does not affect the error.

The return value of Gtk::Widget::get_events() appears to be of type HASH
since the bindings aren't perl-blessing the type names, but it appears
it is actually Gtk::Gdk::EventMask.

Since there's no documented operations for type Gtk::Gdk::EventMask, and
since the example doesn't seem to work, how else can I add sensitivity
to a range of event types to a given widget?

-- 
[ e d @ h a l l e y . c c ]



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