Merge branch 'nolayout' into 'master'
Drop layout field on the keyboard See merge request Librem5/squeekboard!122
This commit is contained in:
@ -41,7 +41,6 @@
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_LAYOUT,
|
|
||||||
PROP_MODIFIER_BEHAVIOR,
|
PROP_MODIFIER_BEHAVIOR,
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
@ -67,7 +66,6 @@ static guint signals[LAST_SIGNAL] = { 0, };
|
|||||||
|
|
||||||
struct _EekKeyboardPrivate
|
struct _EekKeyboardPrivate
|
||||||
{
|
{
|
||||||
EekLayout *layout;
|
|
||||||
EekModifierBehavior modifier_behavior;
|
EekModifierBehavior modifier_behavior;
|
||||||
EekModifierType modifiers;
|
EekModifierType modifiers;
|
||||||
unsigned int old_level;
|
unsigned int old_level;
|
||||||
@ -172,14 +170,7 @@ eek_keyboard_set_property (GObject *object,
|
|||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_LAYOUT:
|
|
||||||
priv->layout = g_value_get_object (value);
|
|
||||||
if (priv->layout)
|
|
||||||
g_object_ref (priv->layout);
|
|
||||||
break;
|
|
||||||
case PROP_MODIFIER_BEHAVIOR:
|
case PROP_MODIFIER_BEHAVIOR:
|
||||||
eek_keyboard_set_modifier_behavior (EEK_KEYBOARD(object),
|
eek_keyboard_set_modifier_behavior (EEK_KEYBOARD(object),
|
||||||
g_value_get_enum (value));
|
g_value_get_enum (value));
|
||||||
@ -196,12 +187,7 @@ eek_keyboard_get_property (GObject *object,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_LAYOUT:
|
|
||||||
g_value_set_object (value, priv->layout);
|
|
||||||
break;
|
|
||||||
case PROP_MODIFIER_BEHAVIOR:
|
case PROP_MODIFIER_BEHAVIOR:
|
||||||
g_value_set_enum (value,
|
g_value_set_enum (value,
|
||||||
eek_keyboard_get_modifier_behavior (EEK_KEYBOARD(object)));
|
eek_keyboard_get_modifier_behavior (EEK_KEYBOARD(object)));
|
||||||
@ -384,13 +370,6 @@ void eek_keyboard_release_key( EekKeyboard *keyboard,
|
|||||||
static void
|
static void
|
||||||
eek_keyboard_dispose (GObject *object)
|
eek_keyboard_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(object);
|
|
||||||
|
|
||||||
if (priv->layout) {
|
|
||||||
g_object_unref (priv->layout);
|
|
||||||
priv->layout = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (eek_keyboard_parent_class)->dispose (object);
|
G_OBJECT_CLASS (eek_keyboard_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,20 +435,6 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
|
|||||||
gobject_class->dispose = eek_keyboard_dispose;
|
gobject_class->dispose = eek_keyboard_dispose;
|
||||||
gobject_class->finalize = eek_keyboard_finalize;
|
gobject_class->finalize = eek_keyboard_finalize;
|
||||||
|
|
||||||
/**
|
|
||||||
* EekKeyboard:layout:
|
|
||||||
*
|
|
||||||
* The layout used to create this #EekKeyboard.
|
|
||||||
*/
|
|
||||||
pspec = g_param_spec_object ("layout",
|
|
||||||
"Layout",
|
|
||||||
"Layout used to create the keyboard",
|
|
||||||
EEK_TYPE_LAYOUT,
|
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
|
|
||||||
g_object_class_install_property (gobject_class,
|
|
||||||
PROP_LAYOUT,
|
|
||||||
pspec);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EekKeyboard:modifier-behavior:
|
* EekKeyboard:modifier-behavior:
|
||||||
*
|
*
|
||||||
@ -569,20 +534,6 @@ eek_keyboard_find_key_by_name (EekKeyboard *keyboard,
|
|||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_keyboard_get_layout:
|
|
||||||
* @keyboard: an #EekKeyboard
|
|
||||||
*
|
|
||||||
* Get the layout used to create @keyboard.
|
|
||||||
* Returns: an #EekLayout
|
|
||||||
*/
|
|
||||||
EekLayout *
|
|
||||||
eek_keyboard_get_layout (EekKeyboard *keyboard)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (EEK_IS_KEYBOARD(keyboard), NULL);
|
|
||||||
return keyboard->priv->layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* eek_keyboard_get_size:
|
* eek_keyboard_get_size:
|
||||||
* @keyboard: an #EekKeyboard
|
* @keyboard: an #EekKeyboard
|
||||||
|
|||||||
@ -131,8 +131,6 @@ EekKeyboard *eek_keyboard_new (EekboardContextService *manager,
|
|||||||
gdouble initial_height);
|
gdouble initial_height);
|
||||||
GType eek_keyboard_get_type
|
GType eek_keyboard_get_type
|
||||||
(void) G_GNUC_CONST;
|
(void) G_GNUC_CONST;
|
||||||
EekLayout *eek_keyboard_get_layout
|
|
||||||
(EekKeyboard *keyboard);
|
|
||||||
void eek_keyboard_get_size
|
void eek_keyboard_get_size
|
||||||
(EekKeyboard *keyboard,
|
(EekKeyboard *keyboard,
|
||||||
gdouble *width,
|
gdouble *width,
|
||||||
|
|||||||
@ -192,10 +192,6 @@ render_key_outline (EekRenderer *renderer,
|
|||||||
EekOutline *outline;
|
EekOutline *outline;
|
||||||
EekBounds bounds;
|
EekBounds bounds;
|
||||||
guint oref;
|
guint oref;
|
||||||
EekColor foreground, background, gradient_start, gradient_end, border_color;
|
|
||||||
EekGradientType gradient_type;
|
|
||||||
gint border_width;
|
|
||||||
gint border_radius;
|
|
||||||
|
|
||||||
oref = eek_key_get_oref (key);
|
oref = eek_key_get_oref (key);
|
||||||
outline = eek_keyboard_get_outline (priv->keyboard, oref);
|
outline = eek_keyboard_get_outline (priv->keyboard, oref);
|
||||||
@ -295,8 +291,8 @@ render_key (EekRenderer *self,
|
|||||||
|
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
cairo_translate (cr,
|
cairo_translate (cr,
|
||||||
(bounds.width - width / scale) / 2,
|
(bounds.width - (double)width / scale) / 2,
|
||||||
(bounds.height - height / scale) / 2);
|
(bounds.height - (double)height / scale) / 2);
|
||||||
cairo_rectangle (cr, 0, 0, width, height);
|
cairo_rectangle (cr, 0, 0, width, height);
|
||||||
cairo_clip (cr);
|
cairo_clip (cr);
|
||||||
/* Draw the shape of the icon using the foreground color */
|
/* Draw the shape of the icon using the foreground color */
|
||||||
@ -320,8 +316,8 @@ render_key (EekRenderer *self,
|
|||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
cairo_move_to
|
cairo_move_to
|
||||||
(cr,
|
(cr,
|
||||||
(bounds.width - extents.width / PANGO_SCALE) / 2,
|
(bounds.width - (double)extents.width / PANGO_SCALE) / 2,
|
||||||
(bounds.height - extents.height / PANGO_SCALE) / 2);
|
(bounds.height - (double)extents.height / PANGO_SCALE) / 2);
|
||||||
|
|
||||||
cairo_set_source_rgba (cr,
|
cairo_set_source_rgba (cr,
|
||||||
foreground.red,
|
foreground.red,
|
||||||
@ -770,8 +766,8 @@ eek_renderer_set_allocation_size (EekRenderer *renderer,
|
|||||||
|
|
||||||
priv->scale = scale;
|
priv->scale = scale;
|
||||||
/* Set the rendering offset in widget coordinates to center the keyboard */
|
/* Set the rendering offset in widget coordinates to center the keyboard */
|
||||||
priv->origin_x = (width - (scale * w)) / 2;
|
priv->origin_x = (gint)floor((width - (scale * w)) / 2);
|
||||||
priv->origin_y = (height - (scale * h)) / 2;
|
priv->origin_y = (gint)floor((height - (scale * h)) / 2);
|
||||||
invalidate (renderer);
|
invalidate (renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -989,7 +985,6 @@ eek_renderer_get_foreground_color (EekRenderer *renderer,
|
|||||||
g_return_if_fail (EEK_IS_RENDERER(renderer));
|
g_return_if_fail (EEK_IS_RENDERER(renderer));
|
||||||
g_return_if_fail (color);
|
g_return_if_fail (color);
|
||||||
|
|
||||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
|
|
||||||
GtkStateFlags flags = GTK_STATE_FLAG_NORMAL;
|
GtkStateFlags flags = GTK_STATE_FLAG_NORMAL;
|
||||||
GdkRGBA gcolor;
|
GdkRGBA gcolor;
|
||||||
|
|
||||||
@ -1012,6 +1007,7 @@ typedef struct _FindKeyByPositionCallbackData FindKeyByPositionCallbackData;
|
|||||||
static gboolean
|
static gboolean
|
||||||
sign (EekPoint *p1, EekPoint *p2, EekPoint *p3)
|
sign (EekPoint *p1, EekPoint *p2, EekPoint *p3)
|
||||||
{
|
{
|
||||||
|
// FIXME: what is this actually checking?
|
||||||
return (p1->x - p3->x) * (p2->y - p3->y) -
|
return (p1->x - p3->x) * (p2->y - p3->y) -
|
||||||
(p2->x - p3->x) * (p1->y - p3->y);
|
(p2->x - p3->x) * (p1->y - p3->y);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -892,7 +892,7 @@ eek_xml_layout_real_create_keyboard (EekboardContextService *manager,
|
|||||||
|
|
||||||
/* Create an empty keyboard to which geometry and symbols
|
/* Create an empty keyboard to which geometry and symbols
|
||||||
information are applied. */
|
information are applied. */
|
||||||
EekKeyboard *keyboard = g_object_new (EEK_TYPE_KEYBOARD, "layout", layout, NULL);
|
EekKeyboard *keyboard = g_object_new (EEK_TYPE_KEYBOARD, NULL);
|
||||||
keyboard->manager = manager;
|
keyboard->manager = manager;
|
||||||
|
|
||||||
/* Read geometry information. */
|
/* Read geometry information. */
|
||||||
|
|||||||
Reference in New Issue
Block a user