libeek: abolish arguments for eek_clutter_keyboard_new() and eek_xkb_layout_new()
This commit is contained in:
@ -49,9 +49,8 @@ eek_clutter_key_real_set_name (EekElement *self,
|
|||||||
EEK_ELEMENT_CLASS (eek_clutter_key_parent_class)->
|
EEK_ELEMENT_CLASS (eek_clutter_key_parent_class)->
|
||||||
set_name (self, name);
|
set_name (self, name);
|
||||||
|
|
||||||
g_return_if_fail (priv->actor);
|
if (priv->actor)
|
||||||
|
clutter_actor_set_name (CLUTTER_ACTOR(priv->actor), name);
|
||||||
clutter_actor_set_name (CLUTTER_ACTOR(priv->actor), name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -63,10 +62,10 @@ eek_clutter_key_real_set_bounds (EekElement *self,
|
|||||||
EEK_ELEMENT_CLASS (eek_clutter_key_parent_class)->
|
EEK_ELEMENT_CLASS (eek_clutter_key_parent_class)->
|
||||||
set_bounds (self, bounds);
|
set_bounds (self, bounds);
|
||||||
|
|
||||||
g_return_if_fail (priv->actor);
|
if (priv->actor) {
|
||||||
|
clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
|
||||||
clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
|
clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
|
||||||
clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@ -57,9 +57,8 @@ eek_clutter_keyboard_real_set_name (EekElement *self,
|
|||||||
EEK_ELEMENT_CLASS (eek_clutter_keyboard_parent_class)->
|
EEK_ELEMENT_CLASS (eek_clutter_keyboard_parent_class)->
|
||||||
set_name (self, name);
|
set_name (self, name);
|
||||||
|
|
||||||
g_return_if_fail (priv->actor);
|
if (priv->actor)
|
||||||
|
clutter_actor_set_name (priv->actor, name);
|
||||||
clutter_actor_set_name (priv->actor, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -71,10 +70,10 @@ eek_clutter_keyboard_real_set_bounds (EekElement *self,
|
|||||||
EEK_ELEMENT_CLASS (eek_clutter_keyboard_parent_class)->
|
EEK_ELEMENT_CLASS (eek_clutter_keyboard_parent_class)->
|
||||||
set_bounds (self, bounds);
|
set_bounds (self, bounds);
|
||||||
|
|
||||||
g_return_if_fail (priv->actor);
|
if (priv->actor) {
|
||||||
|
clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
|
||||||
clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
|
clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
|
||||||
clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -176,29 +175,13 @@ eek_clutter_keyboard_init (EekClutterKeyboard *self)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* eek_clutter_keyboard_new:
|
* eek_clutter_keyboard_new:
|
||||||
* @width: max width of the area where the keyboard to be drawn
|
|
||||||
* @height: max height of the area where the keyboard to be drawn
|
|
||||||
*
|
*
|
||||||
* Create a new #EekClutterKeyboard.
|
* Create a new #EekClutterKeyboard.
|
||||||
*/
|
*/
|
||||||
EekKeyboard*
|
EekKeyboard*
|
||||||
eek_clutter_keyboard_new (gfloat width,
|
eek_clutter_keyboard_new (void)
|
||||||
gfloat height)
|
|
||||||
{
|
{
|
||||||
EekKeyboard *keyboard;
|
return g_object_new (EEK_TYPE_CLUTTER_KEYBOARD, NULL);
|
||||||
EekBounds bounds;
|
|
||||||
|
|
||||||
keyboard = g_object_new (EEK_TYPE_CLUTTER_KEYBOARD, NULL);
|
|
||||||
g_return_val_if_fail (keyboard, NULL);
|
|
||||||
|
|
||||||
/* Can't call set_bounds of this class since it needs priv->actor
|
|
||||||
initialized */
|
|
||||||
memset (&bounds, 0, sizeof bounds);
|
|
||||||
bounds.width = width;
|
|
||||||
bounds.height = height;
|
|
||||||
EEK_ELEMENT_CLASS (eek_clutter_keyboard_parent_class)->
|
|
||||||
set_bounds (EEK_ELEMENT(keyboard), &bounds);
|
|
||||||
return keyboard;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|||||||
@ -50,8 +50,7 @@ struct _EekClutterKeyboardClass
|
|||||||
};
|
};
|
||||||
|
|
||||||
GType eek_clutter_keyboard_get_type (void) G_GNUC_CONST;
|
GType eek_clutter_keyboard_get_type (void) G_GNUC_CONST;
|
||||||
EekKeyboard *eek_clutter_keyboard_new (gfloat width,
|
EekKeyboard *eek_clutter_keyboard_new (void);
|
||||||
gfloat height);
|
|
||||||
ClutterActor *eek_clutter_keyboard_get_actor (EekClutterKeyboard *keyboard);
|
ClutterActor *eek_clutter_keyboard_get_actor (EekClutterKeyboard *keyboard);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
@ -48,9 +48,8 @@ eek_clutter_section_real_set_name (EekElement *self,
|
|||||||
EEK_ELEMENT_CLASS (eek_clutter_section_parent_class)->
|
EEK_ELEMENT_CLASS (eek_clutter_section_parent_class)->
|
||||||
set_name (self, name);
|
set_name (self, name);
|
||||||
|
|
||||||
g_return_if_fail (priv->actor);
|
if (priv->actor)
|
||||||
|
clutter_actor_set_name (priv->actor, name);
|
||||||
clutter_actor_set_name (priv->actor, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -62,10 +61,10 @@ eek_clutter_section_real_set_bounds (EekElement *self,
|
|||||||
EEK_ELEMENT_CLASS (eek_clutter_section_parent_class)->
|
EEK_ELEMENT_CLASS (eek_clutter_section_parent_class)->
|
||||||
set_bounds (self, bounds);
|
set_bounds (self, bounds);
|
||||||
|
|
||||||
g_return_if_fail (priv->actor);
|
if (priv->actor) {
|
||||||
|
clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
|
||||||
clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
|
clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
|
||||||
clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@ -544,32 +544,19 @@ get_names (EekXkbLayout *layout)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* eek_xkb_layout_new:
|
* eek_xkb_layout_new:
|
||||||
* @keycodes: component name for keycodes
|
|
||||||
* @geometry: component name for geometry
|
|
||||||
* @symbols: component name for symbols
|
|
||||||
*
|
*
|
||||||
* Create a new #EekXkbLayout.
|
* Create a new #EekXkbLayout.
|
||||||
*/
|
*/
|
||||||
EekLayout *
|
EekLayout *
|
||||||
eek_xkb_layout_new (const gchar *keycodes,
|
eek_xkb_layout_new (void)
|
||||||
const gchar *geometry,
|
|
||||||
const gchar *symbols)
|
|
||||||
{
|
{
|
||||||
EekXkbLayout *layout;
|
EekXkbLayout *layout;
|
||||||
EekXkbLayoutPrivate *priv;
|
|
||||||
|
|
||||||
layout = g_object_new (EEK_TYPE_XKB_LAYOUT, NULL);
|
layout = g_object_new (EEK_TYPE_XKB_LAYOUT, NULL);
|
||||||
g_return_val_if_fail (layout, NULL);
|
g_return_val_if_fail (layout, NULL);
|
||||||
priv = layout->priv;
|
|
||||||
if (keycodes)
|
|
||||||
priv->names.keycodes = g_strdup (keycodes);
|
|
||||||
if (geometry)
|
|
||||||
priv->names.geometry = g_strdup (geometry);
|
|
||||||
if (symbols)
|
|
||||||
priv->names.symbols = g_strdup (symbols);
|
|
||||||
|
|
||||||
get_keyboard (layout);
|
get_keyboard (layout);
|
||||||
if (priv->xkb == NULL) {
|
if (layout->priv->xkb == NULL) {
|
||||||
g_object_unref (layout);
|
g_object_unref (layout);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,11 +52,7 @@ struct _EekXkbLayoutClass
|
|||||||
};
|
};
|
||||||
|
|
||||||
GType eek_xkb_layout_get_type (void) G_GNUC_CONST;
|
GType eek_xkb_layout_get_type (void) G_GNUC_CONST;
|
||||||
|
EekLayout *eek_xkb_layout_new (void);
|
||||||
EekLayout *eek_xkb_layout_new (const gchar *keycodes,
|
|
||||||
const gchar *geometry,
|
|
||||||
const gchar *symbols);
|
|
||||||
|
|
||||||
|
|
||||||
gboolean eek_xkb_layout_set_names (EekXkbLayout *layout,
|
gboolean eek_xkb_layout_set_names (EekXkbLayout *layout,
|
||||||
XkbComponentNamesRec *names);
|
XkbComponentNamesRec *names);
|
||||||
|
|||||||
@ -383,15 +383,20 @@ on_resize (GObject *object,
|
|||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
create_widget_clutter (Eekboard *eekboard,
|
create_widget_clutter (Eekboard *eekboard,
|
||||||
gfloat initial_width,
|
gint initial_width,
|
||||||
gfloat initial_height)
|
gint initial_height)
|
||||||
{
|
{
|
||||||
ClutterActor *stage, *actor;
|
ClutterActor *stage, *actor;
|
||||||
ClutterColor stage_color = { 0xff, 0xff, 0xff, 0xff };
|
ClutterColor stage_color = { 0xff, 0xff, 0xff, 0xff };
|
||||||
|
EekBounds bounds;
|
||||||
|
|
||||||
eekboard->keyboard = eek_clutter_keyboard_new (initial_width,
|
bounds.x = bounds.y = 0;
|
||||||
initial_height);
|
bounds.width = initial_width;
|
||||||
|
bounds.height = initial_height;
|
||||||
|
|
||||||
|
eekboard->keyboard = eek_clutter_keyboard_new ();
|
||||||
eek_keyboard_set_layout (eekboard->keyboard, eekboard->layout);
|
eek_keyboard_set_layout (eekboard->keyboard, eekboard->layout);
|
||||||
|
eek_element_set_bounds (EEK_ELEMENT(eekboard->keyboard), &bounds);
|
||||||
g_signal_connect (eekboard->keyboard, "key-pressed",
|
g_signal_connect (eekboard->keyboard, "key-pressed",
|
||||||
G_CALLBACK(on_key_pressed), eekboard);
|
G_CALLBACK(on_key_pressed), eekboard);
|
||||||
g_signal_connect (eekboard->keyboard, "key-released",
|
g_signal_connect (eekboard->keyboard, "key-released",
|
||||||
@ -416,8 +421,8 @@ create_widget_clutter (Eekboard *eekboard,
|
|||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
create_widget_gtk (Eekboard *eekboard,
|
create_widget_gtk (Eekboard *eekboard,
|
||||||
gfloat initial_width,
|
gint initial_width,
|
||||||
gfloat initial_height)
|
gint initial_height)
|
||||||
{
|
{
|
||||||
EekBounds bounds;
|
EekBounds bounds;
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ test_create (void)
|
|||||||
EekLayout *layout;
|
EekLayout *layout;
|
||||||
const gchar *keycodes, *geometry, *symbols;
|
const gchar *keycodes, *geometry, *symbols;
|
||||||
|
|
||||||
layout = eek_xkb_layout_new (NULL, "winbook", NULL);
|
layout = eek_xkb_layout_new ();
|
||||||
g_assert (layout);
|
g_assert (layout);
|
||||||
keycodes = eek_xkb_layout_get_keycodes (EEK_XKB_LAYOUT(layout));
|
keycodes = eek_xkb_layout_get_keycodes (EEK_XKB_LAYOUT(layout));
|
||||||
g_assert (keycodes);
|
g_assert (keycodes);
|
||||||
|
|||||||
Reference in New Issue
Block a user