Avoid to use Clutter scaling feature.
This commit is contained in:
@ -80,7 +80,7 @@ on_released (EekKey *key, gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eek_clutter_key_real_realize (ClutterActor *self)
|
set_position (ClutterActor *self)
|
||||||
{
|
{
|
||||||
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
|
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
|
||||||
EekBounds bounds;
|
EekBounds bounds;
|
||||||
@ -88,11 +88,15 @@ eek_clutter_key_real_realize (ClutterActor *self)
|
|||||||
|
|
||||||
eek_element_get_bounds (EEK_ELEMENT(priv->key), &bounds);
|
eek_element_get_bounds (EEK_ELEMENT(priv->key), &bounds);
|
||||||
scale = eek_renderer_get_scale (EEK_RENDERER(priv->renderer));
|
scale = eek_renderer_get_scale (EEK_RENDERER(priv->renderer));
|
||||||
|
clutter_actor_set_position (self, bounds.x * scale, bounds.y * scale);
|
||||||
|
}
|
||||||
|
|
||||||
clutter_actor_set_position (self,
|
static void
|
||||||
bounds.x * scale,
|
eek_clutter_key_real_realize (ClutterActor *self)
|
||||||
bounds.y * scale);
|
{
|
||||||
|
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
|
||||||
|
|
||||||
|
set_position (self);
|
||||||
clutter_actor_set_reactive (self, TRUE);
|
clutter_actor_set_reactive (self, TRUE);
|
||||||
|
|
||||||
g_signal_connect (priv->key, "pressed",
|
g_signal_connect (priv->key, "pressed",
|
||||||
@ -106,6 +110,7 @@ eek_clutter_key_real_paint (ClutterActor *self)
|
|||||||
{
|
{
|
||||||
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
|
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
|
||||||
|
|
||||||
|
set_position (self);
|
||||||
eek_clutter_renderer_render_key (priv->renderer, self, priv->key);
|
eek_clutter_renderer_render_key (priv->renderer, self, priv->key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -60,21 +60,28 @@ create_key (EekElement *element, gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eek_clutter_section_real_realize (ClutterActor *self)
|
set_position (ClutterActor *self)
|
||||||
{
|
{
|
||||||
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
|
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
|
||||||
CreateKeyCallbackData data;
|
|
||||||
EekBounds bounds;
|
EekBounds bounds;
|
||||||
gdouble scale;
|
gdouble scale;
|
||||||
|
|
||||||
eek_element_get_bounds (EEK_ELEMENT(priv->section), &bounds);
|
eek_element_get_bounds (EEK_ELEMENT(priv->section), &bounds);
|
||||||
scale = eek_renderer_get_scale (EEK_RENDERER(priv->renderer));
|
scale = eek_renderer_get_scale (EEK_RENDERER(priv->renderer));
|
||||||
clutter_actor_set_position (self, bounds.x * scale, bounds.y * scale);
|
clutter_actor_set_position (self, bounds.x * scale, bounds.y * scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eek_clutter_section_real_realize (ClutterActor *self)
|
||||||
|
{
|
||||||
|
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
|
||||||
|
CreateKeyCallbackData data;
|
||||||
|
|
||||||
clutter_actor_set_rotation (self,
|
clutter_actor_set_rotation (self,
|
||||||
CLUTTER_Z_AXIS,
|
CLUTTER_Z_AXIS,
|
||||||
eek_section_get_angle (priv->section),
|
eek_section_get_angle (priv->section),
|
||||||
0.0f, 0.0f, 0.0f);
|
0.0f, 0.0f, 0.0f);
|
||||||
|
set_position (self);
|
||||||
data.actor = self;
|
data.actor = self;
|
||||||
data.renderer = priv->renderer;
|
data.renderer = priv->renderer;
|
||||||
eek_container_foreach_child (EEK_CONTAINER(priv->section),
|
eek_container_foreach_child (EEK_CONTAINER(priv->section),
|
||||||
@ -82,6 +89,14 @@ eek_clutter_section_real_realize (ClutterActor *self)
|
|||||||
&data);
|
&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eek_clutter_section_real_paint (ClutterActor *self)
|
||||||
|
{
|
||||||
|
set_position (self);
|
||||||
|
CLUTTER_ACTOR_CLASS (eek_clutter_section_parent_class)->
|
||||||
|
paint (self);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eek_clutter_section_real_get_preferred_width (ClutterActor *self,
|
eek_clutter_section_real_get_preferred_width (ClutterActor *self,
|
||||||
float for_height,
|
float for_height,
|
||||||
@ -114,15 +129,6 @@ eek_clutter_section_real_get_preferred_height (ClutterActor *self,
|
|||||||
*natural_height_p = bounds.height * scale;
|
*natural_height_p = bounds.height * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
eek_clutter_section_real_allocate (ClutterActor *self,
|
|
||||||
const ClutterActorBox *box,
|
|
||||||
ClutterAllocationFlags flags)
|
|
||||||
{
|
|
||||||
CLUTTER_ACTOR_CLASS (eek_clutter_section_parent_class)->
|
|
||||||
allocate (self, box, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eek_clutter_section_set_property (GObject *object,
|
eek_clutter_section_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
@ -177,11 +183,12 @@ eek_clutter_section_class_init (EekClutterSectionClass *klass)
|
|||||||
|
|
||||||
actor_class->realize =
|
actor_class->realize =
|
||||||
eek_clutter_section_real_realize;
|
eek_clutter_section_real_realize;
|
||||||
|
actor_class->paint =
|
||||||
|
eek_clutter_section_real_paint;
|
||||||
actor_class->get_preferred_width =
|
actor_class->get_preferred_width =
|
||||||
eek_clutter_section_real_get_preferred_width;
|
eek_clutter_section_real_get_preferred_width;
|
||||||
actor_class->get_preferred_height =
|
actor_class->get_preferred_height =
|
||||||
eek_clutter_section_real_get_preferred_height;
|
eek_clutter_section_real_get_preferred_height;
|
||||||
actor_class->allocate = eek_clutter_section_real_allocate;
|
|
||||||
|
|
||||||
gobject_class->set_property = eek_clutter_section_set_property;
|
gobject_class->set_property = eek_clutter_section_set_property;
|
||||||
gobject_class->dispose = eek_clutter_section_dispose;
|
gobject_class->dispose = eek_clutter_section_dispose;
|
||||||
|
|||||||
@ -233,7 +233,7 @@ render_key_outline (EekRenderer *renderer,
|
|||||||
cairo_pattern_destroy (pat);
|
cairo_pattern_destroy (pat);
|
||||||
|
|
||||||
/* paint the border */
|
/* paint the border */
|
||||||
cairo_set_line_width (cr, priv->border_width * priv->scale);
|
cairo_set_line_width (cr, priv->border_width);
|
||||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
|
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
|
||||||
|
|
||||||
cairo_set_source_rgba
|
cairo_set_source_rgba
|
||||||
@ -296,13 +296,13 @@ calculate_font_size_key_callback (EekElement *element, gpointer user_data)
|
|||||||
g_free (label);
|
g_free (label);
|
||||||
|
|
||||||
pango_layout_get_extents (layout, NULL, &extents);
|
pango_layout_get_extents (layout, NULL, &extents);
|
||||||
|
g_object_unref (layout);
|
||||||
|
|
||||||
sx = sy = 1.0;
|
sx = sy = 1.0;
|
||||||
if (extents.width > bounds.width * PANGO_SCALE)
|
if (extents.width > bounds.width * PANGO_SCALE)
|
||||||
sx = bounds.width * PANGO_SCALE / extents.width;
|
sx = bounds.width * PANGO_SCALE / extents.width;
|
||||||
if (extents.height > bounds.height * PANGO_SCALE)
|
if (extents.height > bounds.height * PANGO_SCALE)
|
||||||
sy = bounds.height * PANGO_SCALE / extents.height;
|
sy = bounds.height * PANGO_SCALE / extents.height;
|
||||||
g_object_unref (layout);
|
|
||||||
|
|
||||||
size *= MIN(sx, sy);
|
size *= MIN(sx, sy);
|
||||||
if (size < data->size &&
|
if (size < data->size &&
|
||||||
@ -326,7 +326,7 @@ calculate_font_size (EekRenderer *renderer)
|
|||||||
PangoFontDescription *base_font;
|
PangoFontDescription *base_font;
|
||||||
|
|
||||||
base_font = pango_context_get_font_description (priv->pcontext);
|
base_font = pango_context_get_font_description (priv->pcontext);
|
||||||
data.size = pango_font_description_get_size (base_font);
|
data.size = G_MAXDOUBLE;
|
||||||
data.renderer = renderer;
|
data.renderer = renderer;
|
||||||
eek_container_foreach_child (EEK_CONTAINER(priv->keyboard),
|
eek_container_foreach_child (EEK_CONTAINER(priv->keyboard),
|
||||||
calculate_font_size_section_callback,
|
calculate_font_size_section_callback,
|
||||||
|
|||||||
@ -1046,7 +1046,9 @@ on_allocation_changed (ClutterActor *stage,
|
|||||||
eek_element_get_bounds (EEK_ELEMENT(eekboard->keyboard), &bounds);
|
eek_element_get_bounds (EEK_ELEMENT(eekboard->keyboard), &bounds);
|
||||||
scale = MIN((box->x2 - box->x1) / bounds.width,
|
scale = MIN((box->x2 - box->x1) / bounds.width,
|
||||||
(box->y2 - box->y1) / bounds.height);
|
(box->y2 - box->y1) / bounds.height);
|
||||||
clutter_actor_set_scale (eekboard->actor, scale, scale);
|
clutter_actor_set_size (eekboard->actor,
|
||||||
|
bounds.width * scale,
|
||||||
|
bounds.height * scale);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user