Global motion events



In bug 302486 

     http://bugzilla.gnome.org/show_bug.cgi?id=302486

there is a patch that adds the ability to get crossing events on a
widget basis, instead of on a window basis. What this means is that a
widget will receive enter/leave events even if it is NO_WINDOW widget
or covered by a window created by its parent.

This is needed to make prelighting of notebook tabs possible
(http://bugzilla.gnome.org/show_bug.cgi?id=153966). Without global
motion events, window widgets that didn't select crossing events would
make it impossible for the GtkNotebook to track the cursor. 

Another thing this is needed for is making tooltips possible without
relying on widgets having windows and selecting for
motion/enter/leave. Also it will make it possible to have tooltips for
insensitive widgets.

The API added to GDK is:

  typedef void (* GdkMotionHandler) (GdkWindow * window,
                                    gint         x,
                                    gint         y,
                                    gdouble      x_root,
                                    gdouble      y_root,
                                    gint         mask,
                                    gpointer     data);

  void   gdk_set_motion_handler  (GdkWindow         window,
                                  GdkMotionHandler  handler,
                                  gpointer          data);

The motion handler is called whenever the cursor moves within the
window and isn't clipped by a sibling window.

The API added to GTK is three new signals:

  void        (*global_enter)       (GtkWidget *widget,
                                     gint       x,
                                     gint       y);
  void         (*global_leave)      (GtkWidget *widget);
  void        (*global_motion)      (GtkWidget *widget,
                                     gint       x,
                                     gint       y);



Søren



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