call gdk_event_request_motions() for new motion events after receiving

Tue Feb  6 15:53:59 2007  Tim Janik  <timj@imendio.com>

        * gtk/gtktextview.c (gtk_text_view_motion_event):
        * gtk/gtkspinbutton.c (gtk_spin_button_motion_notify):
        * gtk/gtkaboutdialog.c (credits_motion_notify_event):
        * gtk/gtkhruler.c (gtk_hruler_motion_notify):
        * gtk/gtkvruler.c (gtk_vruler_motion_notify): 
        * gtk/gtkentry.c (gtk_entry_motion_notify):
        * gtk/gtktooltip.c (_gtk_tooltip_handle_event):
        * gtk/gtkhsv.c (gtk_hsv_motion): call gdk_event_request_motions()                              
        for new motion events after receiving motion hints.

        * gdk/gdkevents.[hc]: added gdk_event_request_motions().



svn path=/trunk/; revision=17269
This commit is contained in:
Tim Janik 2007-02-06 14:53:35 +00:00 committed by Tim Janik
parent aef468ebbf
commit caa4d15dab
11 changed files with 54 additions and 31 deletions

View File

@ -1,3 +1,17 @@
Tue Feb 6 15:53:59 2007 Tim Janik <timj@imendio.com>
* gtk/gtktextview.c (gtk_text_view_motion_event):
* gtk/gtkspinbutton.c (gtk_spin_button_motion_notify):
* gtk/gtkaboutdialog.c (credits_motion_notify_event):
* gtk/gtkhruler.c (gtk_hruler_motion_notify):
* gtk/gtkvruler.c (gtk_vruler_motion_notify):
* gtk/gtkentry.c (gtk_entry_motion_notify):
* gtk/gtktooltip.c (_gtk_tooltip_handle_event):
* gtk/gtkhsv.c (gtk_hsv_motion): call gdk_event_request_motions()
for new motion events after receiving motion hints.
* gdk/gdkevents.[hc]: added gdk_event_request_motions().
2007-02-06 Kristian Rietveld <kris@imendio.com>
* gtk/gtktooltip.c (find_topmost_widget_coords_from_event):

View File

@ -834,6 +834,26 @@ gdk_event_get_axis (GdkEvent *event,
return gdk_device_get_axis (device, axes, axis_use, value);
}
/**
* gdk_event_request_motions:
* @event: a valid #GdkEvent
*
* Request more motion notifies if #event is a motion notify hint event.
* This funciton should be used instead of gdk_window_get_pointer() to
* request further motion notifies, because it also works for extension
* events where motion notifies are provided for devices other than the
* core pointer.
*
* Since: 2.12
**/
void
gdk_event_request_motions (GdkEventMotion *event)
{
g_return_if_fail (event != NULL);
if (event->type == GDK_MOTION_NOTIFY && event->is_hint)
gdk_device_get_state (event->device, event->window, NULL, NULL);
}
/**
* gdk_event_set_screen:
* @event: a #GdkEvent

View File

@ -529,6 +529,7 @@ gboolean gdk_event_get_root_coords (GdkEvent *event,
gboolean gdk_event_get_axis (GdkEvent *event,
GdkAxisUse axis_use,
gdouble *value);
void gdk_event_request_motions (GdkEventMotion *event);
void gdk_event_handler_set (GdkEventFunc func,
gpointer data,
GDestroyNotify notify);

View File

@ -1781,7 +1781,7 @@ credits_motion_notify_event (GtkWidget *text_view,
set_cursor_if_appropriate (about, GTK_TEXT_VIEW (text_view), x, y);
gdk_window_get_pointer (text_view->window, NULL, NULL, NULL);
gdk_event_request_motions (event);
return FALSE;
}

View File

@ -1872,8 +1872,8 @@ gtk_entry_motion_notify (GtkWidget *widget,
if (entry->select_lines)
return TRUE;
if (event->is_hint || (entry->text_area != event->window))
gdk_window_get_pointer (entry->text_area, NULL, NULL, NULL);
if (entry->text_area != event->window)
gdk_event_request_motions (event);
if (entry->in_drag)
{

View File

@ -89,10 +89,8 @@ gtk_hruler_motion_notify (GtkWidget *widget,
ruler = GTK_RULER (widget);
if (event->is_hint)
gdk_window_get_pointer (widget->window, &x, NULL, NULL);
else
x = event->x;
gdk_event_request_motions (event);
x = event->x;
ruler->position = ruler->lower + ((ruler->upper - ruler->lower) * x) / widget->allocation.width;
g_object_notify (G_OBJECT (ruler), "position");

View File

@ -851,18 +851,11 @@ gtk_hsv_motion (GtkWidget *widget,
if (priv->mode == DRAG_NONE)
return FALSE;
if (event->is_hint)
{
gdk_window_get_pointer (priv->window, &ix, &iy, &mods);
x = ix;
y = iy;
}
else
{
x = event->x;
y = event->y;
}
gdk_event_request_motions (event);
x = event->x;
y = event->y;
mods = event->state;
if (priv->mode == DRAG_H)
{
gtk_hsv_set_color (hsv, compute_v (hsv, x, y), priv->s, priv->v);

View File

@ -1148,9 +1148,9 @@ gtk_spin_button_motion_notify (GtkWidget *widget,
if (event->window == spin->panel)
{
gint y;
gdk_window_get_pointer (spin->panel, NULL, &y, NULL);
gint y = event->y;
gdk_event_request_motions (event);
if (y <= widget->requisition.height / 2 &&
spin->in_child == GTK_ARROW_DOWN)

View File

@ -4170,10 +4170,10 @@ gtk_text_view_motion_event (GtkWidget *widget, GdkEventMotion *event)
if (event->window == text_view->text_window->bin_window &&
text_view->drag_start_x >= 0)
{
gint x, y;
gint x = event->x;
gint y = event->y;
gdk_window_get_pointer (text_view->text_window->bin_window,
&x, &y, NULL);
gdk_event_request_motions (event);
if (gtk_drag_check_threshold (widget,
text_view->drag_start_x,

View File

@ -997,8 +997,7 @@ _gtk_tooltip_handle_event (GdkEvent *event)
}
/* Always poll for a next motion event */
if (event->type == GDK_MOTION_NOTIFY && event->motion.is_hint)
gdk_window_get_pointer (event->any.window, NULL, NULL, NULL);
gdk_event_request_motions (&event->motion);
/* Hide the tooltip when there's no new tooltip widget */
if (!has_tooltip_widget)

View File

@ -90,10 +90,8 @@ gtk_vruler_motion_notify (GtkWidget *widget,
ruler = GTK_RULER (widget);
if (event->is_hint)
gdk_window_get_pointer (widget->window, NULL, &y, NULL);
else
y = event->y;
gdk_event_request_motions (event);
y = event->y;
ruler->position = ruler->lower + ((ruler->upper - ruler->lower) * y) / widget->allocation.height;
g_object_notify (G_OBJECT (ruler), "position");