Re: [GtkGLExt] how do I caption mouse motion events?



Peter wrote:
Howdy,

I'm trying to get a very simple OpenGL application going in gtkmm. I have experience with glut, and at this point I'm just trying to figure out how to do very simple things in gtk. In fact, I started with the gtkglextmm gears demo on the web site, and gradually made changes putting in my drawing instead. The next thing I need for porting our app from glut is to capture mouse motion on the gl drawing area and react accordingly. I've tried overriding the on_motion_notify_event method for both the drawing area and the GtkWindow, but I can't seem to get that event to come through. I can get other events, such as on_expose_event to come through obviously because I'm getting my drawing up on the screen. Am I going after the wrong event or do I need to do more than just override on_motion_notify_event?

For efficiency, many widgets don't process mouse and other events by default, and you have to explicitly enable them on a case-by-case basis. See the documentation for Gtk::Widget::add_events() - you probably want to add Gdk::BUTTON_MOTION_MASK or one of its more specialized variations.

Cheers,
Tim



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