From cae72ec4195d3681f5eb25983c54a5845fb04dd6 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 31 Jul 2007 08:28:17 +0000 Subject: [PATCH] 2007-07-31 Emmanuele Bassi * clutter/clutter-entry.c (clutter_entry_init): Set the default size of the entry based on the size of the default font. (#414). --- ChangeLog | 5 +++++ clutter/clutter-entry.c | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f0aae575d..af7b336f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-07-31 Emmanuele Bassi + + * clutter/clutter-entry.c (clutter_entry_init): Set the default + size of the entry based on the size of the default font. (#414). + 2007-07-31 Emmanuele Bassi * clutter/sdl/clutter-backend-sdl.c: Fix a typo in diff --git a/clutter/clutter-entry.c b/clutter/clutter-entry.c index 8deaf7828..36a407bd3 100644 --- a/clutter/clutter-entry.c +++ b/clutter/clutter-entry.c @@ -715,6 +715,8 @@ static void clutter_entry_init (ClutterEntry *self) { ClutterEntryPrivate *priv; + gdouble resolution; + gint font_size; self->priv = priv = CLUTTER_ENTRY_GET_PRIVATE (self); @@ -749,7 +751,16 @@ clutter_entry_init (ClutterEntry *self) priv->font_name = g_strdup (DEFAULT_FONT_NAME); priv->desc = pango_font_description_from_string (priv->font_name); - + + /* we use the font size to set the default width and height, in case + * the user doesn't call clutter_actor_set_size(). + */ + resolution = 96.0; /* FIXME use clutter_backend_get_resolution() */ + font_size = PANGO_PIXELS (pango_font_description_get_size (priv->desc)) + * resolution + / 72.0; + clutter_actor_set_size (CLUTTER_ACTOR (self), font_size * 20, 50); + priv->cursor = clutter_rectangle_new_with_color (&priv->fgcol); clutter_actor_set_parent (priv->cursor, CLUTTER_ACTOR (self));