[gtkmm] motion notify troubles



I'm having trouble getting motion notify events to be recognized in a
Gtk::DrawingArea. It seems like it is only being notified when I enter
the DrawingArea, and then the event is a pointer motion hint. Nothing is
received when I move around in the DrawingArea. Here's some relevant
code:

---------------------------------------------------------
class DrawWindow : public Gtk::Window {
  Gtk::DrawingArea m_DrawingArea;
  bool on_drawingarea_motion_notify_event(GdkEventMotion* event);
  DrawWindow();
};

DrawWindow::DrawWindow {
  add(m_DrawingArea);
  m_DrawingArea.set_size_request(100, 100);
  m_DrawingArea.signal_motion_notify_event().connect(
     SigC::slot(*this, &DrawWindow::on_drawingarea_motion_notify_event));
  m_DrawingArea.set_events(Gdk::ALL_EVENTS_MASK);
  show_all();
}

bool DrawWindow::on_drawingarea_motion_notify_event(GdkEventMotion *event) {
  if (event->is_hint)
    printf("foo.\n");
  else
    printf("bar.\n");
}
---------------------------------------------------------

I only ever get "foo." on stdout, and then only when entering the
widget. What am I doing wrong?

Thanks,
Eric




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