mirror of
https://github.com/brl/mutter.git
synced 2025-08-01 14:15:30 +00:00
2007-05-10 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-backend.c: * clutter/clutter-backend.h: * clutter/clutter-event.c: * clutter/clutter-main.c: * clutter/clutter-private.h: * clutter/glx/clutter-backend-glx.c: * clutter/glx/clutter-backend-glx.h: * clutter/glx/clutter-event-glx.c: Rejig backend event code as to simplify a little. NOTE: This breaks non glx backends. * tests/Makefile.am: * tests/test-events.c: Add a very simple event test. * tests/test-textures.c: (main): Add some more sizes to the test.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
noinst_PROGRAMS = test-textures
|
||||
noinst_PROGRAMS = test-textures test-events
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/
|
||||
LDADD = $(top_builddir)/clutter/libclutter-@CLUTTER_FLAVOUR@-@CLUTTER_MAJORMINOR@.la
|
||||
@@ -6,3 +6,5 @@ AM_CFLAGS = $(CLUTTER_CFLAGS)
|
||||
LDFLAGS = $(CLUTTER_LIBS)
|
||||
|
||||
test_textures_SOURCES = test-textures.c
|
||||
|
||||
test_events_SOURCES = test-events.c
|
||||
|
63
tests/test-events.c
Normal file
63
tests/test-events.c
Normal file
@@ -0,0 +1,63 @@
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
static void
|
||||
input_cb (ClutterStage *stage,
|
||||
ClutterEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
switch (event->type)
|
||||
{
|
||||
case CLUTTER_KEY_PRESS:
|
||||
printf("- KEY PRESS\n");
|
||||
break;
|
||||
case CLUTTER_KEY_RELEASE:
|
||||
printf("- KEY RELEASE\n");
|
||||
break;
|
||||
case CLUTTER_MOTION:
|
||||
printf("- MOTION\n");
|
||||
break;
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
printf("- BUTTON PRESS\n");
|
||||
break;
|
||||
case CLUTTER_2BUTTON_PRESS:
|
||||
printf("- BUTTON 2 PRESS\n");
|
||||
break;
|
||||
case CLUTTER_3BUTTON_PRESS:
|
||||
printf("- BUTTON 3 PRESS\n");
|
||||
break;
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
printf("- BUTTON RELEASE\n");
|
||||
break;
|
||||
case CLUTTER_SCROLL:
|
||||
printf("- BUTTON SCROLL\n");
|
||||
break;
|
||||
case CLUTTER_STAGE_STATE:
|
||||
printf("- STAGE STATE\n");
|
||||
break;
|
||||
case CLUTTER_DESTROY_NOTIFY:
|
||||
printf("- DESTROY NOTIFY\n");
|
||||
break;
|
||||
case CLUTTER_CLIENT_MESSAGE:
|
||||
printf("- CLIENT MESSAGE\n");
|
||||
break;
|
||||
case CLUTTER_DELETE:
|
||||
printf("- DELETE\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
ClutterActor *stage;
|
||||
|
||||
clutter_init (&argc, &argv);
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
g_signal_connect (stage, "event", G_CALLBACK (input_cb), NULL);
|
||||
clutter_actor_show_all (CLUTTER_ACTOR (stage));
|
||||
|
||||
clutter_main();
|
||||
|
||||
return 0;
|
||||
}
|
@@ -56,7 +56,7 @@ main (int argc, char *argv[])
|
||||
ClutterActor *texture;
|
||||
ClutterActor *stage;
|
||||
GdkPixbuf *pixbuf;
|
||||
gint i, cols, rows;
|
||||
gint i, j, cols, rows;
|
||||
|
||||
clutter_init (&argc, &argv);
|
||||
|
||||
@@ -66,31 +66,33 @@ main (int argc, char *argv[])
|
||||
SPIN();
|
||||
|
||||
for (i=100; i<5000; i += 100)
|
||||
{
|
||||
pixbuf = make_pixbuf (i, i, 4, TRUE);
|
||||
|
||||
if (!pixbuf)
|
||||
g_error("%ix%i pixbuf creation failed", i, i);
|
||||
|
||||
printf("o %ix%i pixbuf... ", i, i);
|
||||
|
||||
texture = clutter_texture_new_from_pixbuf (pixbuf);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
if (!texture)
|
||||
g_error("Pixbuf creation failed");
|
||||
|
||||
printf("uploaded to texture... ", i, i);
|
||||
|
||||
clutter_group_add (CLUTTER_GROUP (stage), texture);
|
||||
clutter_actor_set_size (texture, 400, 400);
|
||||
clutter_actor_show (texture);
|
||||
|
||||
clutter_texture_get_n_tiles(CLUTTER_TEXTURE(texture), &cols, &rows);
|
||||
printf("with tiles: %i x %i\n", cols, rows);
|
||||
|
||||
SPIN();
|
||||
for (j=0; j<4; j++)
|
||||
{
|
||||
pixbuf = make_pixbuf (i+j, i+j, 4, TRUE);
|
||||
|
||||
if (!pixbuf)
|
||||
g_error("%ix%i pixbuf creation failed", i+j, i+j);
|
||||
|
||||
printf("o %ix%i pixbuf... ", i+j, i+j);
|
||||
|
||||
texture = clutter_texture_new_from_pixbuf (pixbuf);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
if (!texture)
|
||||
g_error("Pixbuf creation failed");
|
||||
|
||||
printf("uploaded to texture... ");
|
||||
|
||||
clutter_group_add (CLUTTER_GROUP (stage), texture);
|
||||
clutter_actor_set_size (texture, 400, 400);
|
||||
clutter_actor_show (texture);
|
||||
|
||||
clutter_texture_get_n_tiles(CLUTTER_TEXTURE(texture), &cols, &rows);
|
||||
|
||||
printf("with tiles: %i x %i\n", cols, rows);
|
||||
|
||||
SPIN();
|
||||
|
||||
clutter_group_remove (CLUTTER_GROUP (stage), texture);
|
||||
}
|
||||
|
Reference in New Issue
Block a user