[maemo-commits] [maemo-commits] r9730 - in projects/haf/branches/gtk+/maemo-gtk-2-10: . gdk gtk

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Feb 7 20:11:08 EET 2007
Author: timj
Date: 2007-02-07 20:11:03 +0200 (Wed, 07 Feb 2007)
New Revision: 9730

Modified:
   projects/haf/branches/gtk+/maemo-gtk-2-10/ChangeLog
   projects/haf/branches/gtk+/maemo-gtk-2-10/gdk/gdkevents.c
   projects/haf/branches/gtk+/maemo-gtk-2-10/gdk/gdkevents.h
   projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkaboutdialog.c
   projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkentry.c
   projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkhruler.c
   projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkhsv.c
   projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkspinbutton.c
   projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtktextview.c
   projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkvruler.c
Log:
Tue Feb  6 15:53:59 2007  Tim Janik  <timj at 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().
 



Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/ChangeLog
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/ChangeLog	2007-02-07 17:09:01 UTC (rev 9729)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/ChangeLog	2007-02-07 18:11:03 UTC (rev 9730)
@@ -1,3 +1,17 @@
+Tue Feb  6 15:53:59 2007  Tim Janik  <timj at 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-07  Kristian Rietveld  <kris at imendio.com>
 
 	* gtk/gtkdialog.c: revert last change, since it will be replaced

Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/gdk/gdkevents.c
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/gdk/gdkevents.c	2007-02-07 17:09:01 UTC (rev 9729)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/gdk/gdkevents.c	2007-02-07 18:11:03 UTC (rev 9730)
@@ -835,6 +835,26 @@
 }
 
 /**
+ * gdk_event_request_motions:
+ * @event: a valid #GdkEvent
+ *
+ * Request more motion notifies if #event is a motion notify hint event.
+ * This function 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
  * @screen: a #GdkScreen

Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/gdk/gdkevents.h
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/gdk/gdkevents.h	2007-02-07 17:09:01 UTC (rev 9729)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/gdk/gdkevents.h	2007-02-07 18:11:03 UTC (rev 9730)
@@ -529,6 +529,7 @@
 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);

Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkaboutdialog.c
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkaboutdialog.c	2007-02-07 17:09:01 UTC (rev 9729)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkaboutdialog.c	2007-02-07 18:11:03 UTC (rev 9730)
@@ -1801,7 +1801,7 @@
 
   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;
 }

Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkentry.c
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkentry.c	2007-02-07 17:09:01 UTC (rev 9729)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkentry.c	2007-02-07 18:11:03 UTC (rev 9730)
@@ -1964,8 +1964,7 @@
   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);
+  gdk_event_request_motions (event);
 
   if (entry->in_drag)
     {

Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkhruler.c
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkhruler.c	2007-02-07 17:09:01 UTC (rev 9729)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkhruler.c	2007-02-07 18:11:03 UTC (rev 9730)
@@ -89,10 +89,8 @@
 
   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");

Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkhsv.c
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkhsv.c	2007-02-07 17:09:01 UTC (rev 9729)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkhsv.c	2007-02-07 18:11:03 UTC (rev 9730)
@@ -851,18 +851,11 @@
   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);

Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkspinbutton.c
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkspinbutton.c	2007-02-07 17:09:01 UTC (rev 9729)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkspinbutton.c	2007-02-07 18:11:03 UTC (rev 9730)
@@ -1148,9 +1148,9 @@
 
   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)

Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtktextview.c
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtktextview.c	2007-02-07 17:09:01 UTC (rev 9729)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtktextview.c	2007-02-07 18:11:03 UTC (rev 9730)
@@ -4225,10 +4225,10 @@
   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, 

Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkvruler.c
===================================================================
--- projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkvruler.c	2007-02-07 17:09:01 UTC (rev 9729)
+++ projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkvruler.c	2007-02-07 18:11:03 UTC (rev 9730)
@@ -90,10 +90,8 @@
 
   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");


More information about the maemo-commits mailing list