r3078 - in trunk/src/target/OM-2007.2/libraries/libmokoui2: . libmokoui
chris at sita.openmoko.org
chris at sita.openmoko.org
Thu Oct 4 13:08:45 CEST 2007
Author: chris
Date: 2007-10-04 13:08:44 +0200 (Thu, 04 Oct 2007)
New Revision: 3078
Modified:
trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog
trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-finger-scroll.c
Log:
* libmokoui/moko-finger-scroll.c:
Really don't allow clicks after scrolling has begun, fix crash when
destroying widget while scrolling timeout is active
Modified: trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog 2007-10-04 10:16:48 UTC (rev 3077)
+++ trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog 2007-10-04 11:08:44 UTC (rev 3078)
@@ -1,3 +1,12 @@
+2007-10-04 Chris Lord <chris at openedhand.com>
+
+ * libmokoui/moko-finger-scroll.c: (moko_finger_scroll_timeout),
+ (moko_finger_scroll_motion_notify_cb),
+ (moko_finger_scroll_button_release_cb),
+ (moko_finger_scroll_dispose):
+ Really don't allow clicks after scrolling has begun, fix crash when
+ destroying widget while scrolling timeout is active
+
2007-10-01 Chris Lord <chris at openedhand.com>
* libmokoui/moko-finger-scroll.c: (moko_finger_scroll_get_topmost),
Modified: trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-finger-scroll.c
===================================================================
--- trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-finger-scroll.c 2007-10-04 10:16:48 UTC (rev 3077)
+++ trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-finger-scroll.c 2007-10-04 11:08:44 UTC (rev 3078)
@@ -66,6 +66,7 @@
gint iy;
gint cx; /* Initial click child window mouse co-ordinates */
gint cy;
+ guint idle_id;
GtkWidget *align;
gboolean hscroll;
@@ -345,13 +346,18 @@
MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (scroll);
if ((!priv->enabled) ||
- (priv->mode != MOKO_FINGER_SCROLL_MODE_ACCEL)) return FALSE;
+ (priv->mode != MOKO_FINGER_SCROLL_MODE_ACCEL)) {
+ priv->idle_id = 0;
+ return FALSE;
+ }
if (!priv->clicked) {
/* Decelerate gradually when pointer is raised */
priv->vel_x *= priv->decel;
priv->vel_y *= priv->decel;
- if ((ABS (priv->vel_x) < 1.0) && (ABS (priv->vel_y) < 1.0))
+ if ((ABS (priv->vel_x) < 1.0) && (ABS (priv->vel_y) < 1.0)) {
+ priv->idle_id = 0;
return FALSE;
+ }
}
moko_finger_scroll_scroll (scroll, priv->vel_x, priv->vel_y, &sx, &sy);
@@ -390,7 +396,8 @@
(ABS (x) > dnd_threshold) || (ABS (y) > dnd_threshold))) {
priv->moved = TRUE;
if (priv->mode == MOKO_FINGER_SCROLL_MODE_ACCEL) {
- g_timeout_add ((gint)(1000.0/(gdouble)priv->sps),
+ priv->idle_id = g_timeout_add (
+ (gint)(1000.0/(gdouble)priv->sps),
(GSourceFunc)moko_finger_scroll_timeout,
scroll);
}
@@ -461,7 +468,6 @@
g_get_current_time (¤t);
priv->clicked = FALSE;
- priv->moved = FALSE;
child = moko_finger_scroll_get_topmost (
GTK_BIN (priv->align)->child->window,
@@ -470,7 +476,10 @@
event->x = x;
event->y = y;
- if (!priv->child) return TRUE;
+ if (!priv->child) {
+ priv->moved = FALSE;
+ return TRUE;
+ }
/* Leave the widget if we've moved - This doesn't break selection,
* but stops buttons from being clicked.
@@ -493,6 +502,8 @@
if (priv->child)
g_object_remove_weak_pointer ((GObject *)priv->child,
&priv->child);
+
+ priv->moved = FALSE;
return TRUE;
}
@@ -674,6 +685,13 @@
static void
moko_finger_scroll_dispose (GObject * object)
{
+ MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (object);
+
+ if (priv->idle_id) {
+ g_source_remove (priv->idle_id);
+ priv->idle_id = 0;
+ }
+
if (G_OBJECT_CLASS (moko_finger_scroll_parent_class)->dispose)
G_OBJECT_CLASS (moko_finger_scroll_parent_class)->
dispose (object);
More information about the commitlog
mailing list