Compare commits

..

6 Commits

Author SHA1 Message Date
a175226ce3 Keep the build directory as an artifact 2019-07-22 20:35:18 +02:00
7c53d75718 Fix test step dependency 2019-07-22 20:12:26 +02:00
fa32a03fbf Update CI configuration to enable tests 2019-07-22 19:31:43 +02:00
53a6876830 Remove unused/unnecessary parts 2019-07-22 16:40:34 +02:00
629b15840a Add missing build file 2019-07-22 15:29:26 +02:00
ff3a7b02b6 Enable tests, fixing the existing ones to use the current API
This also involved building a static library for the application for
tests to link to. The main application executable also links to it.
2019-07-22 15:22:17 +02:00
5 changed files with 26 additions and 30 deletions

View File

@ -28,4 +28,6 @@ test:
dependencies:
- build_meson
script:
- xvfb-run -s -noreset ninja -C _build test
- export LC_ALL=C.UTF-8
- ninja -C _build test

5
debian/control vendored
View File

@ -11,10 +11,7 @@ Build-Depends:
libcroco3-dev,
libwayland-dev (>= 1.16),
rustc,
wayland-protocols (>= 1.14),
# for running the tests
xvfb,
xauth,
wayland-protocols (>= 1.14)
Standards-Version: 4.1.3
Homepage: https://source.puri.sm/Librem5/squeekboard

View File

@ -147,11 +147,12 @@ create_keyboard_surface_section_callback (EekElement *element,
cairo_restore (data->cr);
}
void
render_keyboard_surface (EekRenderer *renderer)
static cairo_surface_t *
create_keyboard_surface (EekRenderer *renderer)
{
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
EekBounds bounds;
cairo_surface_t *keyboard_surface;
CreateKeyboardSurfaceCallbackData data;
EekColor foreground, background;
@ -164,7 +165,14 @@ render_keyboard_surface (EekRenderer *renderer)
eek_element_get_bounds (EEK_ELEMENT(priv->keyboard), &bounds);
data.cr = cairo_create (priv->keyboard_surface);
/* Create a surface that encompasses the dimensions of the keyboard as well
as the margin around the edge. */
keyboard_surface = cairo_image_surface_create (
CAIRO_FORMAT_ARGB32,
ceil(((bounds.x * 2) + bounds.width) * priv->scale),
ceil(((bounds.y * 2) + bounds.height) * priv->scale));
data.cr = cairo_create (keyboard_surface);
data.renderer = renderer;
cairo_translate (data.cr, bounds.x * priv->scale, bounds.y * priv->scale);
@ -188,6 +196,8 @@ render_keyboard_surface (EekRenderer *renderer)
create_keyboard_surface_section_callback,
&data);
cairo_destroy (data.cr);
return keyboard_surface;
}
static void
@ -696,14 +706,8 @@ eek_renderer_real_render_keyboard (EekRenderer *self,
g_return_if_fail (priv->allocation_width > 0.0);
g_return_if_fail (priv->allocation_height > 0.0);
if (priv->keyboard_surface)
cairo_surface_destroy (priv->keyboard_surface);
priv->keyboard_surface = cairo_surface_create_for_rectangle (
cairo_get_target (cr), 0, 0,
priv->allocation_width, priv->allocation_height);
render_keyboard_surface (self);
if (!priv->keyboard_surface)
priv->keyboard_surface = create_keyboard_surface (self);
cairo_set_source_surface (cr, priv->keyboard_surface, 0.0, 0.0);
source = cairo_get_source (cr);

View File

@ -89,7 +89,6 @@ libsqueekboard = static_library('libsqueekboard',
squeekboard = executable('squeekboard',
'server-main.c',
wl_proto_sources,
squeekboard_resources,
link_with: libsqueekboard,
include_directories: [include_directories('..'), include_directories('../eek')],
dependencies: deps,

View File

@ -75,9 +75,6 @@ on_destroy (GtkWidget *widget, gpointer user_data)
eekboard_context_service_destroy (EEKBOARD_CONTEXT_SERVICE (context));
}
static void
make_widget (ServerContextService *context);
static void
on_notify_keyboard (GObject *object,
GParamSpec *spec,
@ -97,9 +94,6 @@ on_notify_keyboard (GObject *object,
keyboard);
/* Recreate the keyboard widget to keep in sync with the keymap. */
if (context->window)
make_widget(context);
gboolean visible;
g_object_get (context, "visible", &visible, NULL);
@ -238,11 +232,7 @@ make_widget (ServerContextService *context)
EekKeyboard *keyboard;
EekTheme *theme;
if (context->widget) {
gtk_widget_destroy(context->widget);
context->widget = NULL;
}
g_return_if_fail (!context->widget);
theme = eek_theme_new ("resource:///sm/puri/squeekboard/style.css",
NULL,
NULL);
@ -267,7 +257,11 @@ server_context_service_real_show_keyboard (EekboardContextService *_context)
if (!context->window)
make_window (context);
if (!context->widget)
if (context->widget) {
gtk_widget_destroy(context->widget);
context->widget = NULL;
}
make_widget (context);
EEKBOARD_CONTEXT_SERVICE_CLASS (server_context_service_parent_class)->