Search code examples
c++gtkmm

gtkmm x events are not working


I am trying to handle x events for a drawing area widget so the user can pan around and draw on it. Press event and release event handlers are called but not the motion notify event. I added Gdk::POINTER_MOTION_MASK and overrode on_motion_notify_event(GdkEventButton *event) handler but it doesn't get called. Am I doing something wrong?


Solution

  • If you did exactly what you stated, the problem is that you overloaded the right method name, but the wrong argument type. The correct overload is this (from the docs):

      virtual bool Gtk::Widget::on_motion_notify_event(GdkEventMotion * event)
    

    Note the different argument type.