+2007-06-19 Matthew Allum <mallum@openedhand.com>
+
+ * clutter/clutter-stage.c:
+ * clutter/clutter-stage.h:
+ * clutter/glx/clutter-stage-glx.c:
+ * clutter/sdl/clutter-stage-sdl.c:
+ Add window title setting/getting functionality.
+
+ * clutter/clutter-event.c: (clutter_key_event_unicode):
+ Remove uneeded convert case call.
+
+ * clutter/cogl/gl/cogl.c: (cogl_rectangle)
+ Use parameters correctly for underlying GL rect call.
+
+ * tests/test-entry.c:
+ Add a window title.
+
2007-06-18 Matthew Allum <mallum@openedhand.com>
* clutter/sdl/clutter-event-sdl.c:
{
g_return_val_if_fail (keyev != NULL, 0);
- if ((keyev->modifier_state & CLUTTER_SHIFT_MASK) ||
- (keyev->modifier_state & CLUTTER_LOCK_MASK))
- return g_unichar_toupper (clutter_keysym_to_unicode (keyev->keyval));
- else
- return clutter_keysym_to_unicode (keyev->keyval);
+ return clutter_keysym_to_unicode (keyev->keyval);
}
/**
guint is_fullscreen : 1;
guint is_offscreen : 1;
guint is_cursor_visible : 1;
+
+ gchar *title;
};
enum
PROP_OFFSCREEN,
PROP_CURSOR_VISIBLE,
PROP_PERSPECTIVE,
+ PROP_TITLE,
};
enum
case PROP_PERSPECTIVE:
clutter_stage_set_perspectivex (stage, g_value_get_boxed (value));
break;
+ case PROP_TITLE:
+ clutter_stage_set_title (stage, g_value_get_string (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
clutter_stage_get_perspectivex (stage, &perspective);
g_value_set_boxed (value, &perspective);
break;
+ case PROP_TITLE:
+ g_value_set_string (value, priv->title);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
"The color of the main stage",
CLUTTER_TYPE_COLOR,
CLUTTER_PARAM_READWRITE));
+
+ /**
+ * ClutterStage:title:
+ *
+ * The stages title - usually displayed in stage windows title decorations.
+ *
+ * Since: 0.4
+ */
+ g_object_class_install_property
+ (gobject_class, PROP_TITLE,
+ g_param_spec_string ("title",
+ "Title",
+ "Stage Title",
+ NULL,
+ CLUTTER_PARAM_READWRITE));
+
/**
* ClutterStage::event:
* @stage: the actor which received the event
return res;
}
+/**
+ * clutter_stage_set_title
+ * @stage: A #ClutterStage
+ * @title: A utf8 string for the stage windows title.
+ *
+ * Sets the stage title.
+ *
+ * Since 0.4
+ **/
+void
+clutter_stage_set_title (ClutterStage *stage,
+ const gchar *title)
+{
+ ClutterStagePrivate *priv;
+
+ g_return_if_fail (CLUTTER_IS_STAGE (stage));
+
+ priv = stage->priv;
+
+ g_free (priv->title);
+ priv->title = g_strdup (title);
+
+ if (CLUTTER_STAGE_GET_CLASS (stage)->set_title)
+ CLUTTER_STAGE_GET_CLASS (stage)->set_title (stage, priv->title);
+
+ g_object_notify (G_OBJECT (stage), "title");
+}
+
+/**
+ * clutter_stage_get_title
+ * @stage: A #ClutterStage
+ *
+ * Gets the stage title.
+ *
+ * Return value: pointer to the title string for the stage. The
+ * returned string is owned by the actor and should not
+ * be modified or freed.
+ *
+ * Since: 0.4
+ **/
+G_CONST_RETURN gchar *
+clutter_stage_get_title (ClutterStage *stage)
+{
+ g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
+
+ return stage->priv->title;
+}
+
/*** Perspective boxed type ******/
/**
gint y,
gint width,
gint height);
+ void (* set_title) (ClutterStage *stage,
+ const gchar *title);
/* signals */
void (* event) (ClutterStage *stage,
gboolean clutter_stage_event (ClutterStage *stage,
ClutterEvent *event);
+void clutter_stage_set_title (ClutterStage *stage,
+ const gchar *title);
+G_CONST_RETURN gchar *clutter_stage_get_title (ClutterStage *stage);
+
G_END_DECLS
#endif /* __CLUTTER_STAGE_H__ */
void
cogl_rectangle (gint x, gint y, guint width, guint height)
{
- GE( glRecti (x,y ,width, height) );
+ GE( glRecti (x, y, x + width, y + height) );
}
/* FIXME: Should use ClutterReal or Fixed */
}
static void
+clutter_stage_glx_set_title (ClutterStage *stage,
+ const gchar *title)
+{
+ ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (stage);
+ Atom atom_NET_WM_NAME, atom_UTF8_STRING;
+
+ if (stage_glx->xwin == None)
+ return;
+
+ /* FIXME: pre create these to avoid too many round trips */
+ atom_NET_WM_NAME = XInternAtom (stage_glx->xdpy, "_NET_WM_NAME", False);
+ atom_UTF8_STRING = XInternAtom (stage_glx->xdpy, "UTF8_STRING", False);
+
+ if (title == NULL)
+ {
+ XDeleteProperty (stage_glx->xdpy,
+ stage_glx->xwin,
+ atom_NET_WM_NAME);
+ }
+ else
+ {
+ XChangeProperty (stage_glx->xdpy,
+ stage_glx->xwin,
+ atom_NET_WM_NAME,
+ atom_UTF8_STRING,
+ 8,
+ PropModeReplace,
+ (unsigned char*)title,
+ (int)strlen(title));
+ }
+}
+
+static void
clutter_stage_glx_set_offscreen (ClutterStage *stage,
gboolean offscreen)
{
-
+ /* Do nothing ? */
}
static void
stage_class->set_cursor_visible = clutter_stage_glx_set_cursor_visible;
stage_class->set_offscreen = clutter_stage_glx_set_offscreen;
stage_class->draw_to_pixbuf = clutter_stage_glx_draw_to_pixbuf;
+ stage_class->set_title = clutter_stage_glx_set_title;
}
static void
}
static void
+clutter_stage_sdl_set_title (ClutterStage *stage,
+ const gchar *title)
+{
+ SDL_WM_SetCaption (title, NULL);
+}
+
+static void
clutter_stage_sdl_dispose (GObject *gobject)
{
ClutterStageSDL *stage_sdl = CLUTTER_STAGE_SDL (gobject);
stage_class->set_cursor_visible = clutter_stage_sdl_set_cursor_visible;
stage_class->set_offscreen = clutter_stage_sdl_set_offscreen;
stage_class->draw_to_pixbuf = clutter_stage_sdl_draw_to_pixbuf;
+ stage_class->set_title = clutter_stage_sdl_set_title;
}
static void
clutter_actor_set_size (stage, 800, 600);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
-
+ clutter_stage_set_title (stage, "ClutterEntry Test");
+
entry = clutter_entry_new_with_text ("Sans 14",
"Type something, be sure to use the "
"left/right arrow keys to move the "