Hi,
I'm trying to make clutter+tidy working on a Imx31 SOM module ( --with-
flavour=eglnative) .
test-finger-scroll is not working well :
1- the scroll-bar does not vanish after sweeping the screen with one
finger
2- there is not deceleration effects
I found that the issue is on the clutter-event-egl.c file.
The "visible" issue is that the CLUTTER_MOTION event should be
followed by a CLUTTER_BUTTON_RELEASE. Witch it is not the case.
This causes the 1 & 2 issues.
After spending hours on this file, I found that clutter_event_dispatch
function occur less often than new TS samples.
This function will make ts_read one time even there is more than 1
sample pending.
I attached to this mail a possible fix, witch empty the ts stream at
the beginning of each the clutter_event_dispatch.
Any comments are welcome.
regards
olivier
--- /home/olivier/Desktop/clutter-0.7.6/clutter/eglnative/clutter-event-egl.c
2008-06-10 14:20:20.000000000 +0200
+++ clutter-event-egl.c 2008-07-08 08:30:28.000000000 +0200
@@ -107,7 +107,7 @@
source = backend_egl->event_source = clutter_event_source_new (backend);
event_source = (ClutterEventSource *) source;
- event_source->ts_device = ts_open (g_getenv ("TSLIB_TSDEVICE"), 0);
+ event_source->ts_device = ts_open (g_getenv ("TSLIB_TSDEVICE"), 1 /*0*/);
if (event_source->ts_device)
{
@@ -127,7 +127,7 @@
event_sources = g_list_prepend (event_sources, event_source);
g_source_add_poll (source, &event_source->event_poll_fd);
- g_source_set_can_recurse (source, TRUE);
+ g_source_set_can_recurse (source, TRUE );
g_source_attach (source, NULL);
}
else
@@ -208,29 +208,55 @@
ClutterBackend *backend = ((ClutterEventSource *) source)->backend;
ClutterEventSource *event_source = (ClutterEventSource *) source;
ClutterEvent *event;
+
+
#ifdef HAVE_TSLIB
- struct ts_sample tsevent;
+ struct ts_sample tsevent,tsevent_read,tsevent_first,tsevent_last;
#endif
ClutterMainContext *clutter_context;
static gint last_x = 0, last_y = 0;
static gboolean clicked = FALSE;
-
+
clutter_threads_enter ();
clutter_context = clutter_context_get_default ();
+
+
#ifdef HAVE_TSLIB
/* FIXME while would be better here but need to deal with lockups */
- if ((!clutter_events_pending()) &&
- (ts_read(event_source->ts_device, &tsevent, 1) == 1))
+
+ if ( ( (!clutter_events_pending()) ) /*&&
+ (ts_read(event_source->ts_device, &tsevent, 1) == 1) */)
{
+
+/* empty the ts buffer, in case of clutter_dispatch is slower than ts events
+take the fist sample on ts pressing
+take the last sample on motion and ts release */
+
+int nbts ;
+int tslast = 0 ;
+int tsfirst = 0 ;
+do
+{
+nbts = ts_read(event_source->ts_device, &tsevent_read, 1);
+if ( (nbts == 1 ) && ( tsfirst == 0 ) ) { tsevent_first = tsevent_read ;
tsfirst = 1 ; }
+if (nbts == 1 ) { tsevent_last = tsevent_read ; tslast = 1 ; }
+} while ( nbts ) ;
+
+if ( (!tsfirst) && (!tslast) ) goto out ;
+if ( clicked == FALSE ) tsevent = tsevent_first ;
+else tsevent = tsevent_last ;
+
+
/* Avoid sending too many events which are just pressure changes.
* We dont current handle pressure in events (FIXME) and thus
* event_button_generate gets confused generating lots of double
* and triple clicks.
*/
- if (tsevent.pressure && last_x == tsevent.x && last_y == tsevent.y)
- goto out;
+
+ if (tsevent.pressure && last_x == tsevent.x && last_y == tsevent.y)
+ goto out;
event = clutter_event_new (CLUTTER_NOTHING);
@@ -245,7 +271,6 @@
event->button.time = get_backend_time ();
event->button.modifier_state = 0;
event->button.button = 1;
-
clicked = TRUE;
}
else if (tsevent.pressure && clicked)
@@ -253,19 +278,20 @@
event->motion.type = event->type = CLUTTER_MOTION;
event->motion.time = get_backend_time ();
event->motion.modifier_state = 0;
- }
+
+ }
else
{
event->button.type = event->type = CLUTTER_BUTTON_RELEASE;
event->button.time = get_backend_time ();
event->button.modifier_state = 0;
event->button.button = 1;
-
clicked = FALSE;
}
- g_queue_push_head (clutter_context->events_queue, event);
- }
+ g_queue_push_head (clutter_context->events_queue, event);
+
+}
#endif
/* Pop an event off the queue if any */