mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
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:
parent
3171062b3f
commit
f6dce7f9e5
17
ChangeLog
17
ChangeLog
@ -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>
|
2008-05-14 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* tests/test-threads.c: Add a "progress bar" actor and
|
* tests/test-threads.c: Add a "progress bar" actor and
|
||||||
|
@ -189,6 +189,7 @@ typedef struct _ClutterInputDevice ClutterInputDevice;
|
|||||||
* @type: event type
|
* @type: event type
|
||||||
* @time: event time
|
* @time: event time
|
||||||
* @flags: event flags
|
* @flags: event flags
|
||||||
|
* @stage: event source stage
|
||||||
* @source: event source actor
|
* @source: event source actor
|
||||||
*
|
*
|
||||||
* Common members for a #ClutterEvent
|
* Common members for a #ClutterEvent
|
||||||
@ -209,6 +210,7 @@ struct _ClutterAnyEvent
|
|||||||
* @type: event type
|
* @type: event type
|
||||||
* @time: event time
|
* @time: event time
|
||||||
* @flags: event flags
|
* @flags: event flags
|
||||||
|
* @stage: event source stage
|
||||||
* @source: event source actor
|
* @source: event source actor
|
||||||
* @modifier_state: key modifiers
|
* @modifier_state: key modifiers
|
||||||
* @keyval: raw key value
|
* @keyval: raw key value
|
||||||
|
@ -39,6 +39,7 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterFeatureFlags:
|
* ClutterFeatureFlags:
|
||||||
|
* @CLUTTER_FEATURE_TEXTURE_RECTANGLE: Set if rectangular textures supported.
|
||||||
* @CLUTTER_FEATURE_TEXTURE_RECTANGLE: Set if NPOTS textures supported.
|
* @CLUTTER_FEATURE_TEXTURE_RECTANGLE: Set if NPOTS textures supported.
|
||||||
* @CLUTTER_FEATURE_SYNC_TO_VBLANK: Set if vblank syncing supported.
|
* @CLUTTER_FEATURE_SYNC_TO_VBLANK: Set if vblank syncing supported.
|
||||||
* @CLUTTER_FEATURE_TEXTURE_YUV: Set if YUV based textures supported.
|
* @CLUTTER_FEATURE_TEXTURE_YUV: Set if YUV based textures supported.
|
||||||
|
@ -793,7 +793,7 @@ clutter_sqrti (gint number)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_fixed_qmulx:
|
* clutter_qmulx:
|
||||||
* @op1: #ClutterFixed
|
* @op1: #ClutterFixed
|
||||||
* @op2: #ClutterFixed
|
* @op2: #ClutterFixed
|
||||||
*
|
*
|
||||||
@ -833,7 +833,7 @@ clutter_qmulx (ClutterFixed op1, ClutterFixed op2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_fixed_qdivx:
|
* clutter_qdivx:
|
||||||
* @op1: #ClutterFixed
|
* @op1: #ClutterFixed
|
||||||
* @op2: #ClutterFixed
|
* @op2: #ClutterFixed
|
||||||
*
|
*
|
||||||
|
@ -300,6 +300,7 @@ struct _ClutterModelIter
|
|||||||
* iterator belongs to
|
* iterator belongs to
|
||||||
* @get_row: Virtual function for getting the row to which the iterator
|
* @get_row: Virtual function for getting the row to which the iterator
|
||||||
* points
|
* points
|
||||||
|
* @copy: Virtual function for copying a #ClutterModelIter.
|
||||||
*
|
*
|
||||||
* Class for #ClutterModelIter instances.
|
* Class for #ClutterModelIter instances.
|
||||||
*
|
*
|
||||||
|
@ -142,6 +142,12 @@ clutter_backend_egl_dispose (GObject *gobject)
|
|||||||
backend_egl->edpy = 0;
|
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);
|
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_resolution (backend, 96.0);
|
||||||
clutter_backend_set_double_click_time (backend, 250);
|
clutter_backend_set_double_click_time (backend, 250);
|
||||||
clutter_backend_set_double_click_distance (backend, 5);
|
clutter_backend_set_double_click_distance (backend, 5);
|
||||||
|
|
||||||
|
backend_egl->event_timer = g_timer_new ();
|
||||||
}
|
}
|
||||||
|
|
||||||
GType
|
GType
|
||||||
|
@ -58,6 +58,9 @@ struct _ClutterBackendEGL
|
|||||||
/* event source */
|
/* event source */
|
||||||
GSource *event_source;
|
GSource *event_source;
|
||||||
|
|
||||||
|
/* event timer */
|
||||||
|
GTimer *event_timer;
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,6 +81,16 @@ clutter_event_source_new (ClutterBackend *backend)
|
|||||||
return source;
|
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
|
void
|
||||||
_clutter_events_init (ClutterBackend *backend)
|
_clutter_events_init (ClutterBackend *backend)
|
||||||
{
|
{
|
||||||
@ -88,19 +98,22 @@ _clutter_events_init (ClutterBackend *backend)
|
|||||||
GSource *source;
|
GSource *source;
|
||||||
ClutterEventSource *event_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
|
#ifdef HAVE_TSLIB
|
||||||
/* FIXME LEAK on error paths */
|
/* FIXME LEAK on error paths */
|
||||||
source = backend_egl->event_source = clutter_event_source_new (backend);
|
source = backend_egl->event_source = clutter_event_source_new (backend);
|
||||||
event_source = (ClutterEventSource *) source;
|
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)
|
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");
|
g_warning ("ts_config() failed");
|
||||||
ts_close (event_source->ts_device);
|
ts_close (event_source->ts_device);
|
||||||
@ -129,6 +142,12 @@ _clutter_events_uninit (ClutterBackend *backend)
|
|||||||
{
|
{
|
||||||
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (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)
|
if (backend_egl->event_source)
|
||||||
{
|
{
|
||||||
CLUTTER_NOTE (EVENT, "Destroying the 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_x = event->button.x = tsevent.x;
|
||||||
last_y = event->button.y = tsevent.y;
|
last_y = event->button.y = tsevent.y;
|
||||||
|
|
||||||
event->button.time = 0;
|
|
||||||
event->button.modifier_state = 0;
|
|
||||||
event->button.button = 1;
|
|
||||||
|
|
||||||
if (tsevent.pressure && !clicked)
|
if (tsevent.pressure && !clicked)
|
||||||
{
|
{
|
||||||
event->button.type = event->type = CLUTTER_BUTTON_PRESS;
|
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;
|
clicked = TRUE;
|
||||||
}
|
}
|
||||||
else if (tsevent.pressure && clicked)
|
else if (tsevent.pressure && clicked)
|
||||||
{
|
{
|
||||||
event->motion.type = event->type = CLUTTER_MOTION;
|
event->motion.type = event->type = CLUTTER_MOTION;
|
||||||
|
event->motion.time = get_backend_time ();
|
||||||
|
event->motion.modifier_state = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event->button.type = event->type = CLUTTER_BUTTON_RELEASE;
|
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;
|
clicked = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_queue_push_head (clutter_context->events_queue, event);
|
g_queue_push_head (clutter_context->events_queue, event);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -381,6 +381,7 @@ clutter_x11_get_default_display (void)
|
|||||||
/**
|
/**
|
||||||
* clutter_x11_set_display:
|
* clutter_x11_set_display:
|
||||||
* @xdpy: pointer to a X display connection.
|
* @xdpy: pointer to a X display connection.
|
||||||
|
*
|
||||||
* Sets the display connection clutter should use; must be called
|
* Sets the display connection clutter should use; must be called
|
||||||
* before clutter_init().
|
* before clutter_init().
|
||||||
*
|
*
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#define IMAGE "redhand.png"
|
#define IMAGE "redhand.png"
|
||||||
|
|
||||||
#ifdef USE_GDKPIXBUF
|
# ifdef USE_GDKPIXBUF
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
stage_press_cb (ClutterActor *actor,
|
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)
|
for (p = line; p < endofline; p += 4, d+=4)
|
||||||
{
|
{
|
||||||
|
|
||||||
#define r ((guint32)(*(p)))
|
# define r ((guint32)(*(p)))
|
||||||
#define g ((guint32)(*(p+1)))
|
# define g ((guint32)(*(p+1)))
|
||||||
#define b ((guint32)(*(p+2)))
|
# define b ((guint32)(*(p+2)))
|
||||||
#define a ((guint32)(*(p+3)))
|
# define a ((guint32)(*(p+3)))
|
||||||
guint32 pixel =
|
guint32 pixel =
|
||||||
((a << 24) & 0xFF000000 ) |
|
((a << 24) & 0xFF000000 ) |
|
||||||
((r << 16) & 0x00FF0000 ) |
|
((r << 16) & 0x00FF0000 ) |
|
||||||
@ -100,10 +100,10 @@ create_pixmap (guint *width, guint *height, guint *depth)
|
|||||||
*((guint32 *)d) = pixel;
|
*((guint32 *)d) = pixel;
|
||||||
|
|
||||||
}
|
}
|
||||||
#undef r
|
# undef r
|
||||||
#undef g
|
# undef g
|
||||||
#undef b
|
# undef b
|
||||||
#undef a
|
# undef a
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,12 +136,12 @@ create_pixmap (guint *width, guint *height, guint *depth)
|
|||||||
|
|
||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
#endif
|
# endif /* USE_GDKPIXBUF */
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
#ifdef USE_GDKPIXBUF
|
# ifdef USE_GDKPIXBUF
|
||||||
ClutterActor *stage, *tex;
|
ClutterActor *stage, *tex;
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
guint w, h, d;
|
guint w, h, d;
|
||||||
@ -168,7 +168,7 @@ main (int argc, char **argv)
|
|||||||
clutter_x11_texture_pixmap_set_automatic (CLUTTER_X11_TEXTURE_PIXMAP (tex),
|
clutter_x11_texture_pixmap_set_automatic (CLUTTER_X11_TEXTURE_PIXMAP (tex),
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
#ifdef HAVE_CLUTTER_GLX
|
# ifdef HAVE_CLUTTER_GLX
|
||||||
|
|
||||||
/* pixmap = create_pixmap (&w, &h, &d); */
|
/* pixmap = create_pixmap (&w, &h, &d); */
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage),
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage),
|
||||||
tex);
|
tex);
|
||||||
#endif
|
# endif /* HAVE_CLUTTER_GLX */
|
||||||
|
|
||||||
g_signal_connect (stage, "button-press-event",
|
g_signal_connect (stage, "button-press-event",
|
||||||
G_CALLBACK (stage_press_cb), (gpointer)pixmap);
|
G_CALLBACK (stage_press_cb), (gpointer)pixmap);
|
||||||
@ -199,10 +199,10 @@ main (int argc, char **argv)
|
|||||||
clutter_actor_show (stage);
|
clutter_actor_show (stage);
|
||||||
|
|
||||||
clutter_main ();
|
clutter_main ();
|
||||||
#endif
|
# endif /* USE_GDKPIXBUF */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else /* HAVE_CLUTTER_GLX */
|
||||||
int main(int argc, char **argv){return 0;};
|
int main(int argc, char **argv){return 0;};
|
||||||
#endif
|
#endif /* HAVE_CLUTTER_GLX */
|
||||||
|
Loading…
Reference in New Issue
Block a user