Merge branch 'new_layout' into 'squeekboard'
New layout See merge request Librem5/squeekboard!13
This commit is contained in:
@ -1,102 +1,11 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<geometry version="0.90">
|
<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">
|
<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">
|
<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">
|
<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>
|
||||||
<key keycode="25" name="AD02" oref="outline2">
|
<key keycode="25" name="AD02" oref="outline2">
|
||||||
<bounds x="106.1463" y="42.14634" width="37.46341" height="37.46341"/>
|
<bounds x="106.1463" y="42.14634" width="37.46341" height="37.46341"/>
|
||||||
@ -125,20 +34,11 @@
|
|||||||
<key keycode="33" name="AD10" oref="outline2">
|
<key keycode="33" name="AD10" oref="outline2">
|
||||||
<bounds x="429.2682" y="42.14634" width="37.46341" height="37.46341"/>
|
<bounds x="429.2682" y="42.14634" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</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>
|
</row>
|
||||||
|
</section>
|
||||||
|
<section angle="0">
|
||||||
|
<bounds x="0" y="0" width="608.7804" height="201.3658"/>
|
||||||
<row orientation="1">
|
<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">
|
<key keycode="38" name="AC01" oref="outline2">
|
||||||
<bounds x="76.48780" y="82.73170" width="37.46341" height="37.46341"/>
|
<bounds x="76.48780" y="82.73170" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
@ -166,18 +66,12 @@
|
|||||||
<key keycode="46" name="AC09" oref="outline2">
|
<key keycode="46" name="AC09" oref="outline2">
|
||||||
<bounds x="399.6097" y="82.73170" width="37.46341" height="37.46341"/>
|
<bounds x="399.6097" y="82.73170" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</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>
|
</row>
|
||||||
|
</section>
|
||||||
|
<section angle="0">
|
||||||
|
<bounds x="0" y="0" width="608.7804" height="201.3658"/>
|
||||||
<row orientation="1">
|
<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"/>
|
<bounds x="3.121951" y="121.7560" width="88.97561" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="52" name="AB01" oref="outline2">
|
<key keycode="52" name="AB01" oref="outline2">
|
||||||
@ -201,113 +95,95 @@
|
|||||||
<key keycode="58" name="AB07" oref="outline2">
|
<key keycode="58" name="AB07" oref="outline2">
|
||||||
<bounds x="337.1707" y="121.7560" width="37.46341" height="37.46341"/>
|
<bounds x="337.1707" y="121.7560" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="59" name="AB08" oref="outline2">
|
<key keycode="22" name="BKSP" oref="altline">
|
||||||
<bounds x="377.7560" y="121.7560" width="37.46341" height="37.46341"/>
|
<bounds x="529.1707" y="1.560976" width="79.60975" 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>
|
</key>
|
||||||
</row>
|
</row>
|
||||||
|
</section>
|
||||||
|
<section angle="0">
|
||||||
|
<bounds x="0" y="0" width="608.7804" height="201.3658"/>
|
||||||
<row orientation="1">
|
<row orientation="1">
|
||||||
<key keycode="149" name="I149" oref="outline10">
|
<key keycode="37" name="LCTL" oref="altline">
|
||||||
<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"/>
|
<bounds x="62.43902" y="162.3414" width="48.39024" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="64" name="LALT" oref="outline1">
|
<key keycode="64" name="LALT" oref="altline">
|
||||||
<bounds x="113.9512" y="162.3414" width="48.39024" height="37.46341"/>
|
<bounds x="113.9512" y="162.3414" width="48.39024" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="65" name="SPCE" oref="outline3">
|
<key keycode="65" name="SPCE" oref="spaceline">
|
||||||
<bounds x="165.4634" y="162.3414" width="217.5853" height="37.46341"/>
|
<bounds x="165.4634" y="162.3414" width="217.5853" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="113" name="LEFT" oref="outline1">
|
<key keycode="60" name="AB09" oref="outline2">
|
||||||
<bounds x="368.0487" y="162.3414" width="48.39024" height="37.46341"/>
|
<bounds x="418.3414" y="121.7560" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="111" name="UP" oref="outline1">
|
<key keycode="36" name="RTRN" oref="outline7">
|
||||||
<bounds x="419.43894" y="162.3414" width="48.39024" height="37.46341"/>
|
<bounds x="519.8048" y="82.73170" width="88.97561" 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>
|
</key>
|
||||||
</row>
|
</row>
|
||||||
</section>
|
</section>
|
||||||
<outline id="outline2" corner-radius="1.000000">
|
<outline id="outline2" corner-radius="1.000000">
|
||||||
<point x="0.000000" y="0.000000"/>
|
<point x="0.000000" y="0.000000"/>
|
||||||
<point x="37.46341" y="0.000000"/>
|
<point x="37.46341" y="0.000000"/>
|
||||||
<point x="37.46341" y="37.46341"/>
|
<point x="37.46341" y="52.44877"/>
|
||||||
<point x="0.000000" y="37.46341"/>
|
<point x="0.000000" y="52.44877"/>
|
||||||
</outline>
|
</outline>
|
||||||
<outline id="outline1" corner-radius="1.000000">
|
<outline id="altline" corner-radius="1.000000">
|
||||||
<point x="0.000000" y="0.000000"/>
|
<point x="0.000000" y="0.000000"/>
|
||||||
<point x="48.39024" y="0.000000"/>
|
<point x="48.39024" y="0.000000"/>
|
||||||
<point x="48.39024" y="37.46341"/>
|
<point x="48.39024" y="52.44877"/>
|
||||||
<point x="0.000000" y="37.46341"/>
|
<point x="0.000000" y="52.44877"/>
|
||||||
</outline>
|
</outline>
|
||||||
<outline id="outline4" corner-radius="1.000000">
|
<outline id="outline4" corner-radius="1.000000">
|
||||||
<point x="0.000000" y="0.000000"/>
|
<point x="0.000000" y="0.000000"/>
|
||||||
<point x="59.31707" y="0.000000"/>
|
<point x="59.31707" y="0.000000"/>
|
||||||
<point x="59.31707" y="37.46341"/>
|
<point x="59.31707" y="52.44877"/>
|
||||||
<point x="0.000000" y="37.46341"/>
|
<point x="0.000000" y="52.44877"/>
|
||||||
</outline>
|
</outline>
|
||||||
<outline id="outline5" corner-radius="1.000000">
|
<outline id="outline5" corner-radius="1.000000">
|
||||||
<point x="0.000000" y="0.000000"/>
|
<point x="0.000000" y="0.000000"/>
|
||||||
<point x="59.31707" y="0.000000"/>
|
<point x="59.31707" y="0.000000"/>
|
||||||
<point x="59.31707" y="37.46341"/>
|
<point x="59.31707" y="52.44877"/>
|
||||||
<point x="0.000000" y="37.46341"/>
|
<point x="0.000000" y="52.44877"/>
|
||||||
</outline>
|
</outline>
|
||||||
<outline id="outline6" corner-radius="1.000000">
|
<outline id="outline6" corner-radius="1.000000">
|
||||||
<point x="0.000000" y="0.000000"/>
|
<point x="0.000000" y="0.000000"/>
|
||||||
<point x="68.68292" y="0.000000"/>
|
<point x="68.68292" y="0.000000"/>
|
||||||
<point x="68.68292" y="37.46341"/>
|
<point x="68.68292" y="52.44877"/>
|
||||||
<point x="0.000000" y="37.46341"/>
|
<point x="0.000000" y="52.44877"/>
|
||||||
</outline>
|
</outline>
|
||||||
<outline id="outline7" corner-radius="1.000000">
|
<outline id="outline7" corner-radius="1.000000">
|
||||||
<point x="0.000000" y="0.000000"/>
|
<point x="0.000000" y="0.000000"/>
|
||||||
<point x="88.97561" y="0.000000"/>
|
<point x="88.97561" y="0.000000"/>
|
||||||
<point x="88.97561" y="37.46341"/>
|
<point x="88.97561" y="52.44877"/>
|
||||||
<point x="0.000000" y="37.46341"/>
|
<point x="0.000000" y="52.44877"/>
|
||||||
</outline>
|
</outline>
|
||||||
<outline id="outline8" corner-radius="1.000000">
|
<outline id="outline8" corner-radius="1.000000">
|
||||||
<point x="0.000000" y="0.000000"/>
|
<point x="0.000000" y="0.000000"/>
|
||||||
<point x="88.97561" y="0.000000"/>
|
<point x="88.97561" y="0.000000"/>
|
||||||
<point x="88.97561" y="37.46341"/>
|
<point x="88.97561" y="52.44877"/>
|
||||||
<point x="0.000000" y="37.46341"/>
|
<point x="0.000000" y="52.44877"/>
|
||||||
</outline>
|
</outline>
|
||||||
<outline id="outline9" corner-radius="1.000000">
|
<outline id="outline9" corner-radius="1.000000">
|
||||||
<point x="0.000000" y="0.000000"/>
|
<point x="0.000000" y="0.000000"/>
|
||||||
<point x="109.2682" y="0.000000"/>
|
<point x="109.2682" y="0.000000"/>
|
||||||
<point x="109.2682" y="37.46341"/>
|
<point x="109.2682" y="52.44877"/>
|
||||||
<point x="0.000000" y="37.46341"/>
|
<point x="0.000000" y="52.44877"/>
|
||||||
</outline>
|
</outline>
|
||||||
<outline id="outline10" corner-radius="1.000000">
|
<outline id="outline10" corner-radius="1.000000">
|
||||||
<point x="0.000000" y="0.000000"/>
|
<point x="0.000000" y="0.000000"/>
|
||||||
<point x="37.46341" y="0.000000"/>
|
<point x="37.46341" y="0.000000"/>
|
||||||
<point x="37.46341" y="37.46341"/>
|
<point x="37.46341" y="52.44877"/>
|
||||||
<point x="0.000000" y="37.46341"/>
|
<point x="0.000000" y="52.44877"/>
|
||||||
</outline>
|
</outline>
|
||||||
<outline id="outline13" corner-radius="1.000000">
|
<outline id="outline13" corner-radius="1.000000">
|
||||||
<point x="0.000000" y="0.000000"/>
|
<point x="0.000000" y="0.000000"/>
|
||||||
<point x="79.60975" y="0.000000"/>
|
<point x="79.60975" y="0.000000"/>
|
||||||
<point x="79.60975" y="37.46341"/>
|
<point x="79.60975" y="52.44877"/>
|
||||||
<point x="0.000000" y="37.46341"/>
|
<point x="0.000000" y="52.44877"/>
|
||||||
</outline>
|
</outline>
|
||||||
<outline id="outline3" corner-radius="1.000000">
|
<outline id="spaceline" corner-radius="1.000000">
|
||||||
<point x="0.000000" y="0.000000"/>
|
<point x="0.000000" y="0.000000"/>
|
||||||
<point x="217.5853" y="0.000000"/>
|
<point x="150.5853" y="0.000000"/>
|
||||||
<point x="217.5853" y="37.46341"/>
|
<point x="150.5853" y="52.44877"/>
|
||||||
<point x="0.000000" y="37.46341"/>
|
<point x="0.000000" y="52.44877"/>
|
||||||
</outline>
|
</outline>
|
||||||
</geometry>
|
</geometry>
|
||||||
|
|||||||
@ -5,18 +5,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.key {
|
.key {
|
||||||
color: #ffffff;
|
color: #deddda;
|
||||||
background-gradient-direction: vertical;
|
background: #464448;
|
||||||
background-gradient-start: rgba(0, 0, 0, 255);
|
border-width: 0.5px;
|
||||||
background-gradient-end: rgba(64, 64, 64, 255);
|
border-color: #5e5c64;
|
||||||
border-width: 2px;
|
border-radius: 2px;
|
||||||
border-color: rgba(128, 128, 128, 255);
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.key:active {
|
.key:active {
|
||||||
background-gradient-direction: vertical;
|
background: #1c71d8;
|
||||||
background-gradient-start: rgba(0, 0, 255, 255);
|
border-color: #3584e4;
|
||||||
background-gradient-end: rgba(64, 64, 255, 255);
|
|
||||||
border-color: rgba(160, 160, 255, 255);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,7 +66,7 @@ struct _EekKeyPrivate
|
|||||||
EekSymbolMatrix *symbol_matrix;
|
EekSymbolMatrix *symbol_matrix;
|
||||||
gint column;
|
gint column;
|
||||||
gint row;
|
gint row;
|
||||||
gulong oref;
|
gulong oref; // UI outline reference
|
||||||
gboolean is_pressed;
|
gboolean is_pressed;
|
||||||
gboolean is_locked;
|
gboolean is_locked;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -199,32 +199,21 @@ void
|
|||||||
_eek_rounded_polygon (cairo_t *cr,
|
_eek_rounded_polygon (cairo_t *cr,
|
||||||
gdouble radius,
|
gdouble radius,
|
||||||
EekPoint *points,
|
EekPoint *points,
|
||||||
gint num_points)
|
guint num_points)
|
||||||
{
|
{
|
||||||
gint i, j;
|
|
||||||
|
|
||||||
cairo_move_to (cr,
|
cairo_move_to (cr,
|
||||||
(gdouble) (points[num_points - 1].x +
|
(gdouble) (points[num_points - 1].x +
|
||||||
points[0].x) / 2,
|
points[0].x) / 2,
|
||||||
(gdouble) (points[num_points - 1].y +
|
(gdouble) (points[num_points - 1].y +
|
||||||
points[0].y) / 2);
|
points[0].y) / 2);
|
||||||
|
|
||||||
|
for (guint i = 0; i < num_points; i++) {
|
||||||
#ifdef KBDRAW_DEBUG
|
guint j = (i + 1) % num_points;
|
||||||
printf (" rounded polygon of radius %f:\n", radius);
|
|
||||||
#endif
|
|
||||||
for (i = 0; i < num_points; i++) {
|
|
||||||
j = (i + 1) % num_points;
|
|
||||||
rounded_corner (cr, (gdouble) points[i].x,
|
rounded_corner (cr, (gdouble) points[i].x,
|
||||||
(gdouble) points[i].y,
|
(gdouble) points[i].y,
|
||||||
(gdouble) (points[i].x + points[j].x) / 2,
|
(gdouble) (points[i].x + points[j].x) / 2,
|
||||||
(gdouble) (points[i].y + points[j].y) / 2,
|
(gdouble) (points[i].y + points[j].y) / 2,
|
||||||
radius);
|
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);
|
cairo_close_path (cr);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,6 +48,8 @@ typedef struct _EekKeyboardPrivate EekKeyboardPrivate;
|
|||||||
*
|
*
|
||||||
* Contains the state of the physical keyboard.
|
* Contains the state of the physical keyboard.
|
||||||
*
|
*
|
||||||
|
* Is also a graphical element...
|
||||||
|
*
|
||||||
* The #EekKeyboard structure contains only private data and should
|
* The #EekKeyboard structure contains only private data and should
|
||||||
* only be accessed using the provided API.
|
* only be accessed using the provided API.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -79,7 +79,7 @@ typedef struct _TextProperty TextProperty;
|
|||||||
extern void _eek_rounded_polygon (cairo_t *cr,
|
extern void _eek_rounded_polygon (cairo_t *cr,
|
||||||
gdouble radius,
|
gdouble radius,
|
||||||
EekPoint *points,
|
EekPoint *points,
|
||||||
gint num_points);
|
guint num_points);
|
||||||
|
|
||||||
static void eek_renderer_real_render_key_label (EekRenderer *self,
|
static void eek_renderer_real_render_key_label (EekRenderer *self,
|
||||||
PangoLayout *layout,
|
PangoLayout *layout,
|
||||||
@ -116,8 +116,8 @@ create_keyboard_surface_key_callback (EekElement *element,
|
|||||||
cairo_rectangle (data->cr,
|
cairo_rectangle (data->cr,
|
||||||
0.0,
|
0.0,
|
||||||
0.0,
|
0.0,
|
||||||
bounds.width * priv->scale,
|
bounds.width * priv->scale + 100,
|
||||||
bounds.height * priv->scale);
|
bounds.height * priv->scale + 100);
|
||||||
cairo_clip (data->cr);
|
cairo_clip (data->cr);
|
||||||
render_key (data->renderer, data->cr, EEK_KEY(element), FALSE);
|
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);
|
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(renderer);
|
||||||
EekOutline *outline;
|
EekOutline *outline;
|
||||||
EekBounds bounds;
|
EekBounds bounds;
|
||||||
gdouble scale;
|
|
||||||
gint i;
|
|
||||||
guint oref;
|
guint oref;
|
||||||
EekThemeNode *theme_node;
|
EekThemeNode *theme_node;
|
||||||
EekColor foreground, background, gradient_start, gradient_end, border_color;
|
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,
|
border_width = eek_theme_node_get_border_width (theme_node,
|
||||||
EEK_SIDE_TOP);
|
EEK_SIDE_TOP);
|
||||||
border_radius = eek_theme_node_get_border_radius (theme_node,
|
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,
|
eek_theme_node_get_border_color (theme_node, EEK_SIDE_TOP,
|
||||||
&border_color);
|
&border_color);
|
||||||
} else {
|
} else {
|
||||||
foreground = priv->default_foreground_color;
|
foreground = priv->default_foreground_color;
|
||||||
background = priv->default_background_color;
|
background = priv->default_background_color;
|
||||||
gradient_type = EEK_GRADIENT_NONE;
|
gradient_type = EEK_GRADIENT_NONE;
|
||||||
border_width = priv->border_width;
|
border_width = (gint)round(priv->border_width);
|
||||||
border_radius = -1;
|
border_radius = -1;
|
||||||
border_color.red = ABS(background.red - foreground.red) * 0.7;
|
border_color.red = ABS(background.red - foreground.red) * 0.7;
|
||||||
border_color.green = ABS(background.green - foreground.green) * 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;
|
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);
|
outline = eek_outline_copy (outline);
|
||||||
for (i = 0; i < outline->num_points; i++) {
|
for (guint i = 0; i < outline->num_points; i++) {
|
||||||
outline->points[i].x *= priv->scale * scale;
|
outline->points[i].x *= priv->scale;
|
||||||
outline->points[i].y *= priv->scale * scale;
|
outline->points[i].y *= priv->scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_translate (cr,
|
cairo_translate (cr,
|
||||||
border_width * priv->scale * scale,
|
border_width * priv->scale,
|
||||||
border_width * priv->scale * scale);
|
border_width * priv->scale);
|
||||||
|
|
||||||
if (gradient_type != EEK_GRADIENT_NONE) {
|
if (gradient_type != EEK_GRADIENT_NONE) {
|
||||||
cairo_pattern_t *pat;
|
cairo_pattern_t *pat;
|
||||||
@ -340,6 +332,10 @@ render_key_outline (EekRenderer *renderer,
|
|||||||
outline->num_points);
|
outline->num_points);
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
|
|
||||||
|
cairo_translate (cr,
|
||||||
|
-border_width * priv->scale,
|
||||||
|
-border_width * priv->scale);
|
||||||
|
|
||||||
eek_outline_free (outline);
|
eek_outline_free (outline);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,10 +460,11 @@ render_key (EekRenderer *self,
|
|||||||
if (!outline_surface) {
|
if (!outline_surface) {
|
||||||
cairo_t *cr;
|
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 =
|
outline_surface =
|
||||||
cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||||
bounds.width,
|
(int)ceil(bounds.width) + 10,
|
||||||
bounds.height);
|
(int)ceil(bounds.height) + 10);
|
||||||
cr = cairo_create (outline_surface);
|
cr = cairo_create (outline_surface);
|
||||||
|
|
||||||
/* blank background */
|
/* blank background */
|
||||||
|
|||||||
@ -129,7 +129,7 @@ static EekKey *
|
|||||||
eek_section_real_create_key (EekSection *self,
|
eek_section_real_create_key (EekSection *self,
|
||||||
guint keycode,
|
guint keycode,
|
||||||
gint column_index,
|
gint column_index,
|
||||||
gint row_index)
|
guint row_index)
|
||||||
{
|
{
|
||||||
EekKey *key;
|
EekKey *key;
|
||||||
gint num_rows;
|
gint num_rows;
|
||||||
@ -479,3 +479,80 @@ eek_section_create_key (EekSection *section,
|
|||||||
column,
|
column,
|
||||||
row);
|
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), §ion_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), §ion_bounds);
|
||||||
|
}
|
||||||
|
|||||||
@ -127,5 +127,7 @@ EekKey *eek_section_create_key (EekSection *section,
|
|||||||
EekKey *eek_section_find_key_by_keycode (EekSection *section,
|
EekKey *eek_section_find_key_by_keycode (EekSection *section,
|
||||||
guint keycode);
|
guint keycode);
|
||||||
|
|
||||||
|
void eek_section_place_keys (EekSection *section, EekKeyboard *keyboard);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
#endif /* EEK_SECTION_H */
|
#endif /* EEK_SECTION_H */
|
||||||
|
|||||||
@ -214,7 +214,7 @@ struct _EekOutline
|
|||||||
/*< public >*/
|
/*< public >*/
|
||||||
gdouble corner_radius;
|
gdouble corner_radius;
|
||||||
EekPoint *points;
|
EekPoint *points;
|
||||||
gint num_points;
|
guint num_points;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType eek_outline_get_type (void) G_GNUC_CONST;
|
GType eek_outline_get_type (void) G_GNUC_CONST;
|
||||||
|
|||||||
@ -362,9 +362,6 @@ geometry_start_element_callback (GMarkupParseContext *pcontext,
|
|||||||
eek_element_set_bounds (EEK_ELEMENT(data->keyboard), &bounds);
|
eek_element_set_bounds (EEK_ELEMENT(data->keyboard), &bounds);
|
||||||
else if (g_strcmp0 (data->element_stack->data, "section") == 0)
|
else if (g_strcmp0 (data->element_stack->data, "section") == 0)
|
||||||
eek_element_set_bounds (EEK_ELEMENT(data->section), &bounds);
|
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;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,7 +501,6 @@ geometry_end_element_callback (GMarkupParseContext *pcontext,
|
|||||||
{
|
{
|
||||||
GeometryParseData *data = user_data;
|
GeometryParseData *data = user_data;
|
||||||
GSList *head = data->element_stack;
|
GSList *head = data->element_stack;
|
||||||
gint i;
|
|
||||||
|
|
||||||
g_free (head->data);
|
g_free (head->data);
|
||||||
data->element_stack = g_slist_next (data->element_stack);
|
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->num_points = g_slist_length (data->points);
|
||||||
outline->points = g_slice_alloc0 (sizeof (EekPoint) *
|
outline->points = g_slice_alloc0 (sizeof (EekPoint) *
|
||||||
outline->num_points);
|
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 && i < outline->num_points;
|
||||||
head = g_slist_next (head), i++) {
|
head = g_slist_next (head), i++) {
|
||||||
memcpy (&outline->points[i], head->data, sizeof (EekPoint));
|
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,
|
data->key = eek_keyboard_find_key_by_keycode (data->keyboard,
|
||||||
keycode);
|
keycode);
|
||||||
if (data->key == NULL) {
|
/*if (data->key == NULL) {
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_MARKUP_ERROR,
|
G_MARKUP_ERROR,
|
||||||
G_MARKUP_ERROR_INVALID_CONTENT,
|
G_MARKUP_ERROR_INVALID_CONTENT,
|
||||||
"no such keycode %u", keycode);
|
"no such keycode %u", keycode);
|
||||||
return;
|
return;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
attribute = get_attribute (attribute_names, attribute_values,
|
attribute = get_attribute (attribute_names, attribute_values,
|
||||||
"groups");
|
"groups");
|
||||||
@ -721,6 +718,10 @@ symbols_end_element_callback (GMarkupParseContext *pcontext,
|
|||||||
text = g_strndup (data->text->str, data->text->len);
|
text = g_strndup (data->text->str, data->text->len);
|
||||||
|
|
||||||
if (g_strcmp0 (element_name, "key") == 0) {
|
if (g_strcmp0 (element_name, "key") == 0) {
|
||||||
|
if (!data->key) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gint num_symbols = g_slist_length (data->symbols);
|
gint num_symbols = g_slist_length (data->symbols);
|
||||||
gint levels = num_symbols / data->groups;
|
gint levels = num_symbols / data->groups;
|
||||||
EekSymbolMatrix *matrix = eek_symbol_matrix_new (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);
|
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, §ion_bounds);
|
||||||
|
section_bounds.width = data->desired_width;
|
||||||
|
eek_element_set_bounds(element, §ion_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, §ion_bounds);
|
||||||
|
section_bounds.y = data->current_offset;
|
||||||
|
eek_element_set_bounds(element, §ion_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, §ion_bounds);
|
||||||
|
*total_height += section_bounds.height + section_spacing;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
parse_geometry (const gchar *path, EekKeyboard *keyboard, GError **error)
|
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);
|
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);
|
geometry_parse_data_free (data);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -136,6 +136,9 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyboard = eek_keyboard_new (self, layout, CSW, CSH);
|
keyboard = eek_keyboard_new (self, layout, CSW, CSH);
|
||||||
|
if (!keyboard) {
|
||||||
|
g_error("Failed to create a keyboard");
|
||||||
|
}
|
||||||
g_object_unref (layout);
|
g_object_unref (layout);
|
||||||
|
|
||||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
|
|||||||
Reference in New Issue
Block a user