2006-09-14 Matthew Allum <mallum@openedhand.com>
authorMatthew Allum <mallum@openedhand.com>
Thu, 14 Sep 2006 17:18:54 +0000 (17:18 +0000)
committerMatthew Allum <mallum@openedhand.com>
Thu, 14 Sep 2006 17:18:54 +0000 (17:18 +0000)
        Various fixes from Bastien Nocera:

        * clutter/clutter-event.h:
        * clutter/clutter-stage.c: (clutter_stage_unrealize),
        (clutter_stage_realize), (clutter_stage_request_coords),
        (clutter_stage_dispose), (clutter_stage_init):
        * clutter/clutter-stage.h:
        * gtk/gtk-clutter-test.c: (input_cb), (frame_cb), (main):
        * gtk/gtk-clutter.c: (realize):
        Misc fixes (#152)

        * clutter/clutter-group.c: (clutter_group_remove):
        Remove uneeded ref count (#143)

        * examples/super-oh.c: (input_cb):
        Handle key release rather than presses (#154)

        * configure.ac:
        Add old style X libs check when x11.pc unavailable (#101)

ChangeLog
clutter/clutter-event.h
clutter/clutter-group.c
clutter/clutter-stage.c
clutter/clutter-stage.h
configure.ac
examples/super-oh.c
gtk/gtk-clutter-test.c
gtk/gtk-clutter.c

index 5a3870e..4f1528c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2006-09-14  Matthew Allum  <mallum@openedhand.com>
+
+       Various fixes from Bastien Nocera:
+
+       * clutter/clutter-event.h:
+       * clutter/clutter-stage.c: (clutter_stage_unrealize),
+       (clutter_stage_realize), (clutter_stage_request_coords),
+       (clutter_stage_dispose), (clutter_stage_init):
+       * clutter/clutter-stage.h:
+       * gtk/gtk-clutter-test.c: (input_cb), (frame_cb), (main):
+       * gtk/gtk-clutter.c: (realize):
+       Misc fixes (#152)
+
+       * clutter/clutter-group.c: (clutter_group_remove):
+       Remove uneeded ref count (#143)
+
+       * examples/super-oh.c: (input_cb):
+       Handle key release rather than presses (#154)
+
+       * configure.ac:
+       Add old style X libs check when x11.pc unavailable (#101)
+
 2006-09-01  Matthew Allum  <mallum@openedhand.com>
 
        * clutter/Makefile.am:
index f4bafb8..df6b5fb 100644 (file)
@@ -123,6 +123,10 @@ guint32 clutter_key_event_time (ClutterKeyEvent *keyev);
 
 guint clutter_key_event_state (ClutterKeyEvent *keyev);
 
+gint clutter_button_event_x  (ClutterButtonEvent *buttev);
+
+gint clutter_button_event_y (ClutterButtonEvent *buttev);
+
 guint clutter_key_event_symbol (ClutterKeyEvent *keyev);
 
 guint16 clutter_key_event_code (ClutterKeyEvent *keyev);
index 2a73fa5..122db67 100644 (file)
@@ -425,8 +425,6 @@ clutter_group_remove (ClutterGroup *self,
   g_return_if_fail (CLUTTER_IS_GROUP (self));
   g_return_if_fail (CLUTTER_IS_ACTOR (actor));
 
-  g_object_ref (actor);
-
   parent = clutter_actor_get_parent (actor);
   if (parent != CLUTTER_ACTOR (self))
     {
index 952b18a..6559043 100644 (file)
@@ -276,7 +276,7 @@ clutter_stage_unrealize (ClutterActor *actor)
     }
   else
     {
-      if (priv->xwin)
+      if (priv->xwin != None)
        {
          XDestroyWindow (clutter_xdisplay(), priv->xwin);
          priv->xwin = None;
@@ -284,8 +284,11 @@ clutter_stage_unrealize (ClutterActor *actor)
     }
 
   glXMakeCurrent(clutter_xdisplay(), None, NULL);
-  glXDestroyContext (clutter_xdisplay(), priv->gl_context);
-  priv->gl_context = None;
+  if (priv->gl_context != None)
+    {
+      glXDestroyContext (clutter_xdisplay(), priv->gl_context);
+      priv->gl_context = None;
+    }
 }
 
 static void
@@ -323,7 +326,7 @@ clutter_stage_realize (ClutterActor *actor)
          return;
        }
 
-      if (priv->gl_context)
+      if (priv->gl_context != None)
        glXDestroyContext (clutter_xdisplay(), priv->gl_context);
 
       priv->xpixmap = XCreatePixmap (clutter_xdisplay(),
@@ -421,7 +424,7 @@ clutter_stage_realize (ClutterActor *actor)
       sync_fullscreen (stage);  
       sync_cursor_visible (stage);  
 
-      if (priv->gl_context)
+      if (priv->gl_context != None)
        glXDestroyContext (clutter_xdisplay(), priv->gl_context);
 
       priv->gl_context = glXCreateContext (clutter_xdisplay(), 
@@ -480,7 +483,7 @@ clutter_stage_request_coords (ClutterActor    *self,
       priv->xwin_width  = new_width;
       priv->xwin_height = new_height;
 
-      if (priv->xwin)
+      if (priv->xwin != None)
        XResizeWindow (clutter_xdisplay(), 
                       priv->xwin, 
                       priv->xwin_width, 
@@ -496,7 +499,7 @@ clutter_stage_request_coords (ClutterActor    *self,
       sync_gl_viewport (stage);
     }
 
-  if (priv->xwin) /* Do we want to bother ? */
+  if (priv->xwin != None) /* Do we want to bother ? */
     XMoveWindow (clutter_xdisplay(), 
                 priv->xwin,
                 box->x1,
@@ -509,7 +512,7 @@ clutter_stage_dispose (GObject *object)
 {
   ClutterStage *self = CLUTTER_STAGE (object);
 
-  if (self->priv->xwin)
+  if (self->priv->xwin != None)
     clutter_stage_unrealize (CLUTTER_ACTOR (self));
 
   G_OBJECT_CLASS (clutter_stage_parent_class)->dispose (object);
@@ -739,6 +742,8 @@ clutter_stage_init (ClutterStage *self)
   priv->want_offscreen  = FALSE;
   priv->want_fullscreen = FALSE;
   priv->hide_cursor     = FALSE;
+  priv->xwin = None;
+  priv->gl_context = None;
 
   priv->xwin_width  = 100;
   priv->xwin_height = 100;
index 6e305de..0edec5d 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
+#include <GL/glx.h>
 
 G_BEGIN_DECLS
 
@@ -123,6 +124,7 @@ GdkPixbuf *   clutter_stage_snapshot            (ClutterStage       *stage,
                                                 gint                y,
                                                 gint                width,
                                                 gint                height);
+const XVisualInfo * clutter_stage_get_xvisual   (ClutterStage *stage);
 
 G_END_DECLS
 
index 9ebb697..ba3db4b 100644 (file)
@@ -54,7 +54,18 @@ AC_CHECK_FUNCS([memset munmap strcasecmp strdup])
 
 dnl ========================================================================
 
-PKG_CHECK_MODULES(X11, x11)
+PKG_CHECK_MODULES(X11, x11, [have_x11=yes], [have_x11=no])
+if test x$have_x11 = xno
+then
+   AC_PATH_X
+   if test x"$x_includes" != x"NONE" && test -n "$x_includes" ; then
+     X11_CFLAGS=-I`echo $x_includes | sed -e "s/:/ -I/g"`
+   fi
+   if test x"$x_libraries" != x"NONE" && test -n "$x_libraries" ; then
+     X11_LIBS=-L`echo $x_libraries | sed -e "s/:/ -L/g"`
+   fi
+fi
+
 
 # FIXME: Needed ?
 AC_MSG_CHECKING([for XTHREADS in Xlib])
index 955a86a..2b17b8a 100644 (file)
@@ -65,7 +65,7 @@ input_cb (ClutterStage *stage,
       if (e)
        clutter_actor_hide(e);
     }
-  else if (event->type == CLUTTER_KEY_PRESS)
+  else if (event->type == CLUTTER_KEY_RELEASE)
     {
       ClutterKeyEvent *kev = (ClutterKeyEvent *) event;
 
index 472e515..c5036f3 100644 (file)
@@ -26,8 +26,6 @@ input_cb (ClutterStage *stage,
          ClutterEvent *event,
          gpointer      data)
 {
-  SuperOH *oh = (SuperOH *)data;
-
   if (event->type == CLUTTER_BUTTON_PRESS)
     {
       ClutterButtonEvent *bev = (ClutterButtonEvent *) event;
@@ -37,8 +35,8 @@ input_cb (ClutterStage *stage,
               bev->button);
 
       e = clutter_stage_get_actor_at_pos (stage, 
-                                           clutter_button_event_x (event),
-                                           clutter_button_event_y (event));
+                                           clutter_button_event_x (bev),
+                                           clutter_button_event_y (bev));
 
       if (e)
        clutter_actor_hide(e);
@@ -63,7 +61,6 @@ frame_cb (ClutterTimeline *timeline,
          gpointer         data)
 {
   SuperOH        *oh = (SuperOH *)data;
-  ClutterActor *stage = clutter_stage_get_default ();
   gint            i;
 
 #if TRAILS
@@ -167,12 +164,11 @@ main (int argc, char *argv[])
 #endif
 
   /* create a new group to hold multiple actors in a group */
-  oh->group = clutter_group_new();
+  oh->group = CLUTTER_GROUP (clutter_group_new());
   
   for (i = 0; i < NHANDS; i++)
     {
       gint x, y, w, h;
-      ClutterColor colour = { 255, 0, 0, 255 };
 #if 1
       /* Create a texture from pixbuf, then clone in to same resources */
       if (i == 0)
@@ -180,6 +176,7 @@ main (int argc, char *argv[])
      else
        oh->hand[i] = clutter_clone_texture_new (CLUTTER_TEXTURE(oh->hand[0]));
 #else
+      ClutterColor colour = { 255, 0, 0, 255 };
 
       oh->hand[i] = clutter_rectangle_new_with_color (&colour);
       clutter_actor_set_size (oh->hand[i], 50, 50);
index a676764..05066b2 100644 (file)
@@ -88,10 +88,9 @@ realize (GtkWidget *widget)
 {
   GtkClutter *clutter;
   GtkClutterPrivate *priv;
-  XVisualInfo *xvinfo;
+  const XVisualInfo *xvinfo;
   GdkVisual *visual;
   GdkColormap *colormap;
-  gboolean foreign_success;
 
   clutter = GTK_CLUTTER (widget);
   priv = GTK_CLUTTER_GET_PRIVATE (clutter);