r3110 - in trunk/src/target/OM-2007.2/libraries/libmokoui2: . libmokoui
chris at sita.openmoko.org
chris at sita.openmoko.org
Mon Oct 8 12:06:41 CEST 2007
Author: chris
Date: 2007-10-08 12:06:39 +0200 (Mon, 08 Oct 2007)
New Revision: 3110
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:
Import window-ordering fix from libhildondesktop, fix odd
event-eating bug where only 2nd click after using MokoFingerScroll
outside of a MokoFingerScroll would work
Modified: trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog 2007-10-08 10:06:00 UTC (rev 3109)
+++ trunk/src/target/OM-2007.2/libraries/libmokoui2/ChangeLog 2007-10-08 10:06:39 UTC (rev 3110)
@@ -1,3 +1,14 @@
+2007-10-08 Chris Lord <chris at openedhand.com>
+
+ * libmokoui/moko-finger-scroll.c: (get_ordered_children),
+ (moko_finger_scroll_get_topmost),
+ (moko_finger_scroll_button_press_cb),
+ (moko_finger_scroll_motion_notify_cb),
+ (moko_finger_scroll_button_release_cb):
+ Import window-ordering fix from libhildondesktop, fix odd
+ event-eating bug where only 2nd click after using MokoFingerScroll
+ outside of a MokoFingerScroll would work
+
2007-10-04 Chris Lord <chris at openedhand.com>
* libmokoui/moko-finger-scroll.c: (moko_finger_scroll_timeout),
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-08 10:06:00 UTC (rev 3109)
+++ trunk/src/target/OM-2007.2/libraries/libmokoui2/libmokoui/moko-finger-scroll.c 2007-10-08 10:06:39 UTC (rev 3110)
@@ -35,6 +35,7 @@
* - 'Physical' mode for acceleration scrolling
*/
+#include <gdk/gdkx.h>
#include "moko-finger-scroll.h"
G_DEFINE_TYPE (MokoFingerScroll, moko_finger_scroll, GTK_TYPE_EVENT_BOX)
@@ -88,6 +89,30 @@
PROP_SPS,
};
+/* Following function inherited from libhildondesktop */
+static GList *
+get_ordered_children (GdkWindow *window)
+{
+ Window *children, root, parent;
+ guint i, n_children = 0;
+ GList *ret = NULL;
+
+ gdk_error_trap_push ();
+ XQueryTree (GDK_DISPLAY (), GDK_WINDOW_XID (window), &root,
+ &parent, &children, &n_children);
+
+ if (gdk_error_trap_pop ()) return NULL;
+
+ for (i = 0; i < n_children; i++) {
+ GdkWindow *window = gdk_window_lookup (children[i]);
+ if (window) ret = g_list_prepend (ret, window);
+ }
+
+ XFree (children);
+
+ return ret;
+}
+
static GdkWindow *
moko_finger_scroll_get_topmost (GdkWindow *window, gint x, gint y,
gint *tx, gint *ty)
@@ -105,8 +130,9 @@
while (window) {
gint child_x = 0, child_y = 0;
- GList *c, *children = gdk_window_peek_children (window);
+ GList *c, *children = get_ordered_children (window);
GdkWindow *old_window = window;
+
for (c = children; c; c = c->next) {
GdkWindow *child = (GdkWindow *)c->data;
gint wx, wy;
@@ -122,6 +148,9 @@
window = child;
}
}
+
+ g_list_free (children);
+
/*g_debug ("\\|/");*/
if (window == old_window) break;
@@ -174,7 +203,7 @@
if ((!priv->enabled) || (priv->clicked) || (event->button != 1) ||
((event->time == priv->last_time) &&
- (event->type == priv->last_type))) return FALSE;
+ (event->type == priv->last_type))) return TRUE;
g_get_current_time (&priv->click_start);
priv->last_type = event->type;
@@ -382,7 +411,7 @@
if ((!priv->enabled) || (!priv->clicked) ||
((event->time == priv->last_time) &&
- (event->type == priv->last_type))) return FALSE;
+ (event->type == priv->last_type))) return TRUE;
/* Only start the scroll if the mouse cursor passes beyond the
* DnD threshold for dragging.
@@ -461,7 +490,7 @@
if ((!priv->clicked) || (!priv->enabled) || (event->button != 1) ||
((event->time == priv->last_time) &&
(event->type == priv->last_type)))
- return FALSE;
+ return TRUE;
priv->last_type = event->type;
priv->last_time = event->time;
@@ -499,9 +528,8 @@
synth_crossing (priv->child, x, y, event->x_root,
event->y_root, event->time, FALSE);
}
- if (priv->child)
- g_object_remove_weak_pointer ((GObject *)priv->child,
- &priv->child);
+ g_object_remove_weak_pointer ((GObject *)priv->child,
+ &priv->child);
priv->moved = FALSE;
More information about the commitlog
mailing list