#10 gdkevent type in ruby-gtk-0.28

closed
Masao Mutoh
ruby-gnome (11)
5
2002-06-30
2002-06-27
Anonymous
No

I use ruby-gtk-0.28.
I want to get a double click event through
Gdk::BUTTON2_PRESS but I cannot get it.
I think with the following script
e.type should have Gdk::BUTTON_PRESS
or Gdk::BUTTON2_PRESS or other,
but it has Gdk::EventButton.

%cat test.rb
require 'gtk'

w = Gtk::Window.new
b = Gtk::Button.new("test")
b.signal_connect("button_press_event"){|w, e|
p e.type
}

w.add b
w.show_all
Gtk.main

I think rbgdkevent.c should have following lines.
+static VALUE
+gdkeventbutton_type(self)
+{
+ return INT2NUM(get_gdkevent(self)->button.type);
+}

+rb_define_method(gdkEventButton, "type",
+gdkeventbutton_type, 0);

Other Event class such as GdkEventKey
should be changed too.

Discussion

  • Masao Mutoh
    Masao Mutoh
    2002-06-30

    • labels: --> ruby-gnome
    • assigned_to: nobody --> mutoh
    • status: open --> closed
     
  • Masao Mutoh
    Masao Mutoh
    2002-06-30

    Logged In: YES
    user_id=495147

    e.type means Object#type. Object#type return reciever's class.
    I think we should not override it for this perpose.
    So there is Gdk::Event#event_type already, please use it.