Compare commits

...

25 Commits

Author SHA1 Message Date
50d597d4e7 Document changes and release 1.0.10+nmu1 2019-10-07 09:41:09 +02:00
52e1e73bf3 debian: Drop virtboard build-dependency 2019-10-07 09:30:35 +02:00
a354fe2247 Add dbus protocol definition
This let's us drop the virtboard build dependency.
2019-10-07 09:30:35 +02:00
a129863a4d build: Apply fixes/suggestions
Following comments on https://source.puri.sm/Librem5/squeekboard/merge_requests/20
2019-07-02 20:14:12 +00:00
61a5e8d4fd install: Don't distribute dbus definition
Instead, require virtboard to provide it.
2019-07-02 18:13:34 +00:00
cb641bd221 ci: Prevent caching of build directory 2019-07-02 18:11:49 +00:00
2f6e9a1756 Merge branch 'remove-trigger-in-packaging' into 'squeekboard'
Remove unnecessary trigger

See merge request Librem5/squeekboard!18
2019-07-02 13:23:47 +00:00
51b183a0f3 Remove unnecessary trigger 2019-07-02 13:23:47 +00:00
d071bb04af Merge branch 'linking' into 'squeekboard'
build: Link Rust library statically

See merge request Librem5/squeekboard!16
2019-07-02 13:19:14 +00:00
ab2a27345d Merge branch 'modifiers' into 'squeekboard'
modifiers: Seem to be emitted correctly

See merge request Librem5/squeekboard!17
2019-07-02 11:54:34 +00:00
484eb3303c modifiers: Seem to be emitted correctly 2019-07-02 11:52:45 +00:00
319d64e1e5 build: Link Rust library statically 2019-07-02 10:11:32 +00:00
60250ca5e5 Merge branch 'font-size' into 'squeekboard'
hack: Adjust font size

See merge request Librem5/squeekboard!15
2019-07-01 15:41:10 +00:00
d729bb3a89 hack: Adjust font size 2019-07-01 15:27:06 +00:00
4dc55635d7 Merge branch 'new_layout' into 'squeekboard'
New layout

See merge request Librem5/squeekboard!13
2019-07-01 15:04:32 +00:00
4af49ef7b6 layout: Make keys higher 2019-07-01 13:31:53 +00:00
3a42e66504 layout: Position keys closer to the left edge 2019-07-01 12:57:52 +00:00
250b196b81 theme: Use mockup colors 2019-07-01 12:57:52 +00:00
9ba1987cab layout: Moved keys a bit to the left 2019-07-01 12:57:52 +00:00
909b1e2a28 theme: Adjust colors to match the mockup closer 2019-07-01 12:57:52 +00:00
e46af41abf layouts: Fixed spacing 2019-07-01 12:57:52 +00:00
17671a3b08 layout: Use outlines for key bounds 2019-07-01 12:57:52 +00:00
b8eb7752e7 layout: Using bigger keys 2019-07-01 12:57:52 +00:00
5e92f45111 layout: Arrange keys similar to mockup 2019-07-01 12:57:52 +00:00
baf848c791 layout: Ignore keycodes without corresponding keys 2019-07-01 12:57:52 +00:00
21 changed files with 345 additions and 336 deletions

View File

@ -4,6 +4,10 @@ stages:
- build
before_script:
- apt-get -y update
- apt-get -y install wget gnupg2
- echo "deb http://ci.puri.sm/ scratch librem5" > /etc/apt/sources.list.d/ci.list
- wget -O- https://ci.puri.sm/ci-repo.key | apt-key add -
- apt-get -y update
- apt-get -y build-dep .
@ -12,8 +16,6 @@ build_meson:
tags:
- librem5
script:
- mkdir -p ../build
- meson ../build/
- cd ../build
- ninja install
- meson . _build/ -Ddepdatadir=/usr/share
- ninja -C _build install

View File

@ -1,102 +1,11 @@
<?xml version="1.0"?>
<geometry version="0.90">
<bounds x="0.000000" y="0.000000" width="640.0000" height="296.5853"/>
<bounds x="0.000000" y="0.000000" width="410.0000" height="296.5853"/>
<section angle="0">
<bounds x="15.60975" y="15.60975" width="640.0000" height="39.02439"/>
<bounds x="0" y="0" width="608.7804" height="201.3658"/>
<row orientation="1">
<key keycode="9" name="ESC" oref="outline2">
<bounds x="3.121951" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="67" name="FK01" oref="outline2">
<bounds x="84.29268" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="68" name="FK02" oref="outline2">
<bounds x="124.8780" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="69" name="FK03" oref="outline2">
<bounds x="165.4634" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="70" name="FK04" oref="outline2">
<bounds x="206.0487" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="71" name="FK05" oref="outline2">
<bounds x="266.9268" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="72" name="FK06" oref="outline2">
<bounds x="307.5121" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="73" name="FK07" oref="outline2">
<bounds x="348.0975" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="74" name="FK08" oref="outline2">
<bounds x="388.6829" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="75" name="FK09" oref="outline2">
<bounds x="449.5609" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="76" name="FK10" oref="outline2">
<bounds x="490.1463" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="95" name="FK11" oref="outline2">
<bounds x="530.7317" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="96" name="FK12" oref="outline2">
<bounds x="571.3170" y="1.560976" width="37.46341" height="37.46341"/>
</key>
</row>
</section>
<section angle="0">
<bounds x="15.60975" y="78.04878" width="608.7804" height="201.3658"/>
<row orientation="1">
<key keycode="49" name="TLDE" oref="outline2">
<bounds x="3.121951" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="10" name="AE01" oref="outline2">
<bounds x="43.70731" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="11" name="AE02" oref="outline2">
<bounds x="84.29268" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="12" name="AE03" oref="outline2">
<bounds x="124.8780" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="13" name="AE04" oref="outline2">
<bounds x="165.4634" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="14" name="AE05" oref="outline2">
<bounds x="206.0487" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="15" name="AE06" oref="outline2">
<bounds x="245.0731" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="16" name="AE07" oref="outline2">
<bounds x="285.6585" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="17" name="AE08" oref="outline2">
<bounds x="326.2439" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="18" name="AE09" oref="outline2">
<bounds x="366.8292" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="19" name="AE10" oref="outline2">
<bounds x="407.4146" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="20" name="AE11" oref="outline2">
<bounds x="448.0000" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="21" name="AE12" oref="outline2">
<bounds x="488.5853" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="22" name="BKSP" oref="outline13">
<bounds x="529.1707" y="1.560976" width="79.60975" height="37.46341"/>
</key>
</row>
<row orientation="1">
<key keycode="23" name="TAB" oref="outline4">
<bounds x="3.121951" y="42.14634" width="59.31707" height="37.46341"/>
</key>
<key keycode="24" name="AD01" oref="outline2">
<bounds x="65.56097" y="42.14634" width="37.46341" height="37.46341"/>
<bounds x="65.56097" y="42.14634" width="37.46341" height="52.44877"/>
</key>
<key keycode="25" name="AD02" oref="outline2">
<bounds x="106.1463" y="42.14634" width="37.46341" height="37.46341"/>
@ -125,20 +34,11 @@
<key keycode="33" name="AD10" oref="outline2">
<bounds x="429.2682" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="34" name="AD11" oref="outline2">
<bounds x="468.2926" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="35" name="AD12" oref="outline2">
<bounds x="508.8780" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="51" name="BKSL" oref="outline5">
<bounds x="549.4634" y="42.14634" width="59.31707" height="37.46341"/>
</key>
</row>
</section>
<section angle="0">
<bounds x="0" y="0" width="608.7804" height="201.3658"/>
<row orientation="1">
<key keycode="66" name="CAPS" oref="outline6">
<bounds x="3.121951" y="82.73170" width="68.68292" height="37.46341"/>
</key>
<key keycode="38" name="AC01" oref="outline2">
<bounds x="76.48780" y="82.73170" width="37.46341" height="37.46341"/>
</key>
@ -166,18 +66,12 @@
<key keycode="46" name="AC09" oref="outline2">
<bounds x="399.6097" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="47" name="AC10" oref="outline2">
<bounds x="438.6341" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="48" name="AC11" oref="outline2">
<bounds x="479.2195" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="36" name="RTRN" oref="outline7">
<bounds x="519.8048" y="82.73170" width="88.97561" height="37.46341"/>
</key>
</row>
</section>
<section angle="0">
<bounds x="0" y="0" width="608.7804" height="201.3658"/>
<row orientation="1">
<key keycode="50" name="LFSH" oref="outline8">
<key keycode="50" name="LFSH" oref="altline">
<bounds x="3.121951" y="121.7560" width="88.97561" height="37.46341"/>
</key>
<key keycode="52" name="AB01" oref="outline2">
@ -201,113 +95,95 @@
<key keycode="58" name="AB07" oref="outline2">
<bounds x="337.1707" y="121.7560" width="37.46341" height="37.46341"/>
</key>
<key keycode="59" name="AB08" oref="outline2">
<bounds x="377.7560" y="121.7560" width="37.46341" height="37.46341"/>
<key keycode="22" name="BKSP" oref="altline">
<bounds x="529.1707" y="1.560976" width="79.60975" height="37.46341"/>
</key>
</row>
</section>
<section angle="0">
<bounds x="0" y="0" width="608.7804" height="201.3658"/>
<row orientation="1">
<key keycode="37" name="LCTL" oref="altline">
<bounds x="62.43902" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="64" name="LALT" oref="altline">
<bounds x="113.9512" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="65" name="SPCE" oref="spaceline">
<bounds x="165.4634" y="162.3414" width="217.5853" height="37.46341"/>
</key>
<key keycode="60" name="AB09" oref="outline2">
<bounds x="418.3414" y="121.7560" width="37.46341" height="37.46341"/>
</key>
<key keycode="61" name="AB10" oref="outline2">
<bounds x="458.9268" y="121.7560" width="37.46341" height="37.46341"/>
</key>
<key keycode="62" name="RTSH" oref="outline9">
<bounds x="499.5121" y="121.7560" width="109.2682" height="37.46341"/>
</key>
</row>
<row orientation="1">
<key keycode="149" name="I149" oref="outline10">
<bounds x="3.121951" y="162.3414" width="37.46341" height="37.46341"/>
</key>
<key keycode="37" name="LCTL" oref="outline1">
<bounds x="62.43902" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="64" name="LALT" oref="outline1">
<bounds x="113.9512" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="65" name="SPCE" oref="outline3">
<bounds x="165.4634" y="162.3414" width="217.5853" height="37.46341"/>
</key>
<key keycode="113" name="LEFT" oref="outline1">
<bounds x="368.0487" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="111" name="UP" oref="outline1">
<bounds x="419.43894" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="116" name="DOWN" oref="outline1">
<bounds x="470.82918" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="114" name="RGHT" oref="outline1">
<bounds x="522.21942" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="150" name="I150" oref="outline10">
<bounds x="573.60966" y="162.3414" width="37.46341" height="37.46341"/>
<key keycode="36" name="RTRN" oref="outline7">
<bounds x="519.8048" y="82.73170" width="88.97561" height="37.46341"/>
</key>
</row>
</section>
<outline id="outline2" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="37.46341" y="0.000000"/>
<point x="37.46341" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="37.46341" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline1" corner-radius="1.000000">
<outline id="altline" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="48.39024" y="0.000000"/>
<point x="48.39024" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="48.39024" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline4" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="59.31707" y="0.000000"/>
<point x="59.31707" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="59.31707" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline5" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="59.31707" y="0.000000"/>
<point x="59.31707" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="59.31707" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline6" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="68.68292" y="0.000000"/>
<point x="68.68292" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="68.68292" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline7" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="88.97561" y="0.000000"/>
<point x="88.97561" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="88.97561" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline8" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="88.97561" y="0.000000"/>
<point x="88.97561" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="88.97561" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline9" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="109.2682" y="0.000000"/>
<point x="109.2682" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="109.2682" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline10" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="37.46341" y="0.000000"/>
<point x="37.46341" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="37.46341" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline13" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="79.60975" y="0.000000"/>
<point x="79.60975" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="79.60975" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline3" corner-radius="1.000000">
<outline id="spaceline" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="217.5853" y="0.000000"/>
<point x="217.5853" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="150.5853" y="0.000000"/>
<point x="150.5853" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
</geometry>

View File

@ -14,10 +14,6 @@ install_data(
install_dir: pkgdatadir + '/keyboards/geometry/',
)
install_data('dbus/sm.puri.OSK0.xml',
install_dir: dbusdir
)
symbols = [
'ar.xml',
'as-inscript.xml',

View File

@ -5,18 +5,14 @@
}
.key {
color: #ffffff;
background-gradient-direction: vertical;
background-gradient-start: rgba(0, 0, 0, 255);
background-gradient-end: rgba(64, 64, 64, 255);
border-width: 2px;
border-color: rgba(128, 128, 128, 255);
border-radius: 3px;
color: #deddda;
background: #464448;
border-width: 0.5px;
border-color: #5e5c64;
border-radius: 2px;
}
.key:active {
background-gradient-direction: vertical;
background-gradient-start: rgba(0, 0, 255, 255);
background-gradient-end: rgba(64, 64, 255, 255);
border-color: rgba(160, 160, 255, 255);
background: #1c71d8;
border-color: #3584e4;
}

14
debian/changelog vendored
View File

@ -1,3 +1,17 @@
squeekboard (1.0.10+nmu1) amber-phone; urgency=medium
* Add dbus protocol definition.
This let's us drop the virtboard build dependency.
* debian: Drop virtboard build-dependency
-- Guido Günther <agx@sigxcpu.org> Mon, 07 Oct 2019 09:31:18 +0200
squeekboard (1.0.10) unstable; urgency=medium
* Use a shared DBus definition
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Tue, 02 Jul 2019 20:12:02 +0000
squeekboard (1.0.9) unstable; urgency=medium
* Initial release.

1
debian/triggers vendored
View File

@ -1 +0,0 @@
activate-noawait ldconfig

View File

@ -66,7 +66,7 @@ struct _EekKeyPrivate
EekSymbolMatrix *symbol_matrix;
gint column;
gint row;
gulong oref;
gulong oref; // UI outline reference
gboolean is_pressed;
gboolean is_locked;
};

View File

@ -199,32 +199,21 @@ void
_eek_rounded_polygon (cairo_t *cr,
gdouble radius,
EekPoint *points,
gint num_points)
guint num_points)
{
gint i, j;
cairo_move_to (cr,
(gdouble) (points[num_points - 1].x +
points[0].x) / 2,
(gdouble) (points[num_points - 1].y +
points[0].y) / 2);
#ifdef KBDRAW_DEBUG
printf (" rounded polygon of radius %f:\n", radius);
#endif
for (i = 0; i < num_points; i++) {
j = (i + 1) % num_points;
for (guint i = 0; i < num_points; i++) {
guint j = (i + 1) % num_points;
rounded_corner (cr, (gdouble) points[i].x,
(gdouble) points[i].y,
(gdouble) (points[i].x + points[j].x) / 2,
(gdouble) (points[i].y + points[j].y) / 2,
radius);
#ifdef KBDRAW_DEBUG
printf (" corner (%d, %d) -> (%d, %d):\n",
points[i].x, points[i].y, points[j].x,
points[j].y);
#endif
};
}
cairo_close_path (cr);
}

View File

@ -273,7 +273,7 @@ void eek_keyboard_press_key(EekKeyboard *keyboard, EekKey *key, guint32 timestam
// "Borrowed" from eek-context-service; doesn't influence the state but forwards the event
guint keycode = eek_key_get_keycode (key);
guint modifiers = eek_keyboard_get_modifiers (keyboard);
EekModifierType modifiers = eek_keyboard_get_modifiers (keyboard);
emit_key_activated(keyboard->manager, keyboard, keycode, symbol, modifiers, TRUE, timestamp);
}

View File

@ -48,6 +48,8 @@ typedef struct _EekKeyboardPrivate EekKeyboardPrivate;
*
* Contains the state of the physical keyboard.
*
* Is also a graphical element...
*
* The #EekKeyboard structure contains only private data and should
* only be accessed using the provided API.
*/

View File

@ -79,7 +79,7 @@ typedef struct _TextProperty TextProperty;
extern void _eek_rounded_polygon (cairo_t *cr,
gdouble radius,
EekPoint *points,
gint num_points);
guint num_points);
static void eek_renderer_real_render_key_label (EekRenderer *self,
PangoLayout *layout,
@ -116,8 +116,8 @@ create_keyboard_surface_key_callback (EekElement *element,
cairo_rectangle (data->cr,
0.0,
0.0,
bounds.width * priv->scale,
bounds.height * priv->scale);
bounds.width * priv->scale + 100,
bounds.height * priv->scale + 100);
cairo_clip (data->cr);
render_key (data->renderer, data->cr, EEK_KEY(element), FALSE);
@ -205,8 +205,6 @@ render_key_outline (EekRenderer *renderer,
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(renderer);
EekOutline *outline;
EekBounds bounds;
gdouble scale;
gint i;
guint oref;
EekThemeNode *theme_node;
EekColor foreground, background, gradient_start, gradient_end, border_color;
@ -233,14 +231,14 @@ render_key_outline (EekRenderer *renderer,
border_width = eek_theme_node_get_border_width (theme_node,
EEK_SIDE_TOP);
border_radius = eek_theme_node_get_border_radius (theme_node,
EEK_SIDE_TOP);
EEK_CORNER_TOPLEFT);
eek_theme_node_get_border_color (theme_node, EEK_SIDE_TOP,
&border_color);
} else {
foreground = priv->default_foreground_color;
background = priv->default_background_color;
gradient_type = EEK_GRADIENT_NONE;
border_width = priv->border_width;
border_width = (gint)round(priv->border_width);
border_radius = -1;
border_color.red = ABS(background.red - foreground.red) * 0.7;
border_color.green = ABS(background.green - foreground.green) * 0.7;
@ -248,21 +246,15 @@ render_key_outline (EekRenderer *renderer,
border_color.alpha = foreground.alpha;
}
/* need to rescale so that the border fit inside the clipping
region */
eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
scale = MIN((bounds.width - border_width * 2) / bounds.width,
(bounds.height - border_width * 2) / bounds.height);
outline = eek_outline_copy (outline);
for (i = 0; i < outline->num_points; i++) {
outline->points[i].x *= priv->scale * scale;
outline->points[i].y *= priv->scale * scale;
for (guint i = 0; i < outline->num_points; i++) {
outline->points[i].x *= priv->scale;
outline->points[i].y *= priv->scale;
}
cairo_translate (cr,
border_width * priv->scale * scale,
border_width * priv->scale * scale);
border_width * priv->scale,
border_width * priv->scale);
if (gradient_type != EEK_GRADIENT_NONE) {
cairo_pattern_t *pat;
@ -340,6 +332,10 @@ render_key_outline (EekRenderer *renderer,
outline->num_points);
cairo_stroke (cr);
cairo_translate (cr,
-border_width * priv->scale,
-border_width * priv->scale);
eek_outline_free (outline);
}
@ -464,10 +460,11 @@ render_key (EekRenderer *self,
if (!outline_surface) {
cairo_t *cr;
// Outline will be drawn on the outside of the button, so the surface needs to be bigger than the button
outline_surface =
cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
bounds.width,
bounds.height);
(int)ceil(bounds.width) + 10,
(int)ceil(bounds.height) + 10);
cr = cairo_create (outline_surface);
/* blank background */
@ -640,7 +637,7 @@ eek_renderer_real_render_key_label (EekRenderer *self,
size = calculate_font_size (self, base_font, FALSE);
priv->font = pango_font_description_copy (base_font);
pango_font_description_set_size (priv->font, size);
pango_font_description_set_size (priv->font, size * 0.6);
}
eek_element_get_bounds (EEK_ELEMENT(key), &bounds);

View File

@ -129,7 +129,7 @@ static EekKey *
eek_section_real_create_key (EekSection *self,
guint keycode,
gint column_index,
gint row_index)
guint row_index)
{
EekKey *key;
gint num_rows;
@ -479,3 +479,80 @@ eek_section_create_key (EekSection *section,
column,
row);
}
static void keysizer(EekElement *element, gpointer user_data) {
EekKey *key = EEK_KEY(element);
EekKeyboard *keyboard = EEK_KEYBOARD(user_data);
uint oref = eek_key_get_oref (key);
EekOutline *outline = eek_keyboard_get_outline (keyboard, oref);
if (outline && outline->num_points > 0) {
double minx = outline->points[0].x;
double maxx = minx;
double miny = outline->points[0].y;
double maxy = miny;
for (uint i = 1; i < outline->num_points; i++) {
EekPoint p = outline->points[i];
if (p.x < minx) {
minx = p.x;
} else if (p.x > maxx) {
maxx = p.x;
}
if (p.y < miny) {
miny = p.y;
} else if (p.y > maxy) {
maxy = p.y;
}
}
EekBounds key_bounds = {0};
eek_element_get_bounds(element, &key_bounds);
key_bounds.height = maxy - miny;
key_bounds.width = maxx - minx;
eek_element_set_bounds(element, &key_bounds);
}
}
struct keys_info {
uint count;
double total_width;
double biggest_height;
};
static void keycounter (EekElement *element, gpointer user_data) {
struct keys_info *data = user_data;
data->count++;
EekBounds key_bounds = {0};
eek_element_get_bounds(element, &key_bounds);
data->total_width += key_bounds.width;
if (key_bounds.height > data->biggest_height) {
data->biggest_height = key_bounds.height;
}
}
const double keyspacing = 3.0;
static void keyplacer(EekElement *element, gpointer user_data) {
double *current_offset = user_data;
EekBounds key_bounds = {0};
eek_element_get_bounds(element, &key_bounds);
key_bounds.x = *current_offset;
key_bounds.y = 0;
eek_element_set_bounds(element, &key_bounds);
*current_offset += key_bounds.width + keyspacing;
}
void eek_section_place_keys(EekSection *section, EekKeyboard *keyboard)
{
eek_container_foreach_child(EEK_CONTAINER(section), keysizer, keyboard);
struct keys_info keyinfo = {0};
eek_container_foreach_child(EEK_CONTAINER(section), keycounter, &keyinfo);
EekBounds section_bounds = {0};
eek_element_get_bounds(EEK_ELEMENT(section), &section_bounds);
double key_offset = (section_bounds.width - (keyinfo.total_width + (keyinfo.count - 1) * keyspacing)) / 2;
eek_container_foreach_child(EEK_CONTAINER(section), keyplacer, &key_offset);
section_bounds.height = keyinfo.biggest_height;
eek_element_set_bounds(EEK_ELEMENT(section), &section_bounds);
}

View File

@ -127,5 +127,7 @@ EekKey *eek_section_create_key (EekSection *section,
EekKey *eek_section_find_key_by_keycode (EekSection *section,
guint keycode);
void eek_section_place_keys (EekSection *section, EekKeyboard *keyboard);
G_END_DECLS
#endif /* EEK_SECTION_H */

View File

@ -214,7 +214,7 @@ struct _EekOutline
/*< public >*/
gdouble corner_radius;
EekPoint *points;
gint num_points;
guint num_points;
};
GType eek_outline_get_type (void) G_GNUC_CONST;

View File

@ -362,9 +362,6 @@ geometry_start_element_callback (GMarkupParseContext *pcontext,
eek_element_set_bounds (EEK_ELEMENT(data->keyboard), &bounds);
else if (g_strcmp0 (data->element_stack->data, "section") == 0)
eek_element_set_bounds (EEK_ELEMENT(data->section), &bounds);
else if (g_strcmp0 (data->element_stack->data, "key") == 0)
eek_element_set_bounds (EEK_ELEMENT(data->key), &bounds);
goto out;
}
@ -504,7 +501,6 @@ geometry_end_element_callback (GMarkupParseContext *pcontext,
{
GeometryParseData *data = user_data;
GSList *head = data->element_stack;
gint i;
g_free (head->data);
data->element_stack = g_slist_next (data->element_stack);
@ -536,7 +532,8 @@ geometry_end_element_callback (GMarkupParseContext *pcontext,
outline->num_points = g_slist_length (data->points);
outline->points = g_slice_alloc0 (sizeof (EekPoint) *
outline->num_points);
for (head = data->points = g_slist_reverse (data->points), i = 0;
guint i;
for (i = 0, head = data->points = g_slist_reverse (data->points);
head && i < outline->num_points;
head = g_slist_next (head), i++) {
memcpy (&outline->points[i], head->data, sizeof (EekPoint));
@ -640,13 +637,13 @@ symbols_start_element_callback (GMarkupParseContext *pcontext,
data->key = eek_keyboard_find_key_by_keycode (data->keyboard,
keycode);
if (data->key == NULL) {
/*if (data->key == NULL) {
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
"no such keycode %u", keycode);
return;
}
}*/
attribute = get_attribute (attribute_names, attribute_values,
"groups");
@ -721,6 +718,10 @@ symbols_end_element_callback (GMarkupParseContext *pcontext,
text = g_strndup (data->text->str, data->text->len);
if (g_strcmp0 (element_name, "key") == 0) {
if (!data->key) {
return;
}
gint num_symbols = g_slist_length (data->symbols);
gint levels = num_symbols / data->groups;
EekSymbolMatrix *matrix = eek_symbol_matrix_new (data->groups,
@ -1132,6 +1133,38 @@ eek_xml_keyboard_desc_free (EekXmlKeyboardDesc *desc)
g_slice_free (EekXmlKeyboardDesc, desc);
}
struct place_data {
double desired_width;
double current_offset;
EekKeyboard *keyboard;
};
const double section_spacing = 7.0;
static void section_placer(EekElement *element, gpointer user_data) {
struct place_data *data = (struct place_data*)user_data;
EekBounds section_bounds = {0};
eek_element_get_bounds(element, &section_bounds);
section_bounds.width = data->desired_width;
eek_element_set_bounds(element, &section_bounds);
// Sections are rows now. Gather up all the keys and adjust their bounds.
eek_section_place_keys(EEK_SECTION(element), EEK_KEYBOARD(data->keyboard));
eek_element_get_bounds(element, &section_bounds);
section_bounds.y = data->current_offset;
eek_element_set_bounds(element, &section_bounds);
data->current_offset += section_bounds.height + section_spacing;
}
static void section_counter(EekElement *element, gpointer user_data) {
double *total_height = user_data;
EekBounds section_bounds = {0};
eek_element_get_bounds(element, &section_bounds);
*total_height += section_bounds.height + section_spacing;
}
static gboolean
parse_geometry (const gchar *path, EekKeyboard *keyboard, GError **error)
{
@ -1184,6 +1217,27 @@ parse_geometry (const gchar *path, EekKeyboard *keyboard, GError **error)
}
g_hash_table_destroy (oref_hash);
/* Order rows */
// This needs to be done after outlines, because outlines define key sizes
// TODO: do this only for rows without bounds
// The keyboard width is given by the user via screen size. The height will be given dynamically.
// TODO: calculate max line width beforehand for button centering. Leave keyboard centering to the renderer later
EekBounds keyboard_bounds = {0};
eek_element_get_bounds(EEK_ELEMENT(keyboard), &keyboard_bounds);
struct place_data placer_data = {
.desired_width = keyboard_bounds.width,
.current_offset = 0,
.keyboard = keyboard,
};
eek_container_foreach_child(EEK_CONTAINER(keyboard), section_placer, &placer_data);
double total_height = 0;
eek_container_foreach_child(EEK_CONTAINER(keyboard), section_counter, &total_height);
keyboard_bounds.height = total_height;
eek_element_set_bounds(EEK_ELEMENT(keyboard), &keyboard_bounds);
geometry_parse_data_free (data);
return TRUE;
}

View File

@ -136,6 +136,9 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
}
}
keyboard = eek_keyboard_new (self, layout, CSW, CSH);
if (!keyboard) {
g_error("Failed to create a keyboard");
}
g_object_unref (layout);
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);

View File

@ -34,7 +34,8 @@ typedef struct {
struct xkb_keymap *keymap; // unowned copy
XkbDescRec *xkb;
guint modifier_keycodes[8];
gint group;
guint modifier_indices[MOD_IDX_LAST];
guint group;
} SeatEmitter;
@ -114,7 +115,7 @@ get_keycode_from_gdk_keymap (SeatEmitter *emitter,
return FALSE;
for (i = 0; i < n_keys; i++)
if (keys[i].group == emitter->group)
if ((guint)keys[i].group == emitter->group)
best_match = &keys[i];
if (!best_match) {
@ -140,25 +141,23 @@ int send_virtual_keyboard_key(
}
static void
send_fake_modifier_key_event (SeatEmitter *emitter,
send_fake_modifiers_events (SeatEmitter *emitter,
EekModifierType modifiers,
gboolean is_pressed,
uint32_t timestamp)
{
unsigned long i;
(void)timestamp;
for (i = 0; i < G_N_ELEMENTS(emitter->modifier_keycodes); i++) {
if (modifiers & (1 << i)) {
guint keycode = emitter->modifier_keycodes[i];
printf("Trying to send a modifier %ld press %d\n", i, is_pressed);
g_return_if_fail (keycode > 0);
send_virtual_keyboard_key (emitter->virtual_keyboard,
keycode,
is_pressed,
timestamp);
uint32_t proto_modifiers = 0;
if (modifiers & EEK_SHIFT_MASK) {
proto_modifiers |= 1<<MOD_IDX_SHIFT;
}
if (modifiers & EEK_CONTROL_MASK) {
proto_modifiers |= 1<<MOD_IDX_CTRL;
}
if (modifiers & EEK_MOD1_MASK) {
proto_modifiers |= 1<<MOD_IDX_ALT;
}
zwp_virtual_keyboard_v1_modifiers(emitter->virtual_keyboard, proto_modifiers, 0, 0, emitter->group);
}
static void
@ -190,19 +189,14 @@ send_fake_key_event (SeatEmitter *emitter,
keyboard_modifiers &= (unsigned)~EEK_SHIFT_MASK;
keyboard_modifiers &= (unsigned)~EEK_LOCK_MASK;
/* FIXME: may need to remap ISO_Level3_Shift and NumLock */
#if 0
keyboard_modifiers &= ~EEK_MOD5_MASK;
keyboard_modifiers &= ~client->alt_gr_mask;
keyboard_modifiers &= ~client->num_lock_mask;
#endif
modifiers |= keyboard_modifiers;
send_fake_modifier_key_event (emitter, modifiers, TRUE, timestamp);
send_fake_modifiers_events (emitter, modifiers, timestamp);
// There's something magical about subtracting/adding 8 to keycodes for some reason
send_virtual_keyboard_key (emitter->virtual_keyboard, keycode - 8, (unsigned)pressed, timestamp);
send_fake_modifier_key_event (emitter, modifiers, FALSE, timestamp);
send_fake_modifiers_events (emitter, modifiers, timestamp);
if (old_keysym != xkeysym)
replace_keycode (emitter, keycode, &old_keysym);
@ -211,7 +205,7 @@ send_fake_key_event (SeatEmitter *emitter,
static void
send_fake_key_events (SeatEmitter *emitter,
EekSymbol *symbol,
guint keyboard_modifiers,
EekModifierType keyboard_modifiers,
gboolean pressed,
uint32_t timestamp)
{
@ -253,12 +247,48 @@ send_fake_key_events (SeatEmitter *emitter,
}
}
/* Finds the first key code for each modifier and saves it in modifier_keycodes */
static void
update_modifier_info (SeatEmitter *client)
{
client->modifier_indices[MOD_IDX_SHIFT] = xkb_keymap_mod_get_index(client->keymap, XKB_MOD_NAME_SHIFT);
client->modifier_indices[MOD_IDX_CAPS] = xkb_keymap_mod_get_index(client->keymap, XKB_MOD_NAME_CAPS);
client->modifier_indices[MOD_IDX_CTRL] = xkb_keymap_mod_get_index(client->keymap, XKB_MOD_NAME_CTRL);
client->modifier_indices[MOD_IDX_ALT] = xkb_keymap_mod_get_index(client->keymap, XKB_MOD_NAME_ALT);
client->modifier_indices[MOD_IDX_NUM] = xkb_keymap_mod_get_index(client->keymap, XKB_MOD_NAME_NUM);
client->modifier_indices[MOD_IDX_MOD3] = xkb_keymap_mod_get_index(client->keymap, "Mod3");
client->modifier_indices[MOD_IDX_LOGO] = xkb_keymap_mod_get_index(client->keymap, XKB_MOD_NAME_LOGO);
client->modifier_indices[MOD_IDX_ALTGR] = xkb_keymap_mod_get_index(client->keymap, "Mod5");
client->modifier_indices[MOD_IDX_NUMLK] = xkb_keymap_mod_get_index(client->keymap, "NumLock");
client->modifier_indices[MOD_IDX_ALSO_ALT] = xkb_keymap_mod_get_index(client->keymap, "Alt");
client->modifier_indices[MOD_IDX_LVL3] = xkb_keymap_mod_get_index(client->keymap, "LevelThree");
client->modifier_indices[MOD_IDX_LALT] = xkb_keymap_mod_get_index(client->keymap, "LAlt");
client->modifier_indices[MOD_IDX_RALT] = xkb_keymap_mod_get_index(client->keymap, "RAlt");
client->modifier_indices[MOD_IDX_RCONTROL] = xkb_keymap_mod_get_index(client->keymap, "RControl");
client->modifier_indices[MOD_IDX_LCONTROL] = xkb_keymap_mod_get_index(client->keymap, "LControl");
client->modifier_indices[MOD_IDX_SCROLLLK] = xkb_keymap_mod_get_index(client->keymap, "ScrollLock");
client->modifier_indices[MOD_IDX_LVL5] = xkb_keymap_mod_get_index(client->keymap, "LevelFive");
client->modifier_indices[MOD_IDX_ALSO_ALTGR] = xkb_keymap_mod_get_index(client->keymap, "AltGr");
client->modifier_indices[MOD_IDX_META] = xkb_keymap_mod_get_index(client->keymap, "Meta");
client->modifier_indices[MOD_IDX_SUPER] = xkb_keymap_mod_get_index(client->keymap, "Super");
client->modifier_indices[MOD_IDX_HYPER] = xkb_keymap_mod_get_index(client->keymap, "Hyper");
/*
for (xkb_mod_index_t i = 0;
i < xkb_keymap_num_mods(client->keymap);
i++) {
g_log("squeek", G_LOG_LEVEL_DEBUG, "%s", xkb_keymap_mod_get_name(client->keymap, i));
}*/
}
void
emit_key_activated (EekboardContextService *manager,
EekKeyboard *keyboard,
guint keycode,
EekSymbol *symbol,
guint modifiers,
EekModifierType modifiers,
gboolean pressed,
uint32_t timestamp)
{
@ -292,72 +322,6 @@ emit_key_activated (EekboardContextService *manager,
SeatEmitter emitter = {0};
emitter.virtual_keyboard = manager->virtual_keyboard;
emitter.keymap = keyboard->keymap;
update_modifier_info (&emitter);
send_fake_key_events (&emitter, symbol, modifiers, pressed, timestamp);
}
/* Finds the first key code for each modifier and saves it in modifier_keycodes */
static void
update_modifier_keycodes (SeatEmitter *client)
{
GdkDisplay *display = gdk_display_get_default ();
Display *xdisplay = NULL; // GDK_DISPLAY_XDISPLAY (display);
return; // FIXME: need to get those codes somehow
XModifierKeymap *mods;
gint i, j;
//mods = XGetModifierMapping (xdisplay);
for (i = 0; i < 8; i++) {
client->modifier_keycodes[i] = 0;
for (j = 0; j < mods->max_keypermod; j++) {
KeyCode keycode = mods->modifiermap[mods->max_keypermod * i + j];
if (keycode != 0) {
client->modifier_keycodes[i] = keycode;
break;
}
}
}
//XFreeModifiermap (mods);
}
gboolean
client_enable_xtest (SeatEmitter *client)
{
//GdkDisplay *display = gdk_display_get_default ();
//Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
int opcode, event_base, error_base, major_version, minor_version;
/* FIXME: need at least to fetch an xkb keymap (but what for?)
g_assert (display);
if (!XTestQueryExtension (xdisplay,
&event_base, &error_base,
&major_version, &minor_version)) {
g_warning ("XTest extension is not available");
return FALSE;
}
if (!XkbQueryExtension (xdisplay,
&opcode, &event_base, &error_base,
&major_version, &minor_version)) {
g_warning ("Xkb extension is not available");
return FALSE;
}
if (!client->xkb)
client->xkb = XkbGetMap (xdisplay, XkbKeySymsMask, XkbUseCoreKbd);
g_assert (client->xkb);
*/
update_modifier_keycodes (client);
return TRUE;
}
void
client_disable_xtest (SeatEmitter *client)
{
//if (client->xkb) {
// XkbFreeKeyboard (client->xkb, 0, TRUE); /* free_all = TRUE */
//client->xkb = NULL;
//}
}
//#endif /* HAVE_XTEST */

View File

@ -9,6 +9,36 @@
#include "virtual-keyboard-unstable-v1-client-protocol.h"
/// Indices obtained by xkb_keymap_mod_get_name
enum mod_indices {
MOD_IDX_SHIFT,
MOD_IDX_CAPS,
MOD_IDX_CTRL,
MOD_IDX_ALT,
MOD_IDX_NUM,
MOD_IDX_MOD3,
MOD_IDX_LOGO,
MOD_IDX_ALTGR,
MOD_IDX_NUMLK, // Caution, not sure which is the right one
MOD_IDX_ALSO_ALT, // Not sure why, alt emits the first alt on my setup
MOD_IDX_LVL3,
// Not sure if the next 4 are used at all
MOD_IDX_LALT,
MOD_IDX_RALT,
MOD_IDX_RCONTROL,
MOD_IDX_LCONTROL,
MOD_IDX_SCROLLLK,
MOD_IDX_LVL5,
MOD_IDX_ALSO_ALTGR, // Not used on my layout
MOD_IDX_META,
MOD_IDX_SUPER,
MOD_IDX_HYPER,
MOD_IDX_LAST,
};
void
emit_key_activated (EekboardContextService *manager, EekKeyboard *keyboard,
guint keycode,

View File

@ -1,7 +1,7 @@
project(
'squeekboard',
'c', 'rust',
version: '1.0.9',
version: '1.0.10',
license: 'GPLv3',
meson_version: '>=0.43.0',
default_options: [ 'warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11' ],
@ -19,7 +19,12 @@ endif
prefix = get_option('prefix')
datadir = join_paths(prefix, get_option('datadir'))
pkgdatadir = join_paths(datadir, meson.project_name())
dbusdir = join_paths(datadir, 'dbus-1/interfaces')
if get_option('depdatadir') == ''
depdatadir = datadir
else
depdatadir = get_option('depdatadir')
endif
dbusdir = join_paths(depdatadir, 'dbus-1/interfaces')
subdir('data')
subdir('protocols')

1
meson_options.txt Normal file
View File

@ -0,0 +1 @@
option('depdatadir', type : 'string', value : '', description : 'System data path. Will be searched for definitions instead of datadir when provided')

View File

@ -1,7 +1,7 @@
gnome = import('gnome')
dbus_src = gnome.gdbus_codegen(
'sm.puri.OSK0',
'../data/dbus/sm.puri.OSK0.xml'
join_paths(meson.source_root() / 'data' / 'dbus', 'sm.puri.OSK0.xml')
)
sources = [
@ -56,14 +56,16 @@ deps = [
dependency('xkbcommon'),
cc.find_library('m'),
cc.find_library('rt'),
cc.find_library('dl'),
cc.find_library('pthread'),
# dependency('libxklavier'), # FIXME remove
]
# Replacement for eekboard-server
rslib = library(
rslib = static_library(
'rslib',
sources: ['imservice.rs'],
install: true
rust_crate_type: 'staticlib'
)
squeekboard = executable('squeekboard',