All,
I'm attempting to put a clutter application in a gtk window (so we can
move it around the screen and have multiple applications open). I
downloaded the clutter-gtk samples and have managed to get one of them
working properly on our current target device: Jax 10. But when I try
to write one of my own it doesn't work properly. Can anyone give it a
look see and see if I'm missing something:
The example code that I'm running is this:
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include <clutter/clutter.h>
#include <clutter-gtk/clutter-gtk.h>
int
main (int argc, char *argv[])
{
ClutterActor *stage1;
// ClutterActor *stage2;
// ClutterActor *tex1;
// ClutterActor *tex2;
GtkWidget *window;
GtkWidget *clutter1;
GtkWidget *clutter2;
GtkWidget *vbox;
ClutterColor col1 = { 0x00, 0x00, 0xff, 0xff };
// ClutterColor col2 = { 0, 0xff, 0, 0xff };
if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
g_error ("Unable to initialize GtkClutter");
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
vbox = gtk_vbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (window), vbox);
clutter1 = gtk_clutter_embed_new ();
gtk_widget_set_size_request (clutter1, 100, 100);
stage1 = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter1));
clutter_stage_set_color (CLUTTER_STAGE(stage1), &col1);
/*
tex1 = gtk_clutter_texture_new_from_stock (clutter1,
GTK_STOCK_DIALOG_INFO,
GTK_ICON_SIZE_DIALOG);
clutter_actor_set_anchor_point (tex1,
clutter_actor_get_width (tex1) / 2,
clutter_actor_get_height (tex1) / 2);
clutter_actor_set_position (tex1, 160, 120);
clutter_stage_add (stage1, tex1);
clutter_actor_show (tex1);
*/
gtk_container_add (GTK_CONTAINER (vbox), clutter1);
clutter2 = gtk_clutter_embed_new ();
gtk_widget_set_size_request (clutter2, 100, 100);
// stage2 = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter2));
// clutter_stage_set_color (CLUTTER_STAGE(stage2), &col2);
/*
tex2 = gtk_clutter_texture_new_from_icon_name (clutter1,
"user-info",
GTK_ICON_SIZE_BUTTON);
clutter_actor_set_anchor_point (tex2,
clutter_actor_get_width (tex2) / 2,
clutter_actor_get_height (tex2) / 2);
clutter_actor_set_position (tex2, 160, 120);
clutter_stage_add (stage2, tex2);
*/
gtk_container_add (GTK_CONTAINER (vbox), clutter2);
gtk_widget_show_all (window);
clutter_actor_show_all (stage1);
// clutter_actor_show_all (stage2);
gtk_window_move(GTK_WINDOW (window), atoi(argv[1]), atoi(argv[2]));
gtk_main();
return 0;
}
Which of course has a number of my own modifications as I screwed
around with it all. Now the one that I wrote myself based on this
version is:
#include <gtk/gtk.h>
#include <clutter/clutter.h>
#include <clutter-gtk/clutter-gtk.h>
int main (int argc, char *argv[]) {
ClutterActor *stage;
GtkWidget *clutter;
GtkWidget *window;
GtkWidget *vbox;
ClutterActor *tex;
ClutterColor color = { 0x00, 0x00, 0x00, 0xff };
if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
g_error ("Unable to initialize GtkClutter");
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
vbox = gtk_vbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (window), vbox);
clutter = gtk_clutter_embed_new ();
gtk_widget_set_size_request (clutter, 400, 200);
stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter));
clutter_stage_set_color (CLUTTER_STAGE(stage), &color);
tex = gtk_clutter_texture_new_from_stock (clutter,
GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
clutter_stage_add (stage, tex);
clutter_actor_show(tex);
gtk_container_add (GTK_CONTAINER (vbox), clutter);
gtk_widget_show_all (window);
clutter_actor_show_all (stage);
gtk_main();
return 0;
}
Both of these will work correctly on an Acer Aspire (though you can
only launch one instance at a time). But on the Jax 10, when I run my
own code, it allocates the area on the screen for the window (when you
mouse over that area, the cursor changes), but nothing is displayed in
that area. Any ideas guys?
Thanks,
Snowdall
_______________________________________________
Moblin dev Mailing List
[email protected]
To manage or unsubscribe from this mailing list visit:
https://lists.moblin.org/mailman/listinfo/dev or your user account on
http://moblin.org once logged in.
For more information on the Moblin Developer Mailing lists visit:
http://moblin.org/community/mailing-lists