2008-05-15 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/x11/clutter-backend-x11.c:
	* clutter/clutter-event.h:
	* clutter/clutter-feature.h:
	* clutter/clutter-fixed.c:
	* clutter/clutter-model.h: Fix documentation.

	* clutter/eglnative/clutter-backend-egl.[ch]:
	* clutter/eglnative/clutter-event-egl.c: Add the same solution
	used for the SDL backend in order to get the time of an event.
	This should fix the motion event throttling and the click count
	on button press.

	* tests/test-pixmap.c (create_pixmap), (main): Fix preprocessor
	directives.
This commit is contained in:
Emmanuele Bassi 2008-05-15 14:31:43 +00:00
parent 3171062b3f
commit f6dce7f9e5
10 changed files with 84 additions and 27 deletions

View File

@ -1,3 +1,20 @@
2008-05-15 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/x11/clutter-backend-x11.c:
* clutter/clutter-event.h:
* clutter/clutter-feature.h:
* clutter/clutter-fixed.c:
* clutter/clutter-model.h: Fix documentation.
* clutter/eglnative/clutter-backend-egl.[ch]:
* clutter/eglnative/clutter-event-egl.c: Add the same solution
used for the SDL backend in order to get the time of an event.
This should fix the motion event throttling and the click count
on button press.
* tests/test-pixmap.c (create_pixmap), (main): Fix preprocessor
directives.
2008-05-14 Emmanuele Bassi <ebassi@openedhand.com>
* tests/test-threads.c: Add a "progress bar" actor and

View File

@ -189,6 +189,7 @@ typedef struct _ClutterInputDevice ClutterInputDevice;
* @type: event type
* @time: event time
* @flags: event flags
* @stage: event source stage
* @source: event source actor
*
* Common members for a #ClutterEvent
@ -209,6 +210,7 @@ struct _ClutterAnyEvent
* @type: event type
* @time: event time
* @flags: event flags
* @stage: event source stage
* @source: event source actor
* @modifier_state: key modifiers
* @keyval: raw key value

View File

@ -39,6 +39,7 @@ G_BEGIN_DECLS
/**
* ClutterFeatureFlags:
* @CLUTTER_FEATURE_TEXTURE_RECTANGLE: Set if rectangular textures supported.
* @CLUTTER_FEATURE_TEXTURE_RECTANGLE: Set if NPOTS textures supported.
* @CLUTTER_FEATURE_SYNC_TO_VBLANK: Set if vblank syncing supported.
* @CLUTTER_FEATURE_TEXTURE_YUV: Set if YUV based textures supported.

View File

@ -793,7 +793,7 @@ clutter_sqrti (gint number)
}
/**
* clutter_fixed_qmulx:
* clutter_qmulx:
* @op1: #ClutterFixed
* @op2: #ClutterFixed
*
@ -833,7 +833,7 @@ clutter_qmulx (ClutterFixed op1, ClutterFixed op2)
}
/**
* clutter_fixed_qdivx:
* clutter_qdivx:
* @op1: #ClutterFixed
* @op2: #ClutterFixed
*

View File

@ -300,6 +300,7 @@ struct _ClutterModelIter
* iterator belongs to
* @get_row: Virtual function for getting the row to which the iterator
* points
* @copy: Virtual function for copying a #ClutterModelIter.
*
* Class for #ClutterModelIter instances.
*

View File

@ -142,6 +142,12 @@ clutter_backend_egl_dispose (GObject *gobject)
backend_egl->edpy = 0;
}
if (backend_egl->event_timer)
{
g_timer_destroy (backend_egl->event_timer);
backend_egl->event_timer = NULL;
}
G_OBJECT_CLASS (clutter_backend_egl_parent_class)->dispose (gobject);
}
@ -218,6 +224,8 @@ clutter_backend_egl_init (ClutterBackendEGL *backend_egl)
clutter_backend_set_resolution (backend, 96.0);
clutter_backend_set_double_click_time (backend, 250);
clutter_backend_set_double_click_distance (backend, 5);
backend_egl->event_timer = g_timer_new ();
}
GType

View File

@ -58,6 +58,9 @@ struct _ClutterBackendEGL
/* event source */
GSource *event_source;
/* event timer */
GTimer *event_timer;
/*< private >*/
};

View File

@ -81,6 +81,16 @@ clutter_event_source_new (ClutterBackend *backend)
return source;
}
static guint32
get_backend_time (void)
{
ClutterBackendEGL *backend_egl;
backend_egl = CLUTTER_BACKEND_EGL (clutter_get_default_backend ());
return g_timer_elapsed (backend_egl->event_timer) * 1000;
}
void
_clutter_events_init (ClutterBackend *backend)
{
@ -88,19 +98,22 @@ _clutter_events_init (ClutterBackend *backend)
GSource *source;
ClutterEventSource *event_source;
CLUTTER_NOTE (EVENT, "Starting timer");
g_assert (backend_egl->event_timer != NULL);
g_timer_start (backend_egl->event_timer);
#ifdef HAVE_TSLIB
/* FIXME LEAK on error paths */
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"), 0);
if (event_source->ts_device)
{
CLUTTER_NOTE (EVENT, "Opened '%s'", g_getenv ("TSLIB_TSDEVICE"));
CLUTTER_NOTE (EVENT, "Opened '%s'", g_getenv("TSLIB_TSDEVICE"));
if (ts_config(event_source->ts_device))
if (ts_config (event_source->ts_device))
{
g_warning ("ts_config() failed");
ts_close (event_source->ts_device);
@ -129,6 +142,12 @@ _clutter_events_uninit (ClutterBackend *backend)
{
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (backend);
if (backend_egl->event_timer)
{
CLUTTER_NOTE (EVENT, "Stopping the timer");
g_timer_stop (backend_egl->event_timer);
}
if (backend_egl->event_source)
{
CLUTTER_NOTE (EVENT, "Destroying the event source");
@ -220,27 +239,32 @@ clutter_event_dispatch (GSource *source,
last_x = event->button.x = tsevent.x;
last_y = event->button.y = tsevent.y;
event->button.time = 0;
event->button.modifier_state = 0;
event->button.button = 1;
if (tsevent.pressure && !clicked)
{
event->button.type = event->type = CLUTTER_BUTTON_PRESS;
event->button.time = get_backend_time ();
event->button.modifier_state = 0;
event->button.button = 1;
clicked = TRUE;
}
else if (tsevent.pressure && clicked)
{
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);
}
#endif

View File

@ -381,6 +381,7 @@ clutter_x11_get_default_display (void)
/**
* clutter_x11_set_display:
* @xdpy: pointer to a X display connection.
*
* Sets the display connection clutter should use; must be called
* before clutter_init().
*

View File

@ -16,7 +16,7 @@
#define IMAGE "redhand.png"
#ifdef USE_GDKPIXBUF
# ifdef USE_GDKPIXBUF
static gboolean
stage_press_cb (ClutterActor *actor,
@ -87,10 +87,10 @@ create_pixmap (guint *width, guint *height, guint *depth)
for (p = line; p < endofline; p += 4, d+=4)
{
#define r ((guint32)(*(p)))
#define g ((guint32)(*(p+1)))
#define b ((guint32)(*(p+2)))
#define a ((guint32)(*(p+3)))
# define r ((guint32)(*(p)))
# define g ((guint32)(*(p+1)))
# define b ((guint32)(*(p+2)))
# define a ((guint32)(*(p+3)))
guint32 pixel =
((a << 24) & 0xFF000000 ) |
((r << 16) & 0x00FF0000 ) |
@ -100,10 +100,10 @@ create_pixmap (guint *width, guint *height, guint *depth)
*((guint32 *)d) = pixel;
}
#undef r
#undef g
#undef b
#undef a
# undef r
# undef g
# undef b
# undef a
}
@ -136,12 +136,12 @@ create_pixmap (guint *width, guint *height, guint *depth)
return pixmap;
}
#endif
# endif /* USE_GDKPIXBUF */
int
main (int argc, char **argv)
{
#ifdef USE_GDKPIXBUF
# ifdef USE_GDKPIXBUF
ClutterActor *stage, *tex;
Pixmap pixmap;
guint w, h, d;
@ -168,7 +168,7 @@ main (int argc, char **argv)
clutter_x11_texture_pixmap_set_automatic (CLUTTER_X11_TEXTURE_PIXMAP (tex),
TRUE);
#ifdef HAVE_CLUTTER_GLX
# ifdef HAVE_CLUTTER_GLX
/* pixmap = create_pixmap (&w, &h, &d); */
@ -191,7 +191,7 @@ main (int argc, char **argv)
clutter_container_add_actor (CLUTTER_CONTAINER (stage),
tex);
#endif
# endif /* HAVE_CLUTTER_GLX */
g_signal_connect (stage, "button-press-event",
G_CALLBACK (stage_press_cb), (gpointer)pixmap);
@ -199,10 +199,10 @@ main (int argc, char **argv)
clutter_actor_show (stage);
clutter_main ();
#endif
# endif /* USE_GDKPIXBUF */
}
#else
#else /* HAVE_CLUTTER_GLX */
int main(int argc, char **argv){return 0;};
#endif
#endif /* HAVE_CLUTTER_GLX */