Compare commits
2 Commits
pureos/1.9
...
removeX11
| Author | SHA1 | Date | |
|---|---|---|---|
| 5230171d47 | |||
| 436740b64a |
@ -25,20 +25,16 @@ dist_vapi_DATA = \
|
|||||||
eek-$(EEK_API_VERSION).deps \
|
eek-$(EEK_API_VERSION).deps \
|
||||||
eek-gtk-$(EEK_API_VERSION).vapi \
|
eek-gtk-$(EEK_API_VERSION).vapi \
|
||||||
eek-gtk-$(EEK_API_VERSION).deps \
|
eek-gtk-$(EEK_API_VERSION).deps \
|
||||||
eek-xkl-$(EEK_API_VERSION).vapi \
|
|
||||||
eek-xkl-$(EEK_API_VERSION).deps \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
Eek-$(EEK_API_VERSION).metadata \
|
Eek-$(EEK_API_VERSION).metadata \
|
||||||
EekGtk-$(EEK_API_VERSION).metadata \
|
EekGtk-$(EEK_API_VERSION).metadata \
|
||||||
EekXkl-$(EEK_API_VERSION).metadata \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
GITIGNOREFILES = \
|
GITIGNOREFILES = \
|
||||||
eek-$(EEK_API_VERSION).vapi \
|
eek-$(EEK_API_VERSION).vapi \
|
||||||
eek-gtk-$(EEK_API_VERSION).vapi \
|
eek-gtk-$(EEK_API_VERSION).vapi \
|
||||||
eek-xkl-$(EEK_API_VERSION).vapi \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
maintainer-clean-local:
|
maintainer-clean-local:
|
||||||
@ -72,20 +68,20 @@ eek-gtk-$(EEK_API_VERSION).vapi: $(eek_gtk_vapi_deps)
|
|||||||
--metadatadir=$(srcdir) \
|
--metadatadir=$(srcdir) \
|
||||||
$(top_builddir)/eek/EekGtk-$(EEK_API_VERSION).gir
|
$(top_builddir)/eek/EekGtk-$(EEK_API_VERSION).gir
|
||||||
|
|
||||||
eek_xkl_vapi_deps = \
|
# eek_xkl_vapi_deps = \
|
||||||
$(srcdir)/EekXkl-$(EEK_API_VERSION).metadata \
|
# $(srcdir)/EekXkl-$(EEK_API_VERSION).metadata \
|
||||||
| \
|
# | \
|
||||||
$(top_builddir)/eek/EekXkl-$(EEK_API_VERSION).gir \
|
# $(top_builddir)/eek/EekXkl-$(EEK_API_VERSION).gir \
|
||||||
$(NULL)
|
# $(NULL)
|
||||||
|
#
|
||||||
eek-xkl-$(EEK_API_VERSION).vapi: $(eek_xkl_vapi_deps)
|
# eek-xkl-$(EEK_API_VERSION).vapi: $(eek_xkl_vapi_deps)
|
||||||
$(VAPIGEN_V)$(VAPIGEN) \
|
# $(VAPIGEN_V)$(VAPIGEN) \
|
||||||
--vapidir=$(builddir) \
|
# --vapidir=$(builddir) \
|
||||||
--library eek-xkl-$(EEK_API_VERSION) \
|
# --library eek-xkl-$(EEK_API_VERSION) \
|
||||||
--pkg eek-$(EEK_API_VERSION) \
|
# --pkg eek-$(EEK_API_VERSION) \
|
||||||
--pkg gio-2.0 \
|
# --pkg gio-2.0 \
|
||||||
--metadatadir=$(srcdir) \
|
# --metadatadir=$(srcdir) \
|
||||||
$(top_builddir)/eek/EekXkl-$(EEK_API_VERSION).gir
|
# $(top_builddir)/eek/EekXkl-$(EEK_API_VERSION).gir
|
||||||
|
|
||||||
# set up the verbosity rules to avoid some build noise
|
# set up the verbosity rules to avoid some build noise
|
||||||
VAPIGEN_V = $(VAPIGEN_V_$(V))
|
VAPIGEN_V = $(VAPIGEN_V_$(V))
|
||||||
|
|||||||
@ -225,7 +225,6 @@ examples/Makefile
|
|||||||
examples/simple-client/Makefile
|
examples/simple-client/Makefile
|
||||||
eek/eek-${EEK_API_VERSION}.pc
|
eek/eek-${EEK_API_VERSION}.pc
|
||||||
eek/eek-gtk-${EEK_API_VERSION}.pc
|
eek/eek-gtk-${EEK_API_VERSION}.pc
|
||||||
eek/eek-xkl-${EEK_API_VERSION}.pc
|
|
||||||
eekboard/eekboard-${EEK_API_VERSION}.pc])
|
eekboard/eekboard-${EEK_API_VERSION}.pc])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
AC_MSG_RESULT([
|
AC_MSG_RESULT([
|
||||||
|
|||||||
@ -5,43 +5,43 @@
|
|||||||
<bounds x="15.60975" y="15.60975" width="640.0000" height="39.02439"/>
|
<bounds x="15.60975" y="15.60975" width="640.0000" height="39.02439"/>
|
||||||
<row orientation="1">
|
<row orientation="1">
|
||||||
<key keycode="9" name="ESC" oref="outline2">
|
<key keycode="9" name="ESC" oref="outline2">
|
||||||
<bounds x="3.121951" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="3.121951" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="67" name="FK01" oref="outline2">
|
<key keycode="67" name="FK01" oref="outline2">
|
||||||
<bounds x="84.29268" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="84.29268" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="68" name="FK02" oref="outline2">
|
<key keycode="68" name="FK02" oref="outline2">
|
||||||
<bounds x="124.8780" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="124.8780" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="69" name="FK03" oref="outline2">
|
<key keycode="69" name="FK03" oref="outline2">
|
||||||
<bounds x="165.4634" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="165.4634" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="70" name="FK04" oref="outline2">
|
<key keycode="70" name="FK04" oref="outline2">
|
||||||
<bounds x="206.0487" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="206.0487" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="71" name="FK05" oref="outline2">
|
<key keycode="71" name="FK05" oref="outline2">
|
||||||
<bounds x="266.9268" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="266.9268" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="72" name="FK06" oref="outline2">
|
<key keycode="72" name="FK06" oref="outline2">
|
||||||
<bounds x="307.5121" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="307.5121" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="73" name="FK07" oref="outline2">
|
<key keycode="73" name="FK07" oref="outline2">
|
||||||
<bounds x="348.0975" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="348.0975" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="74" name="FK08" oref="outline2">
|
<key keycode="74" name="FK08" oref="outline2">
|
||||||
<bounds x="388.6829" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="388.6829" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="75" name="FK09" oref="outline2">
|
<key keycode="75" name="FK09" oref="outline2">
|
||||||
<bounds x="449.5609" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="449.5609" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="76" name="FK10" oref="outline2">
|
<key keycode="76" name="FK10" oref="outline2">
|
||||||
<bounds x="490.1463" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="490.1463" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="95" name="FK11" oref="outline2">
|
<key keycode="95" name="FK11" oref="outline2">
|
||||||
<bounds x="530.7317" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="530.7317" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="96" name="FK12" oref="outline2">
|
<key keycode="96" name="FK12" oref="outline2">
|
||||||
<bounds x="571.3170" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="571.3170" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
</row>
|
</row>
|
||||||
</section>
|
</section>
|
||||||
@ -49,198 +49,198 @@
|
|||||||
<bounds x="15.60975" y="78.04878" width="608.7804" height="201.3658"/>
|
<bounds x="15.60975" y="78.04878" width="608.7804" height="201.3658"/>
|
||||||
<row orientation="1">
|
<row orientation="1">
|
||||||
<key keycode="49" name="TLDE" oref="outline2">
|
<key keycode="49" name="TLDE" oref="outline2">
|
||||||
<bounds x="3.121951" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="3.121951" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="10" name="AE01" oref="outline2">
|
<key keycode="10" name="AE01" oref="outline2">
|
||||||
<bounds x="43.70731" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="43.70731" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="11" name="AE02" oref="outline2">
|
<key keycode="11" name="AE02" oref="outline2">
|
||||||
<bounds x="84.29268" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="84.29268" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="12" name="AE03" oref="outline2">
|
<key keycode="12" name="AE03" oref="outline2">
|
||||||
<bounds x="124.8780" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="124.8780" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="13" name="AE04" oref="outline2">
|
<key keycode="13" name="AE04" oref="outline2">
|
||||||
<bounds x="165.4634" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="165.4634" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="14" name="AE05" oref="outline2">
|
<key keycode="14" name="AE05" oref="outline2">
|
||||||
<bounds x="206.0487" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="206.0487" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="15" name="AE06" oref="outline2">
|
<key keycode="15" name="AE06" oref="outline2">
|
||||||
<bounds x="245.0731" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="245.0731" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="16" name="AE07" oref="outline2">
|
<key keycode="16" name="AE07" oref="outline2">
|
||||||
<bounds x="285.6585" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="285.6585" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="17" name="AE08" oref="outline2">
|
<key keycode="17" name="AE08" oref="outline2">
|
||||||
<bounds x="326.2439" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="326.2439" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="18" name="AE09" oref="outline2">
|
<key keycode="18" name="AE09" oref="outline2">
|
||||||
<bounds x="366.8292" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="366.8292" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="19" name="AE10" oref="outline2">
|
<key keycode="19" name="AE10" oref="outline2">
|
||||||
<bounds x="407.4146" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="407.4146" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="20" name="AE11" oref="outline2">
|
<key keycode="20" name="AE11" oref="outline2">
|
||||||
<bounds x="448.0000" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="448.0000" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="21" name="AE12" oref="outline2">
|
<key keycode="21" name="AE12" oref="outline2">
|
||||||
<bounds x="488.5853" y="1.560976" width="37.46341" height="37.46341"/>
|
<bounds x="488.5853" y="1.560976" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="22" name="BKSP" oref="outline13">
|
<key keycode="22" name="BKSP" oref="outline13">
|
||||||
<bounds x="529.1707" y="1.560976" width="79.60975" height="37.46341"/>
|
<bounds x="529.1707" y="1.560976" width="79.60975" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
</row>
|
</row>
|
||||||
<row orientation="1">
|
<row orientation="1">
|
||||||
<key keycode="23" name="TAB" oref="outline4">
|
<key keycode="23" name="TAB" oref="outline4">
|
||||||
<bounds x="3.121951" y="42.14634" width="59.31707" height="37.46341"/>
|
<bounds x="3.121951" y="42.14634" width="59.31707" height="37.46341"/>
|
||||||
</key>
|
</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="37.46341"/>
|
||||||
</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"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="26" name="AD03" oref="outline2">
|
<key keycode="26" name="AD03" oref="outline2">
|
||||||
<bounds x="145.1707" y="42.14634" width="37.46341" height="37.46341"/>
|
<bounds x="145.1707" y="42.14634" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="27" name="AD04" oref="outline2">
|
<key keycode="27" name="AD04" oref="outline2">
|
||||||
<bounds x="185.7560" y="42.14634" width="37.46341" height="37.46341"/>
|
<bounds x="185.7560" y="42.14634" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="28" name="AD05" oref="outline2">
|
<key keycode="28" name="AD05" oref="outline2">
|
||||||
<bounds x="226.3414" y="42.14634" width="37.46341" height="37.46341"/>
|
<bounds x="226.3414" y="42.14634" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="29" name="AD06" oref="outline2">
|
<key keycode="29" name="AD06" oref="outline2">
|
||||||
<bounds x="266.9268" y="42.14634" width="37.46341" height="37.46341"/>
|
<bounds x="266.9268" y="42.14634" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="30" name="AD07" oref="outline2">
|
<key keycode="30" name="AD07" oref="outline2">
|
||||||
<bounds x="307.5121" y="42.14634" width="37.46341" height="37.46341"/>
|
<bounds x="307.5121" y="42.14634" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="31" name="AD08" oref="outline2">
|
<key keycode="31" name="AD08" oref="outline2">
|
||||||
<bounds x="348.0975" y="42.14634" width="37.46341" height="37.46341"/>
|
<bounds x="348.0975" y="42.14634" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="32" name="AD09" oref="outline2">
|
<key keycode="32" name="AD09" oref="outline2">
|
||||||
<bounds x="388.6829" y="42.14634" width="37.46341" height="37.46341"/>
|
<bounds x="388.6829" y="42.14634" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<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">
|
<key keycode="34" name="AD11" oref="outline2">
|
||||||
<bounds x="468.2926" y="42.14634" width="37.46341" height="37.46341"/>
|
<bounds x="468.2926" y="42.14634" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="35" name="AD12" oref="outline2">
|
<key keycode="35" name="AD12" oref="outline2">
|
||||||
<bounds x="508.8780" y="42.14634" width="37.46341" height="37.46341"/>
|
<bounds x="508.8780" y="42.14634" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="51" name="BKSL" oref="outline5">
|
<key keycode="51" name="BKSL" oref="outline5">
|
||||||
<bounds x="549.4634" y="42.14634" width="59.31707" height="37.46341"/>
|
<bounds x="549.4634" y="42.14634" width="59.31707" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
</row>
|
</row>
|
||||||
<row orientation="1">
|
<row orientation="1">
|
||||||
<key keycode="66" name="CAPS" oref="outline6">
|
<key keycode="66" name="CAPS" oref="outline6">
|
||||||
<bounds x="3.121951" y="82.73170" width="68.68292" height="37.46341"/>
|
<bounds x="3.121951" y="82.73170" width="68.68292" height="37.46341"/>
|
||||||
</key>
|
</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>
|
||||||
<key keycode="39" name="AC02" oref="outline2">
|
<key keycode="39" name="AC02" oref="outline2">
|
||||||
<bounds x="115.5121" y="82.73170" width="37.46341" height="37.46341"/>
|
<bounds x="115.5121" y="82.73170" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="40" name="AC03" oref="outline2">
|
<key keycode="40" name="AC03" oref="outline2">
|
||||||
<bounds x="156.0975" y="82.73170" width="37.46341" height="37.46341"/>
|
<bounds x="156.0975" y="82.73170" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="41" name="AC04" oref="outline2">
|
<key keycode="41" name="AC04" oref="outline2">
|
||||||
<bounds x="196.6829" y="82.73170" width="37.46341" height="37.46341"/>
|
<bounds x="196.6829" y="82.73170" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="42" name="AC05" oref="outline2">
|
<key keycode="42" name="AC05" oref="outline2">
|
||||||
<bounds x="237.2682" y="82.73170" width="37.46341" height="37.46341"/>
|
<bounds x="237.2682" y="82.73170" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="43" name="AC06" oref="outline2">
|
<key keycode="43" name="AC06" oref="outline2">
|
||||||
<bounds x="277.8536" y="82.73170" width="37.46341" height="37.46341"/>
|
<bounds x="277.8536" y="82.73170" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="44" name="AC07" oref="outline2">
|
<key keycode="44" name="AC07" oref="outline2">
|
||||||
<bounds x="318.4390" y="82.73170" width="37.46341" height="37.46341"/>
|
<bounds x="318.4390" y="82.73170" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="45" name="AC08" oref="outline2">
|
<key keycode="45" name="AC08" oref="outline2">
|
||||||
<bounds x="359.0243" y="82.73170" width="37.46341" height="37.46341"/>
|
<bounds x="359.0243" y="82.73170" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<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">
|
<key keycode="47" name="AC10" oref="outline2">
|
||||||
<bounds x="438.6341" y="82.73170" width="37.46341" height="37.46341"/>
|
<bounds x="438.6341" y="82.73170" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="48" name="AC11" oref="outline2">
|
<key keycode="48" name="AC11" oref="outline2">
|
||||||
<bounds x="479.2195" y="82.73170" width="37.46341" height="37.46341"/>
|
<bounds x="479.2195" y="82.73170" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="36" name="RTRN" oref="outline7">
|
<key keycode="36" name="RTRN" oref="outline7">
|
||||||
<bounds x="519.8048" y="82.73170" width="88.97561" height="37.46341"/>
|
<bounds x="519.8048" y="82.73170" width="88.97561" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
</row>
|
</row>
|
||||||
<row orientation="1">
|
<row orientation="1">
|
||||||
<key keycode="50" name="LFSH" oref="outline8">
|
<key keycode="50" name="LFSH" oref="outline8">
|
||||||
<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">
|
||||||
<bounds x="95.21951" y="121.7560" width="37.46341" height="37.46341"/>
|
<bounds x="95.21951" y="121.7560" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="53" name="AB02" oref="outline2">
|
<key keycode="53" name="AB02" oref="outline2">
|
||||||
<bounds x="135.8048" y="121.7560" width="37.46341" height="37.46341"/>
|
<bounds x="135.8048" y="121.7560" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="54" name="AB03" oref="outline2">
|
<key keycode="54" name="AB03" oref="outline2">
|
||||||
<bounds x="176.3902" y="121.7560" width="37.46341" height="37.46341"/>
|
<bounds x="176.3902" y="121.7560" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="55" name="AB04" oref="outline2">
|
<key keycode="55" name="AB04" oref="outline2">
|
||||||
<bounds x="215.4146" y="121.7560" width="37.46341" height="37.46341"/>
|
<bounds x="215.4146" y="121.7560" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="56" name="AB05" oref="outline2">
|
<key keycode="56" name="AB05" oref="outline2">
|
||||||
<bounds x="256.0000" y="121.7560" width="37.46341" height="37.46341"/>
|
<bounds x="256.0000" y="121.7560" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="57" name="AB06" oref="outline2">
|
<key keycode="57" name="AB06" oref="outline2">
|
||||||
<bounds x="296.5853" y="121.7560" width="37.46341" height="37.46341"/>
|
<bounds x="296.5853" y="121.7560" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<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="59" name="AB08" oref="outline2">
|
||||||
<bounds x="377.7560" y="121.7560" width="37.46341" height="37.46341"/>
|
<bounds x="377.7560" y="121.7560" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="60" name="AB09" oref="outline2">
|
<key keycode="60" name="AB09" oref="outline2">
|
||||||
<bounds x="418.3414" y="121.7560" width="37.46341" height="37.46341"/>
|
<bounds x="418.3414" y="121.7560" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="61" name="AB10" oref="outline2">
|
<key keycode="61" name="AB10" oref="outline2">
|
||||||
<bounds x="458.9268" y="121.7560" width="37.46341" height="37.46341"/>
|
<bounds x="458.9268" y="121.7560" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="62" name="RTSH" oref="outline9">
|
<key keycode="62" name="RTSH" oref="outline9">
|
||||||
<bounds x="499.5121" y="121.7560" width="109.2682" height="37.46341"/>
|
<bounds x="499.5121" y="121.7560" width="109.2682" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
</row>
|
</row>
|
||||||
<row orientation="1">
|
<row orientation="1">
|
||||||
<key keycode="149" name="I149" oref="outline10">
|
<key keycode="149" name="I149" oref="outline10">
|
||||||
<bounds x="3.121951" y="162.3414" width="37.46341" height="37.46341"/>
|
<bounds x="3.121951" y="162.3414" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="37" name="LCTL" oref="outline1">
|
<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="outline1">
|
||||||
<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="outline3">
|
||||||
<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="113" name="LEFT" oref="outline1">
|
||||||
<bounds x="368.0487" y="162.3414" width="48.39024" height="37.46341"/>
|
<bounds x="368.0487" y="162.3414" width="48.39024" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="111" name="UP" oref="outline1">
|
<key keycode="111" name="UP" oref="outline1">
|
||||||
<bounds x="419.43894" y="162.3414" width="48.39024" height="37.46341"/>
|
<bounds x="419.43894" y="162.3414" width="48.39024" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="116" name="DOWN" oref="outline1">
|
<key keycode="116" name="DOWN" oref="outline1">
|
||||||
<bounds x="470.82918" y="162.3414" width="48.39024" height="37.46341"/>
|
<bounds x="470.82918" y="162.3414" width="48.39024" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="114" name="RGHT" oref="outline1">
|
<key keycode="114" name="RGHT" oref="outline1">
|
||||||
<bounds x="522.21942" y="162.3414" width="48.39024" height="37.46341"/>
|
<bounds x="522.21942" y="162.3414" width="48.39024" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
<key keycode="150" name="I150" oref="outline10">
|
<key keycode="150" name="I150" oref="outline10">
|
||||||
<bounds x="573.60966" y="162.3414" width="37.46341" height="37.46341"/>
|
<bounds x="573.60966" y="162.3414" width="37.46341" height="37.46341"/>
|
||||||
</key>
|
</key>
|
||||||
</row>
|
</row>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@ -1,88 +1,88 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<keyboards version="0.90">
|
<keyboards version="0.90">
|
||||||
<keyboard id="ar" name="ar"
|
<keyboard id="ar" name="ar"
|
||||||
geometry="compact" symbols="ar"
|
geometry="compact" symbols="ar"
|
||||||
longname="Arabic" language="ar"/>
|
longname="Arabic" language="ar"/>
|
||||||
<keyboard id="be" name="be"
|
<keyboard id="be" name="be"
|
||||||
geometry="compact" symbols="be"
|
geometry="compact" symbols="be"
|
||||||
longname="Belarusian" language="be"/>
|
longname="Belarusian" language="be"/>
|
||||||
<keyboard id="fa" name="fa"
|
<keyboard id="fa" name="fa"
|
||||||
geometry="compact" symbols="fa"
|
geometry="compact" symbols="fa"
|
||||||
longname="Farsi (ISIRI 2901-1994)" language="fa"/>
|
longname="Farsi (ISIRI 2901-1994)" language="fa"/>
|
||||||
<keyboard id="he" name="he"
|
<keyboard id="he" name="he"
|
||||||
geometry="compact" symbols="he"
|
geometry="compact" symbols="he"
|
||||||
longname="Hebrew" language="he"/>
|
longname="Hebrew" language="he"/>
|
||||||
<keyboard id="ja" name="ja"
|
<keyboard id="ja" name="ja"
|
||||||
geometry="compact" symbols="ja-kana"
|
geometry="compact" symbols="ja-kana"
|
||||||
longname="Japanese (Kana)" language="ja"/>
|
longname="Japanese (Kana)" language="ja"/>
|
||||||
<keyboard id="kk" name="kk"
|
<keyboard id="kk" name="kk"
|
||||||
geometry="compact" symbols="kk"
|
geometry="compact" symbols="kk"
|
||||||
longname="Kazakh" language="kk"/>
|
longname="Kazakh" language="kk"/>
|
||||||
<keyboard id="ks" name="ks"
|
<keyboard id="ks" name="ks"
|
||||||
geometry="compact" symbols="ks"
|
geometry="compact" symbols="ks"
|
||||||
longname="Kashmiri" language="ks"/>
|
longname="Kashmiri" language="ks"/>
|
||||||
<keyboard id="my" name="my"
|
<keyboard id="my" name="my"
|
||||||
geometry="compact" symbols="my"
|
geometry="compact" symbols="my"
|
||||||
longname="Myanmar" language="my"/>
|
longname="Myanmar" language="my"/>
|
||||||
<keyboard id="ru" name="ru"
|
<keyboard id="ru" name="ru"
|
||||||
geometry="compact" symbols="us"
|
geometry="compact" symbols="us"
|
||||||
longname="Russian" language="ru"/>
|
longname="Russian" language="ru"/>
|
||||||
<keyboard id="th" name="th"
|
<keyboard id="th" name="th"
|
||||||
geometry="compact" symbols="th"
|
geometry="compact" symbols="th"
|
||||||
longname="Thai" language="th"/>
|
longname="Thai" language="th"/>
|
||||||
<keyboard id="ua" name="ua"
|
<keyboard id="ua" name="ua"
|
||||||
geometry="compact" symbols="ua"
|
geometry="compact" symbols="ua"
|
||||||
longname="Ukrainian" language="ua"/>
|
longname="Ukrainian" language="ua"/>
|
||||||
<keyboard id="ug" name="ug"
|
<keyboard id="ug" name="ug"
|
||||||
geometry="compact" symbols="ug"
|
geometry="compact" symbols="ug"
|
||||||
longname="Uyghur" language="ug"/>
|
longname="Uyghur" language="ug"/>
|
||||||
<keyboard id="us" name="us"
|
<keyboard id="us" name="us"
|
||||||
geometry="compact" symbols="us"
|
geometry="compact" symbols="us"
|
||||||
longname="US" language="en"/>
|
longname="US" language="en"/>
|
||||||
<keyboard id="zh-bopomofo" name="zh-bopomofo"
|
<keyboard id="zh-bopomofo" name="zh-bopomofo"
|
||||||
geometry="compact" symbols="zh-bopomofo"
|
geometry="compact" symbols="zh-bopomofo"
|
||||||
longname="Chinese (Bopomofo)" language="zh"/>
|
longname="Chinese (Bopomofo)" language="zh"/>
|
||||||
<!-- Indic Inscript keyboards converted from m17n-lib -->
|
<!-- Indic Inscript keyboards converted from m17n-lib -->
|
||||||
<keyboard id="as-inscript" name="as-inscript"
|
<keyboard id="as-inscript" name="as-inscript"
|
||||||
geometry="compact" symbols="as-inscript"
|
geometry="compact" symbols="as-inscript"
|
||||||
longname="Assamese (Inscript)" language="as"/>
|
longname="Assamese (Inscript)" language="as"/>
|
||||||
<keyboard id="bn-inscript" name="bn-inscript"
|
<keyboard id="bn-inscript" name="bn-inscript"
|
||||||
geometry="compact" symbols="bn-inscript"
|
geometry="compact" symbols="bn-inscript"
|
||||||
longname="Bengali (Inscript)" language="bn"/>
|
longname="Bengali (Inscript)" language="bn"/>
|
||||||
<keyboard id="gu-inscript" name="gu-inscript"
|
<keyboard id="gu-inscript" name="gu-inscript"
|
||||||
geometry="compact" symbols="gu-inscript"
|
geometry="compact" symbols="gu-inscript"
|
||||||
longname="Gujarati (Inscript)" language="gu"/>
|
longname="Gujarati (Inscript)" language="gu"/>
|
||||||
<keyboard id="hi-inscript" name="hi-inscript"
|
<keyboard id="hi-inscript" name="hi-inscript"
|
||||||
geometry="compact" symbols="hi-inscript"
|
geometry="compact" symbols="hi-inscript"
|
||||||
longname="Hindi (Inscript)" language="hi"/>
|
longname="Hindi (Inscript)" language="hi"/>
|
||||||
<keyboard id="kn-inscript" name="kn-inscript"
|
<keyboard id="kn-inscript" name="kn-inscript"
|
||||||
geometry="compact" symbols="kn-inscript"
|
geometry="compact" symbols="kn-inscript"
|
||||||
longname="Kannada (Inscript)" language="kn"/>
|
longname="Kannada (Inscript)" language="kn"/>
|
||||||
<keyboard id="ks-inscript" name="ks-inscript"
|
<keyboard id="ks-inscript" name="ks-inscript"
|
||||||
geometry="compact" symbols="ks-inscript"
|
geometry="compact" symbols="ks-inscript"
|
||||||
longname="Kashmiri Devanagari (Inscript)" language="ks"/>
|
longname="Kashmiri Devanagari (Inscript)" language="ks"/>
|
||||||
<keyboard id="mai-inscript" name="mai-inscript"
|
<keyboard id="mai-inscript" name="mai-inscript"
|
||||||
geometry="compact" symbols="mai-inscript"
|
geometry="compact" symbols="mai-inscript"
|
||||||
longname="Maithili (Inscript)" language="mai"/>
|
longname="Maithili (Inscript)" language="mai"/>
|
||||||
<keyboard id="ml-inscript" name="ml-inscript"
|
<keyboard id="ml-inscript" name="ml-inscript"
|
||||||
geometry="compact" symbols="ml-inscript"
|
geometry="compact" symbols="ml-inscript"
|
||||||
longname="Malayalam (Inscript)" language="ml-inscript"/>
|
longname="Malayalam (Inscript)" language="ml-inscript"/>
|
||||||
<keyboard id="mr-inscript" name="mr-inscript"
|
<keyboard id="mr-inscript" name="mr-inscript"
|
||||||
geometry="compact" symbols="mr-inscript"
|
geometry="compact" symbols="mr-inscript"
|
||||||
longname="Marathi (Inscript)" language="mr"/>
|
longname="Marathi (Inscript)" language="mr"/>
|
||||||
<keyboard id="or-inscript" name="or-inscript"
|
<keyboard id="or-inscript" name="or-inscript"
|
||||||
geometry="compact" symbols="or-inscript"
|
geometry="compact" symbols="or-inscript"
|
||||||
longname="Oriya (Inscript)" language="or"/>
|
longname="Oriya (Inscript)" language="or"/>
|
||||||
<keyboard id="pa-inscript" name="pa-inscript"
|
<keyboard id="pa-inscript" name="pa-inscript"
|
||||||
geometry="compact" symbols="pa-inscript"
|
geometry="compact" symbols="pa-inscript"
|
||||||
longname="Punjabi (Inscript)" language="pa"/>
|
longname="Punjabi (Inscript)" language="pa"/>
|
||||||
<keyboard id="sd-inscript" name="sd-inscript"
|
<keyboard id="sd-inscript" name="sd-inscript"
|
||||||
geometry="compact" symbols="sd-inscript"
|
geometry="compact" symbols="sd-inscript"
|
||||||
longname="Sindhi (Inscript)" language="sd"/>
|
longname="Sindhi (Inscript)" language="sd"/>
|
||||||
<keyboard id="ta-inscript" name="ta-inscript"
|
<keyboard id="ta-inscript" name="ta-inscript"
|
||||||
geometry="compact" symbols="ta-inscript"
|
geometry="compact" symbols="ta-inscript"
|
||||||
longname="Tamil (Inscript)" language="ta"/>
|
longname="Tamil (Inscript)" language="ta"/>
|
||||||
<keyboard id="te-inscript" name="te-inscript"
|
<keyboard id="te-inscript" name="te-inscript"
|
||||||
geometry="compact" symbols="te-inscript"
|
geometry="compact" symbols="te-inscript"
|
||||||
longname="Telugu (Inscript)" language="te"/>
|
longname="Telugu (Inscript)" language="te"/>
|
||||||
</keyboards>
|
</keyboards>
|
||||||
|
|||||||
@ -105,7 +105,6 @@ expand_content_files=eek-overview.xml
|
|||||||
GTKDOC_CFLAGS = $(GIO2_CFLAGS)
|
GTKDOC_CFLAGS = $(GIO2_CFLAGS)
|
||||||
GTKDOC_LIBS = $(top_builddir)/eek/libeek.la \
|
GTKDOC_LIBS = $(top_builddir)/eek/libeek.la \
|
||||||
$(top_builddir)/eek/libeek-gtk.la \
|
$(top_builddir)/eek/libeek-gtk.la \
|
||||||
$(top_builddir)/eek/libeek-xkl.la \
|
|
||||||
$(GIO2_LIBS) \
|
$(GIO2_LIBS) \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(LIBXKLAVIER_LIBS)
|
$(LIBXKLAVIER_LIBS)
|
||||||
|
|||||||
@ -22,12 +22,12 @@
|
|||||||
|
|
||||||
<legalnotice>
|
<legalnotice>
|
||||||
<para>
|
<para>
|
||||||
Permission is granted to copy, distribute and/or modify this
|
Permission is granted to copy, distribute and/or modify this
|
||||||
document under the terms of the GNU Free Documentation License,
|
document under the terms of the GNU Free Documentation License,
|
||||||
Version 1.3 or any later version published by the Free Software
|
Version 1.3 or any later version published by the Free Software
|
||||||
Foundation; with no Invariant Sections, no Front-Cover Texts and
|
Foundation; with no Invariant Sections, no Front-Cover Texts and
|
||||||
no Back-Cover Texts. A copy of the license is included in the
|
no Back-Cover Texts. A copy of the license is included in the
|
||||||
section entitled "GNU Free Documentation License".
|
section entitled "GNU Free Documentation License".
|
||||||
</para>
|
</para>
|
||||||
</legalnotice>
|
</legalnotice>
|
||||||
</bookinfo>
|
</bookinfo>
|
||||||
|
|||||||
@ -22,12 +22,12 @@
|
|||||||
|
|
||||||
<legalnotice>
|
<legalnotice>
|
||||||
<para>
|
<para>
|
||||||
Permission is granted to copy, distribute and/or modify this
|
Permission is granted to copy, distribute and/or modify this
|
||||||
document under the terms of the GNU Free Documentation License,
|
document under the terms of the GNU Free Documentation License,
|
||||||
Version 1.3 or any later version published by the Free Software
|
Version 1.3 or any later version published by the Free Software
|
||||||
Foundation; with no Invariant Sections, no Front-Cover Texts and
|
Foundation; with no Invariant Sections, no Front-Cover Texts and
|
||||||
no Back-Cover Texts. A copy of the license is included in the
|
no Back-Cover Texts. A copy of the license is included in the
|
||||||
section entitled "GNU Free Documentation License".
|
section entitled "GNU Free Documentation License".
|
||||||
</para>
|
</para>
|
||||||
</legalnotice>
|
</legalnotice>
|
||||||
</bookinfo>
|
</bookinfo>
|
||||||
|
|||||||
@ -21,7 +21,6 @@ NULL =
|
|||||||
lib_LTLIBRARIES = \
|
lib_LTLIBRARIES = \
|
||||||
libeek.la \
|
libeek.la \
|
||||||
libeek-gtk.la \
|
libeek-gtk.la \
|
||||||
libeek-xkl.la \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libeek_public_headers = \
|
libeek_public_headers = \
|
||||||
@ -134,34 +133,32 @@ libeek_gtk_la_SOURCES = $(libeek_gtk_sources)
|
|||||||
libeek_gtk_la_CFLAGS = -DEEK_COMPILATION=1 $(GTK_CFLAGS) $(LIBCANBERRA_CFLAGS)
|
libeek_gtk_la_CFLAGS = -DEEK_COMPILATION=1 $(GTK_CFLAGS) $(LIBCANBERRA_CFLAGS)
|
||||||
libeek_gtk_la_LIBADD = libeek.la $(GTK_LIBS) $(LIBCANBERRA_LIBS)
|
libeek_gtk_la_LIBADD = libeek.la $(GTK_LIBS) $(LIBCANBERRA_LIBS)
|
||||||
|
|
||||||
libeek_xkl_public_headers = \
|
# libeek_xkl_public_headers = \
|
||||||
$(srcdir)/eek-xkl-layout.h \
|
# $(srcdir)/eek-xkl-layout.h \
|
||||||
$(srcdir)/eek-xkl.h \
|
# $(srcdir)/eek-xkl.h \
|
||||||
$(srcdir)/eek-xkb-layout.h \
|
# $(srcdir)/eek-xkb-layout.h \
|
||||||
$(srcdir)/eek-xkb.h \
|
# $(srcdir)/eek-xkb.h \
|
||||||
$(NULL)
|
# $(NULL)
|
||||||
|
#
|
||||||
libeek_xkl_sources = \
|
# libeek_xkl_sources = \
|
||||||
$(srcdir)/eek-xkb-layout.c \
|
# $(srcdir)/eek-xkb-layout.c \
|
||||||
$(srcdir)/eek-xkl-layout.c \
|
# $(srcdir)/eek-xkl-layout.c \
|
||||||
$(NULL)
|
# $(NULL)
|
||||||
|
#
|
||||||
libeek_xkl_la_SOURCES = $(libeek_xkl_sources)
|
# libeek_xkl_la_SOURCES = $(libeek_xkl_sources)
|
||||||
libeek_xkl_la_CFLAGS = -DEEK_COMPILATION=1 $(LIBXKLAVIER_CFLAGS)
|
# libeek_xkl_la_CFLAGS = -DEEK_COMPILATION=1 $(LIBXKLAVIER_CFLAGS)
|
||||||
libeek_xkl_la_LIBADD = libeek.la $(LIBXKLAVIER_LIBS)
|
# libeek_xkl_la_LIBADD = libeek.la $(LIBXKLAVIER_LIBS)
|
||||||
|
|
||||||
eekdir = $(includedir)/eek-$(EEK_API_VERSION)/eek
|
eekdir = $(includedir)/eek-$(EEK_API_VERSION)/eek
|
||||||
eek_HEADERS = \
|
eek_HEADERS = \
|
||||||
$(libeek_public_headers) \
|
$(libeek_public_headers) \
|
||||||
$(builddir)/eek-enumtypes.h \
|
$(builddir)/eek-enumtypes.h \
|
||||||
$(libeek_gtk_public_headers) \
|
$(libeek_gtk_public_headers) \
|
||||||
$(libeek_xkl_public_headers) \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
$(libeek_private_headers) \
|
$(libeek_private_headers) \
|
||||||
$(libeek_gtk_private_headers) \
|
$(libeek_gtk_private_headers) \
|
||||||
$(libeek_xkl_private_headers) \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
eek-special-keysym-entries.h: special-keysym-entries.txt
|
eek-special-keysym-entries.h: special-keysym-entries.txt
|
||||||
@ -206,7 +203,6 @@ pkgconfigdir = $(libdir)/pkgconfig
|
|||||||
pkgconfig_DATA = \
|
pkgconfig_DATA = \
|
||||||
eek-$(EEK_API_VERSION).pc \
|
eek-$(EEK_API_VERSION).pc \
|
||||||
eek-gtk-$(EEK_API_VERSION).pc \
|
eek-gtk-$(EEK_API_VERSION).pc \
|
||||||
eek-xkl-$(EEK_API_VERSION).pc \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CLEANFILES =
|
CLEANFILES =
|
||||||
@ -267,23 +263,22 @@ EekGtk@EEK_LIBRARY_SUFFIX_U@_gir_FILES = \
|
|||||||
$(libeek_gtk_public_headers) \
|
$(libeek_gtk_public_headers) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
EekXkl@EEK_LIBRARY_SUFFIX@.gir: libeek-xkl.la Eek@EEK_LIBRARY_SUFFIX@.gir
|
# EekXkl@EEK_LIBRARY_SUFFIX@.gir: libeek-xkl.la Eek@EEK_LIBRARY_SUFFIX@.gir
|
||||||
EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_SCANNERFLAGS = \
|
# EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_SCANNERFLAGS = \
|
||||||
--identifier-prefix=Eek \
|
# --identifier-prefix=Eek \
|
||||||
--symbol-prefix=eek \
|
# --symbol-prefix=eek \
|
||||||
$(NULL)
|
# $(NULL)
|
||||||
EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_INCLUDES = GObject-2.0 Eek@EEK_LIBRARY_SUFFIX@
|
# EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_INCLUDES = GObject-2.0 Eek@EEK_LIBRARY_SUFFIX@
|
||||||
EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_CFLAGS = $(libeek_xkl_la_CFLAGS)
|
# EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_CFLAGS = $(libeek_xkl_la_CFLAGS)
|
||||||
EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_LIBS = libeek-xkl.la
|
# EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_LIBS = libeek-xkl.la
|
||||||
EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_FILES = \
|
# EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_FILES = \
|
||||||
$(libeek_xkl_sources) \
|
# $(libeek_xkl_sources) \
|
||||||
$(libeek_xkl_public_headers) \
|
# $(libeek_xkl_public_headers) \
|
||||||
$(NULL)
|
# $(NULL)
|
||||||
|
|
||||||
INTROSPECTION_GIRS += \
|
INTROSPECTION_GIRS += \
|
||||||
Eek@EEK_LIBRARY_SUFFIX@.gir \
|
Eek@EEK_LIBRARY_SUFFIX@.gir \
|
||||||
EekGtk@EEK_LIBRARY_SUFFIX@.gir \
|
EekGtk@EEK_LIBRARY_SUFFIX@.gir \
|
||||||
EekXkl@EEK_LIBRARY_SUFFIX@.gir \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
girdir = $(datadir)/gir-1.0
|
girdir = $(datadir)/gir-1.0
|
||||||
|
|||||||
@ -40,8 +40,8 @@ point_line_distance (gdouble ax, gdouble ay, gdouble nx, gdouble ny)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
normal_form (gdouble ax, gdouble ay,
|
normal_form (gdouble ax, gdouble ay,
|
||||||
gdouble bx, gdouble by,
|
gdouble bx, gdouble by,
|
||||||
gdouble * nx, gdouble * ny, gdouble * d)
|
gdouble * nx, gdouble * ny, gdouble * d)
|
||||||
{
|
{
|
||||||
gdouble l;
|
gdouble l;
|
||||||
|
|
||||||
@ -57,8 +57,8 @@ normal_form (gdouble ax, gdouble ay,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
inverse (gdouble a, gdouble b, gdouble c, gdouble d,
|
inverse (gdouble a, gdouble b, gdouble c, gdouble d,
|
||||||
gdouble * e, gdouble * f, gdouble * g, gdouble * h)
|
gdouble * e, gdouble * f, gdouble * g, gdouble * h)
|
||||||
{
|
{
|
||||||
gdouble det;
|
gdouble det;
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ inverse (gdouble a, gdouble b, gdouble c, gdouble d,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
multiply (gdouble a, gdouble b, gdouble c, gdouble d,
|
multiply (gdouble a, gdouble b, gdouble c, gdouble d,
|
||||||
gdouble e, gdouble f, gdouble * x, gdouble * y)
|
gdouble e, gdouble f, gdouble * x, gdouble * y)
|
||||||
{
|
{
|
||||||
*x = a * e + b * f;
|
*x = a * e + b * f;
|
||||||
*y = c * e + d * f;
|
*y = c * e + d * f;
|
||||||
@ -80,7 +80,7 @@ multiply (gdouble a, gdouble b, gdouble c, gdouble d,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
intersect (gdouble n1x, gdouble n1y, gdouble d1,
|
intersect (gdouble n1x, gdouble n1y, gdouble d1,
|
||||||
gdouble n2x, gdouble n2y, gdouble d2, gdouble * x, gdouble * y)
|
gdouble n2x, gdouble n2y, gdouble d2, gdouble * x, gdouble * y)
|
||||||
{
|
{
|
||||||
gdouble e, f, g, h;
|
gdouble e, f, g, h;
|
||||||
|
|
||||||
@ -94,8 +94,8 @@ intersect (gdouble n1x, gdouble n1y, gdouble d1,
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
rounded_corner (cairo_t * cr,
|
rounded_corner (cairo_t * cr,
|
||||||
gdouble bx, gdouble by,
|
gdouble bx, gdouble by,
|
||||||
gdouble cx, gdouble cy, gdouble radius)
|
gdouble cx, gdouble cy, gdouble radius)
|
||||||
{
|
{
|
||||||
gdouble ax, ay;
|
gdouble ax, ay;
|
||||||
gdouble n1x, n1y, d1;
|
gdouble n1x, n1y, d1;
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
#ifndef EEK_KEYSYM_H
|
#ifndef EEK_KEYSYM_H
|
||||||
#define EEK_KEYSYM_H 1
|
#define EEK_KEYSYM_H 1
|
||||||
|
|
||||||
#include <X11/XKBlib.h>
|
//#include <X11/XKBlib.h> //luci
|
||||||
#include "eek-symbol.h"
|
#include "eek-symbol.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
|||||||
@ -100,13 +100,13 @@ typedef enum {
|
|||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
EEK_SHIFT_MASK = 1 << 0,
|
EEK_SHIFT_MASK = 1 << 0,
|
||||||
EEK_LOCK_MASK = 1 << 1,
|
EEK_LOCK_MASK = 1 << 1,
|
||||||
EEK_CONTROL_MASK = 1 << 2,
|
EEK_CONTROL_MASK = 1 << 2,
|
||||||
EEK_MOD1_MASK = 1 << 3,
|
EEK_MOD1_MASK = 1 << 3,
|
||||||
EEK_MOD2_MASK = 1 << 4,
|
EEK_MOD2_MASK = 1 << 4,
|
||||||
EEK_MOD3_MASK = 1 << 5,
|
EEK_MOD3_MASK = 1 << 5,
|
||||||
EEK_MOD4_MASK = 1 << 6,
|
EEK_MOD4_MASK = 1 << 6,
|
||||||
EEK_MOD5_MASK = 1 << 7,
|
EEK_MOD5_MASK = 1 << 7,
|
||||||
EEK_BUTTON1_MASK = 1 << 8,
|
EEK_BUTTON1_MASK = 1 << 8,
|
||||||
EEK_BUTTON2_MASK = 1 << 9,
|
EEK_BUTTON2_MASK = 1 << 9,
|
||||||
EEK_BUTTON3_MASK = 1 << 10,
|
EEK_BUTTON3_MASK = 1 << 10,
|
||||||
|
|||||||
@ -16,15 +16,15 @@
|
|||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
# 02110-1301 USA
|
# 02110-1301 USA
|
||||||
|
|
||||||
prefix=@prefix@
|
# prefix=@prefix@
|
||||||
exec_prefix=@exec_prefix@
|
# exec_prefix=@exec_prefix@
|
||||||
libdir=@libdir@
|
# libdir=@libdir@
|
||||||
includedir=@includedir@
|
# includedir=@includedir@
|
||||||
|
#
|
||||||
Name: libeek-xkl
|
# Name: libeek-xkb
|
||||||
Description: A Library to Create Keyboard-like UI (Libxklavier Support)
|
# Description: A Library to Create Keyboard-like UI (XKB Support)
|
||||||
URL: http://fedorahosted.org/eekboard/
|
# URL: http://fedorahosted.org/eekboard/
|
||||||
Version: @VERSION@
|
# Version: @VERSION@
|
||||||
Requires: eek-@EEK_API_VERSION@ libxklavier
|
# Requires: eek-@EEK_API_VERSION@ gtk+-x11-@GTK_API_VERSION@
|
||||||
Libs: -L${libdir} -leek-xkl
|
# Libs: -L${libdir} -leek-xkb
|
||||||
Cflags: -I${includedir}/eek-@EEK_API_VERSION@
|
# Cflags: -I${includedir}/eek-@EEK_API_VERSION@
|
||||||
679
eek/eek-wkb-layout.c
Normal file
679
eek/eek-wkb-layout.c
Normal file
@ -0,0 +1,679 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org>
|
||||||
|
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||||
|
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:eek-xkb-layout
|
||||||
|
* @short_description: Layout engine using XKB configuration
|
||||||
|
*
|
||||||
|
* The #EekXkbLayout inherits #EekLayout class and arranges keyboard
|
||||||
|
* elements using XKB.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// #ifdef HAVE_CONFIG_H
|
||||||
|
// #include "config.h"
|
||||||
|
// #endif /* HAVE_CONFIG_H */
|
||||||
|
//
|
||||||
|
// #include <X11/keysym.h>
|
||||||
|
// #include <X11/XKBlib.h>
|
||||||
|
// #include <X11/extensions/XKBgeom.h>
|
||||||
|
// #include <string.h>
|
||||||
|
// #include <stdarg.h>
|
||||||
|
// #include <gio/gio.h>
|
||||||
|
//
|
||||||
|
// #include "eek-xkb-layout.h"
|
||||||
|
// #include "eek-keyboard.h"
|
||||||
|
// #include "eek-section.h"
|
||||||
|
// #include "eek-key.h"
|
||||||
|
// #include "eek-keysym.h"
|
||||||
|
//
|
||||||
|
// #define XKB_COMPONENT_MASK (XkbGBN_GeometryMask | \
|
||||||
|
// XkbGBN_KeyNamesMask | \
|
||||||
|
// XkbGBN_OtherNamesMask | \
|
||||||
|
// XkbGBN_SymbolsMask | \
|
||||||
|
// XkbGBN_IndicatorMapMask)
|
||||||
|
//
|
||||||
|
// static void initable_iface_init (GInitableIface *initable_iface);
|
||||||
|
//
|
||||||
|
// G_DEFINE_TYPE_WITH_CODE (EekXkbLayout, eek_xkb_layout, EEK_TYPE_LAYOUT,
|
||||||
|
// G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
|
||||||
|
// initable_iface_init));
|
||||||
|
//
|
||||||
|
// #define EEK_XKB_LAYOUT_GET_PRIVATE(obj) \
|
||||||
|
// (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutPrivate))
|
||||||
|
//
|
||||||
|
// enum {
|
||||||
|
// PROP_0,
|
||||||
|
// PROP_DISPLAY,
|
||||||
|
// PROP_LAST
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// struct _EekXkbLayoutPrivate
|
||||||
|
// {
|
||||||
|
// /* Configuration names that should synch'ed to the symbolic names
|
||||||
|
// in priv->xkb->names. Since we use GLib's memory allocator,
|
||||||
|
// don't store any address returned from the X server here. */
|
||||||
|
// XkbComponentNamesRec names;
|
||||||
|
//
|
||||||
|
// Display *display;
|
||||||
|
//
|
||||||
|
// /* Actual XKB configuration of DISPLAY. */
|
||||||
|
// XkbDescRec *xkb;
|
||||||
|
//
|
||||||
|
// /* Hash table to cache orefs by shape address. */
|
||||||
|
// GHashTable *shape_oref_hash;
|
||||||
|
//
|
||||||
|
// gint scale_numerator;
|
||||||
|
// gint scale_denominator;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// static guint find_keycode (EekXkbLayout *layout,
|
||||||
|
// gchar *key_name);
|
||||||
|
//
|
||||||
|
// static gboolean get_keyboard_from_server (EekXkbLayout *layout,
|
||||||
|
// GError **error);
|
||||||
|
//
|
||||||
|
// static gboolean get_names_from_server (EekXkbLayout *layout,
|
||||||
|
// GError **error);
|
||||||
|
//
|
||||||
|
// static void setup_scaling (EekXkbLayout *layout,
|
||||||
|
// gdouble width,
|
||||||
|
// gdouble height);
|
||||||
|
//
|
||||||
|
// G_INLINE_FUNC gint
|
||||||
|
// xkb_to_pixmap_coord (EekXkbLayout *layout,
|
||||||
|
// gint n)
|
||||||
|
// {
|
||||||
|
// EekXkbLayoutPrivate *priv = layout->priv;
|
||||||
|
// return n * priv->scale_numerator / priv->scale_denominator;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// G_INLINE_FUNC gdouble
|
||||||
|
// xkb_to_pixmap_double (EekXkbLayout *layout,
|
||||||
|
// gdouble d)
|
||||||
|
// {
|
||||||
|
// EekXkbLayoutPrivate *priv = layout->priv;
|
||||||
|
// return d * priv->scale_numerator / priv->scale_denominator;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static void
|
||||||
|
// create_key (EekXkbLayout *layout,
|
||||||
|
// EekKeyboard *keyboard,
|
||||||
|
// EekSection *section,
|
||||||
|
// gint column,
|
||||||
|
// gint row,
|
||||||
|
// gdouble x,
|
||||||
|
// gdouble y,
|
||||||
|
// XkbKeyRec *xkbkey)
|
||||||
|
// {
|
||||||
|
// XkbGeometryRec *xkbgeometry;
|
||||||
|
// XkbBoundsRec *xkbbounds;
|
||||||
|
// XkbShapeRec *xkbshape;
|
||||||
|
// XkbOutlineRec *xkboutline;
|
||||||
|
// EekXkbLayoutPrivate *priv = layout->priv;
|
||||||
|
// EekKey *key;
|
||||||
|
// EekBounds bounds;
|
||||||
|
// EekSymbolMatrix *matrix = NULL;
|
||||||
|
// gchar name[XkbKeyNameLength + 1];
|
||||||
|
// KeyCode keycode;
|
||||||
|
// gint num_groups, num_levels;
|
||||||
|
// guint oref;
|
||||||
|
// gpointer v;
|
||||||
|
//
|
||||||
|
// xkbgeometry = priv->xkb->geom;
|
||||||
|
// xkbshape = &xkbgeometry->shapes[xkbkey->shape_ndx];
|
||||||
|
// if (g_hash_table_lookup_extended (priv->shape_oref_hash, xkbshape,
|
||||||
|
// NULL, &v)) {
|
||||||
|
// oref = GPOINTER_TO_UINT(v);
|
||||||
|
// } else {
|
||||||
|
// EekOutline *outline;
|
||||||
|
//
|
||||||
|
// xkboutline = xkbshape->primary == NULL ? &xkbshape->outlines[0] :
|
||||||
|
// xkbshape->primary;
|
||||||
|
//
|
||||||
|
// outline = g_slice_new (EekOutline);
|
||||||
|
// outline->corner_radius = xkb_to_pixmap_coord(layout,
|
||||||
|
// xkboutline->corner_radius);
|
||||||
|
//
|
||||||
|
// if (xkboutline->num_points <= 2) { /* rectangular */
|
||||||
|
// gdouble x1, y1, x2, y2;
|
||||||
|
//
|
||||||
|
// outline->num_points = 4;
|
||||||
|
// outline->points = g_slice_alloc0 (sizeof (EekPoint) *
|
||||||
|
// outline->num_points);
|
||||||
|
// if (xkboutline->num_points == 1) {
|
||||||
|
// x1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.x1);
|
||||||
|
// y1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.y1);
|
||||||
|
// x2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
|
||||||
|
// y2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
|
||||||
|
// } else {
|
||||||
|
// x1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
|
||||||
|
// y1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
|
||||||
|
// x2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].x);
|
||||||
|
// y2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].y);
|
||||||
|
// }
|
||||||
|
// outline->points[0].x = outline->points[3].x = x1;
|
||||||
|
// outline->points[0].y = outline->points[1].y = y1;
|
||||||
|
// outline->points[1].x = outline->points[2].x = x2;
|
||||||
|
// outline->points[2].y = outline->points[3].y = y2;
|
||||||
|
// } else { /* polygon */
|
||||||
|
// gint i;
|
||||||
|
//
|
||||||
|
// outline->num_points = xkboutline->num_points;
|
||||||
|
// outline->points = g_new0 (EekPoint, outline->num_points);
|
||||||
|
// for (i = 0; i < xkboutline->num_points; i++) {
|
||||||
|
// outline->points[i].x =
|
||||||
|
// xkb_to_pixmap_coord(layout, xkboutline->points[i].x);
|
||||||
|
// outline->points[i].y =
|
||||||
|
// xkb_to_pixmap_coord(layout, xkboutline->points[i].y);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// oref = eek_keyboard_add_outline (keyboard, outline);
|
||||||
|
// eek_outline_free (outline);
|
||||||
|
// g_hash_table_insert (priv->shape_oref_hash, xkbshape,
|
||||||
|
// GUINT_TO_POINTER(oref));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// memset (name, 0, sizeof name);
|
||||||
|
// memcpy (name, xkbkey->name.name, sizeof name - 1);
|
||||||
|
//
|
||||||
|
// xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
|
||||||
|
// bounds.x = xkb_to_pixmap_coord(layout, xkbbounds->x1 + x);
|
||||||
|
// bounds.y = xkb_to_pixmap_coord(layout, xkbbounds->y1 + y);
|
||||||
|
// bounds.width = xkb_to_pixmap_coord(layout, xkbbounds->x2 - xkbbounds->x1);
|
||||||
|
// bounds.height = xkb_to_pixmap_coord(layout, xkbbounds->y2 - xkbbounds->y1);
|
||||||
|
//
|
||||||
|
// keycode = find_keycode (layout, name);
|
||||||
|
// if (keycode == EEK_INVALID_KEYCODE) {
|
||||||
|
// num_groups = num_levels = 0;
|
||||||
|
// matrix = eek_symbol_matrix_new (0, 0);
|
||||||
|
// } else {
|
||||||
|
// KeySym keysym;
|
||||||
|
// gint i, j;
|
||||||
|
//
|
||||||
|
// num_groups = XkbKeyNumGroups (priv->xkb, keycode);
|
||||||
|
// num_levels = XkbKeyGroupsWidth (priv->xkb, keycode);
|
||||||
|
// matrix = eek_symbol_matrix_new (num_groups, num_levels);
|
||||||
|
// for (i = 0; i < num_groups; i++)
|
||||||
|
// for (j = 0; j < num_levels; j++) {
|
||||||
|
// EekModifierType modifier;
|
||||||
|
//
|
||||||
|
// keysym = XkbKeySymEntry (priv->xkb, keycode, j, i);
|
||||||
|
// modifier = XkbKeysymToModifiers (priv->display, keysym);
|
||||||
|
// matrix->data[i * num_levels + j] =
|
||||||
|
// EEK_SYMBOL(eek_keysym_new_with_modifier (keysym,
|
||||||
|
// modifier));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// key = eek_section_create_key (section, keycode, column, row);
|
||||||
|
// eek_element_set_name (EEK_ELEMENT(key), name);
|
||||||
|
// eek_element_set_bounds (EEK_ELEMENT(key), &bounds);
|
||||||
|
// eek_key_set_symbol_matrix (key, matrix);
|
||||||
|
// eek_symbol_matrix_free (matrix);
|
||||||
|
// eek_key_set_oref (key, oref);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static void
|
||||||
|
// create_section (EekXkbLayout *layout,
|
||||||
|
// EekKeyboard *keyboard,
|
||||||
|
// XkbSectionRec *xkbsection)
|
||||||
|
// {
|
||||||
|
// XkbGeometryRec *xkbgeometry;
|
||||||
|
// EekXkbLayoutPrivate *priv;
|
||||||
|
// EekSection *section;
|
||||||
|
// EekBounds bounds;
|
||||||
|
// gchar *name;
|
||||||
|
// gfloat left, top;
|
||||||
|
// gint i, j;
|
||||||
|
//
|
||||||
|
// bounds.x = xkb_to_pixmap_coord(layout, xkbsection->left);
|
||||||
|
// bounds.y = xkb_to_pixmap_coord(layout, xkbsection->top);
|
||||||
|
// bounds.width = xkb_to_pixmap_coord(layout, xkbsection->width);
|
||||||
|
// bounds.height = xkb_to_pixmap_coord(layout, xkbsection->height);
|
||||||
|
//
|
||||||
|
// priv = layout->priv;
|
||||||
|
// xkbgeometry = priv->xkb->geom;
|
||||||
|
// section = eek_keyboard_create_section (keyboard);
|
||||||
|
// name = XGetAtomName (priv->display, xkbsection->name);
|
||||||
|
// eek_element_set_name (EEK_ELEMENT(section), name);
|
||||||
|
// XFree (name);
|
||||||
|
// eek_element_set_bounds (EEK_ELEMENT(section), &bounds);
|
||||||
|
// eek_section_set_angle (section,
|
||||||
|
// /* angle is in tenth of degree */
|
||||||
|
// xkbsection->angle / 10);
|
||||||
|
//
|
||||||
|
// for (i = 0; i < xkbsection->num_rows; i++) {
|
||||||
|
// XkbRowRec *xkbrow;
|
||||||
|
//
|
||||||
|
// xkbrow = &xkbsection->rows[i];
|
||||||
|
// left = xkbrow->left;
|
||||||
|
// top = xkbrow->top;
|
||||||
|
// eek_section_add_row (section,
|
||||||
|
// xkbrow->num_keys,
|
||||||
|
// xkbrow->vertical ?
|
||||||
|
// EEK_ORIENTATION_VERTICAL :
|
||||||
|
// EEK_ORIENTATION_HORIZONTAL);
|
||||||
|
// for (j = 0; j < xkbrow->num_keys; j++) {
|
||||||
|
// XkbKeyRec *xkbkey;
|
||||||
|
// XkbBoundsRec *xkbbounds;
|
||||||
|
//
|
||||||
|
// xkbkey = &xkbrow->keys[j];
|
||||||
|
// if (xkbrow->vertical)
|
||||||
|
// top += xkbkey->gap;
|
||||||
|
// else
|
||||||
|
// left += xkbkey->gap;
|
||||||
|
// create_key (layout, keyboard, section, j, i, left, top, xkbkey);
|
||||||
|
// xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
|
||||||
|
// if (xkbrow->vertical)
|
||||||
|
// top += xkbbounds->y2 - xkbbounds->y1;
|
||||||
|
// else
|
||||||
|
// left += xkbbounds->x2 - xkbbounds->x1;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static void
|
||||||
|
// create_keyboard (EekXkbLayout *layout, EekKeyboard *keyboard)
|
||||||
|
// {
|
||||||
|
// EekXkbLayoutPrivate *priv = layout->priv;
|
||||||
|
// XkbGeometryRec *xkbgeometry;
|
||||||
|
// EekBounds bounds;
|
||||||
|
// gint i;
|
||||||
|
//
|
||||||
|
// g_return_if_fail (priv->xkb);
|
||||||
|
// g_return_if_fail (priv->xkb->geom);
|
||||||
|
//
|
||||||
|
// xkbgeometry = priv->xkb->geom;
|
||||||
|
//
|
||||||
|
// eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
|
||||||
|
// setup_scaling (EEK_XKB_LAYOUT(layout), bounds.width, bounds.height);
|
||||||
|
//
|
||||||
|
// bounds.x = bounds.y = 0;
|
||||||
|
// bounds.width = xkb_to_pixmap_coord(layout, xkbgeometry->width_mm);
|
||||||
|
// bounds.height = xkb_to_pixmap_coord(layout, xkbgeometry->height_mm);
|
||||||
|
//
|
||||||
|
// for (i = 0; i < xkbgeometry->num_sections; i++) {
|
||||||
|
// XkbSectionRec *xkbsection;
|
||||||
|
//
|
||||||
|
// xkbsection = &xkbgeometry->sections[i];
|
||||||
|
// create_section (layout, keyboard, xkbsection);
|
||||||
|
// }
|
||||||
|
// eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static EekKeyboard *
|
||||||
|
// eek_xkb_layout_real_create_keyboard (EekLayout *self,
|
||||||
|
// gdouble initial_width,
|
||||||
|
// gdouble initial_height)
|
||||||
|
// {
|
||||||
|
// EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (self);
|
||||||
|
// EekBounds bounds;
|
||||||
|
// EekKeyboard *keyboard;
|
||||||
|
//
|
||||||
|
// keyboard = g_object_new (EEK_TYPE_KEYBOARD, "layout", self, NULL);
|
||||||
|
// bounds.x = bounds.y = 0.0;
|
||||||
|
// bounds.width = initial_width;
|
||||||
|
// bounds.height = initial_height;
|
||||||
|
// eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
|
||||||
|
//
|
||||||
|
// /* resolve modifiers dynamically assigned at run time */
|
||||||
|
// eek_keyboard_set_num_lock_mask (keyboard,
|
||||||
|
// XkbKeysymToModifiers (priv->display,
|
||||||
|
// XK_Num_Lock));
|
||||||
|
// eek_keyboard_set_alt_gr_mask (keyboard,
|
||||||
|
// XkbKeysymToModifiers (priv->display,
|
||||||
|
// XK_ISO_Level3_Shift));
|
||||||
|
//
|
||||||
|
// if (priv->shape_oref_hash)
|
||||||
|
// g_hash_table_destroy (priv->shape_oref_hash);
|
||||||
|
//
|
||||||
|
// priv->shape_oref_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||||
|
// create_keyboard (EEK_XKB_LAYOUT(self), keyboard);
|
||||||
|
// g_hash_table_destroy (priv->shape_oref_hash);
|
||||||
|
//
|
||||||
|
// return keyboard;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static void
|
||||||
|
// eek_xkb_layout_finalize (GObject *object)
|
||||||
|
// {
|
||||||
|
// EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (object);
|
||||||
|
//
|
||||||
|
// g_free (priv->names.keycodes);
|
||||||
|
// g_free (priv->names.geometry);
|
||||||
|
// g_free (priv->names.symbols);
|
||||||
|
// XkbFreeKeyboard (priv->xkb, 0, TRUE); /* free_all = TRUE */
|
||||||
|
// G_OBJECT_CLASS (eek_xkb_layout_parent_class)->finalize (object);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static void
|
||||||
|
// eek_xkb_layout_set_property (GObject *object,
|
||||||
|
// guint prop_id,
|
||||||
|
// const GValue *value,
|
||||||
|
// GParamSpec *pspec)
|
||||||
|
// {
|
||||||
|
// EekXkbLayout *layout = EEK_XKB_LAYOUT (object);
|
||||||
|
//
|
||||||
|
// switch (prop_id) {
|
||||||
|
// case PROP_DISPLAY:
|
||||||
|
// layout->priv->display = g_value_get_pointer (value);
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static void
|
||||||
|
// eek_xkb_layout_get_property (GObject *object,
|
||||||
|
// guint prop_id,
|
||||||
|
// GValue *value,
|
||||||
|
// GParamSpec *pspec)
|
||||||
|
// {
|
||||||
|
// EekXkbLayout *layout = EEK_XKB_LAYOUT (object);
|
||||||
|
//
|
||||||
|
// switch (prop_id) {
|
||||||
|
// case PROP_DISPLAY:
|
||||||
|
// g_value_set_pointer (value, layout->priv->display);
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static void
|
||||||
|
// eek_xkb_layout_class_init (EekXkbLayoutClass *klass)
|
||||||
|
// {
|
||||||
|
// EekLayoutClass *layout_class = EEK_LAYOUT_CLASS (klass);
|
||||||
|
// GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
// GParamSpec *pspec;
|
||||||
|
//
|
||||||
|
// g_type_class_add_private (gobject_class, sizeof (EekXkbLayoutPrivate));
|
||||||
|
//
|
||||||
|
// layout_class->create_keyboard = eek_xkb_layout_real_create_keyboard;
|
||||||
|
//
|
||||||
|
// gobject_class->finalize = eek_xkb_layout_finalize;
|
||||||
|
// gobject_class->set_property = eek_xkb_layout_set_property;
|
||||||
|
// gobject_class->get_property = eek_xkb_layout_get_property;
|
||||||
|
//
|
||||||
|
// pspec = g_param_spec_pointer ("display",
|
||||||
|
// "Display",
|
||||||
|
// "X Display",
|
||||||
|
// G_PARAM_READWRITE |
|
||||||
|
// G_PARAM_CONSTRUCT_ONLY);
|
||||||
|
// g_object_class_install_property (gobject_class, PROP_DISPLAY, pspec);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static void
|
||||||
|
// eek_xkb_layout_init (EekXkbLayout *self)
|
||||||
|
// {
|
||||||
|
// self->priv = EEK_XKB_LAYOUT_GET_PRIVATE (self);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static gboolean
|
||||||
|
// get_names_from_server (EekXkbLayout *layout,
|
||||||
|
// GError **error)
|
||||||
|
// {
|
||||||
|
// EekXkbLayoutPrivate *priv = layout->priv;
|
||||||
|
// gchar *name;
|
||||||
|
//
|
||||||
|
// XkbGetNames (priv->display, XkbAllNamesMask, priv->xkb);
|
||||||
|
//
|
||||||
|
// if (priv->xkb->names->keycodes <= 0)
|
||||||
|
// g_warning ("XKB keycodes setting is not loaded properly");
|
||||||
|
// else {
|
||||||
|
// name = XGetAtomName (priv->display, priv->xkb->names->keycodes);
|
||||||
|
// if (!name)
|
||||||
|
// g_warning ("Can't get the name of keycodes");
|
||||||
|
// else if (!priv->names.keycodes ||
|
||||||
|
// g_strcmp0 (name, priv->names.keycodes)) {
|
||||||
|
// g_free (priv->names.keycodes);
|
||||||
|
// priv->names.keycodes = g_strdup (name);
|
||||||
|
// XFree (name);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (priv->xkb->names->geometry <= 0)
|
||||||
|
// g_warning ("XKB geometry setting is not loaded");
|
||||||
|
// else {
|
||||||
|
// name = XGetAtomName (priv->display, priv->xkb->names->geometry);
|
||||||
|
// if (!name)
|
||||||
|
// g_warning ("Can't get the name of geometry");
|
||||||
|
// else if (!priv->names.geometry ||
|
||||||
|
// g_strcmp0 (name, priv->names.geometry)) {
|
||||||
|
// g_free (priv->names.geometry);
|
||||||
|
// priv->names.geometry = g_strdup (name);
|
||||||
|
// XFree (name);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (priv->xkb->names->symbols <= 0)
|
||||||
|
// g_warning ("XKB symbols setting is not loaded");
|
||||||
|
// else {
|
||||||
|
// name = XGetAtomName (priv->display, priv->xkb->names->symbols);
|
||||||
|
// if (!name)
|
||||||
|
// g_warning ("Can't get the name of symbols");
|
||||||
|
// else if (!priv->names.symbols ||
|
||||||
|
// g_strcmp0 (name, priv->names.symbols)) {
|
||||||
|
// g_free (priv->names.symbols);
|
||||||
|
// priv->names.symbols = g_strdup (name);
|
||||||
|
// XFree (name);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return TRUE;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * eek_xkb_layout_new:
|
||||||
|
// *
|
||||||
|
// * Create a new #EekXkbLayout.
|
||||||
|
// */
|
||||||
|
// EekLayout *
|
||||||
|
// eek_xkb_layout_new (Display *display,
|
||||||
|
// GError **error)
|
||||||
|
// {
|
||||||
|
// return (EekLayout *) g_initable_new (EEK_TYPE_XKB_LAYOUT,
|
||||||
|
// NULL,
|
||||||
|
// error,
|
||||||
|
// "display", display,
|
||||||
|
// NULL);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * eek_xkb_layout_set_names: (skip)
|
||||||
|
// * @layout: an #EekXkbLayout
|
||||||
|
// * @names: XKB component names
|
||||||
|
// * @error: a #GError
|
||||||
|
// *
|
||||||
|
// * Set the XKB component names to @layout.
|
||||||
|
// * Returns: %TRUE if the component names are successfully set, %FALSE otherwise
|
||||||
|
// */
|
||||||
|
// gboolean
|
||||||
|
// eek_xkb_layout_set_names (EekXkbLayout *layout,
|
||||||
|
// XkbComponentNamesRec *names,
|
||||||
|
// GError **error)
|
||||||
|
// {
|
||||||
|
// if (g_strcmp0 (names->keycodes, layout->priv->names.keycodes)) {
|
||||||
|
// g_free (layout->priv->names.keycodes);
|
||||||
|
// layout->priv->names.keycodes = g_strdup (names->keycodes);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (g_strcmp0 (names->geometry, layout->priv->names.geometry)) {
|
||||||
|
// g_free (layout->priv->names.geometry);
|
||||||
|
// layout->priv->names.geometry = g_strdup (names->geometry);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (g_strcmp0 (names->symbols, layout->priv->names.symbols)) {
|
||||||
|
// g_free (layout->priv->names.symbols);
|
||||||
|
// layout->priv->names.symbols = g_strdup (names->symbols);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return get_keyboard_from_server (layout, error);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static gboolean
|
||||||
|
// get_keyboard_from_server (EekXkbLayout *layout,
|
||||||
|
// GError **error)
|
||||||
|
// {
|
||||||
|
// EekXkbLayoutPrivate *priv = layout->priv;
|
||||||
|
//
|
||||||
|
// if (priv->xkb) {
|
||||||
|
// XkbFreeKeyboard (priv->xkb, 0, True);
|
||||||
|
// priv->xkb = NULL;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (priv->names.keycodes && priv->names.geometry && priv->names.symbols) {
|
||||||
|
// priv->xkb = XkbGetKeyboardByName (priv->display,
|
||||||
|
// XkbUseCoreKbd,
|
||||||
|
// &priv->names,
|
||||||
|
// 0,
|
||||||
|
// XKB_COMPONENT_MASK,
|
||||||
|
// False);
|
||||||
|
// } else {
|
||||||
|
// priv->xkb = XkbGetKeyboard (priv->display,
|
||||||
|
// XKB_COMPONENT_MASK,
|
||||||
|
// XkbUseCoreKbd);
|
||||||
|
// if (!get_names_from_server (layout, error)) {
|
||||||
|
// XkbFreeKeyboard (priv->xkb, 0, True);
|
||||||
|
// priv->xkb = NULL;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (priv->xkb == NULL) {
|
||||||
|
// g_set_error (error,
|
||||||
|
// EEK_ERROR,
|
||||||
|
// EEK_ERROR_LAYOUT_ERROR,
|
||||||
|
// "can't get keyboard from server");
|
||||||
|
// g_free (priv->names.keycodes);
|
||||||
|
// priv->names.keycodes = NULL;
|
||||||
|
// g_free (priv->names.geometry);
|
||||||
|
// priv->names.geometry = NULL;
|
||||||
|
// g_free (priv->names.symbols);
|
||||||
|
// priv->names.symbols = NULL;
|
||||||
|
// return FALSE;
|
||||||
|
// }
|
||||||
|
// return TRUE;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// static guint
|
||||||
|
// find_keycode (EekXkbLayout *layout, gchar *key_name)
|
||||||
|
// {
|
||||||
|
// #define KEYSYM_NAME_MAX_LENGTH 4
|
||||||
|
// guint keycode;
|
||||||
|
// gint i, j;
|
||||||
|
// XkbKeyNamePtr pkey;
|
||||||
|
// XkbKeyAliasPtr palias;
|
||||||
|
// guint is_name_matched;
|
||||||
|
// gchar *src, *dst;
|
||||||
|
// EekXkbLayoutPrivate *priv = layout->priv;
|
||||||
|
//
|
||||||
|
// if (!priv->xkb)
|
||||||
|
// return EEK_INVALID_KEYCODE;
|
||||||
|
//
|
||||||
|
// pkey = priv->xkb->names->keys + priv->xkb->min_key_code;
|
||||||
|
// for (keycode = priv->xkb->min_key_code;
|
||||||
|
// keycode <= priv->xkb->max_key_code; keycode++) {
|
||||||
|
// is_name_matched = 1;
|
||||||
|
// src = key_name;
|
||||||
|
// dst = pkey->name;
|
||||||
|
// for (i = KEYSYM_NAME_MAX_LENGTH; --i >= 0;) {
|
||||||
|
// if ('\0' == *src)
|
||||||
|
// break;
|
||||||
|
// if (*src++ != *dst++) {
|
||||||
|
// is_name_matched = 0;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (is_name_matched)
|
||||||
|
// return keycode;
|
||||||
|
// pkey++;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// palias = priv->xkb->names->key_aliases;
|
||||||
|
// for (j = priv->xkb->names->num_key_aliases; --j >= 0;) {
|
||||||
|
// is_name_matched = 1;
|
||||||
|
// src = key_name;
|
||||||
|
// dst = palias->alias;
|
||||||
|
// for (i = KEYSYM_NAME_MAX_LENGTH; --i >= 0;) {
|
||||||
|
// if ('\0' == *src)
|
||||||
|
// break;
|
||||||
|
// if (*src++ != *dst++) {
|
||||||
|
// is_name_matched = 0;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (is_name_matched) {
|
||||||
|
// keycode = find_keycode (layout, palias->real);
|
||||||
|
// return keycode;
|
||||||
|
// }
|
||||||
|
// palias++;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return EEK_INVALID_KEYCODE;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static void
|
||||||
|
// setup_scaling (EekXkbLayout *layout,
|
||||||
|
// gdouble width,
|
||||||
|
// gdouble height)
|
||||||
|
// {
|
||||||
|
// EekXkbLayoutPrivate *priv = layout->priv;
|
||||||
|
//
|
||||||
|
// g_return_if_fail (priv->xkb);
|
||||||
|
//
|
||||||
|
// g_return_if_fail (priv->xkb->geom->width_mm > 0);
|
||||||
|
// g_return_if_fail (priv->xkb->geom->height_mm > 0);
|
||||||
|
//
|
||||||
|
// if (width * priv->xkb->geom->height_mm <
|
||||||
|
// height * priv->xkb->geom->width_mm) {
|
||||||
|
// priv->scale_numerator = width;
|
||||||
|
// priv->scale_denominator = priv->xkb->geom->width_mm;
|
||||||
|
// } else {
|
||||||
|
// priv->scale_numerator = height;
|
||||||
|
// priv->scale_denominator = priv->xkb->geom->height_mm;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static gboolean
|
||||||
|
// initable_init (GInitable *initable,
|
||||||
|
// GCancellable *cancellable,
|
||||||
|
// GError **error)
|
||||||
|
// {
|
||||||
|
// EekXkbLayout *layout = EEK_XKB_LAYOUT (initable);
|
||||||
|
//
|
||||||
|
// if (!get_keyboard_from_server (layout, error))
|
||||||
|
// return FALSE;
|
||||||
|
//
|
||||||
|
// if (!get_names_from_server (layout, error))
|
||||||
|
// return FALSE;
|
||||||
|
//
|
||||||
|
// return TRUE;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static void
|
||||||
|
// initable_iface_init (GInitableIface *initable_iface)
|
||||||
|
// {
|
||||||
|
// initable_iface->init = initable_init;
|
||||||
|
// }
|
||||||
72
eek/eek-wkb-layout.h
Normal file
72
eek/eek-wkb-layout.h
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||||
|
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
|
||||||
|
//#error "Only <eek/eek-xkb.h> can be included directly."
|
||||||
|
//#endif
|
||||||
|
//
|
||||||
|
//#ifndef EEK_XKB_LAYOUT_H
|
||||||
|
//#define EEK_XKB_LAYOUT_H 1
|
||||||
|
//
|
||||||
|
//#include <X11/Xlib.h>
|
||||||
|
//#include <X11/XKBlib.h>
|
||||||
|
//#include "eek-layout.h"
|
||||||
|
//
|
||||||
|
//G_BEGIN_DECLS
|
||||||
|
//
|
||||||
|
//#define EEK_TYPE_XKB_LAYOUT (eek_xkb_layout_get_type())
|
||||||
|
//#define EEK_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayout))
|
||||||
|
//#define EEK_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
|
||||||
|
//#define EEK_IS_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XKB_LAYOUT))
|
||||||
|
//#define EEK_IS_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XKB_LAYOUT))
|
||||||
|
//#define EEK_XKB_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
|
||||||
|
//
|
||||||
|
//typedef struct _EekXkbLayout EekXkbLayout;
|
||||||
|
//typedef struct _EekXkbLayoutClass EekXkbLayoutClass;
|
||||||
|
//typedef struct _EekXkbLayoutPrivate EekXkbLayoutPrivate;
|
||||||
|
//
|
||||||
|
//struct _EekXkbLayout
|
||||||
|
//{
|
||||||
|
// /*< private >*/
|
||||||
|
// EekLayout parent;
|
||||||
|
//
|
||||||
|
// EekXkbLayoutPrivate *priv;
|
||||||
|
//};
|
||||||
|
//
|
||||||
|
//struct _EekXkbLayoutClass
|
||||||
|
//{
|
||||||
|
// /*< private >*/
|
||||||
|
// EekLayoutClass parent_class;
|
||||||
|
//
|
||||||
|
// /*< private >*/
|
||||||
|
// /* padding */
|
||||||
|
// gpointer pdummy[24];
|
||||||
|
//};
|
||||||
|
//
|
||||||
|
//GType eek_xkb_layout_get_type (void) G_GNUC_CONST;
|
||||||
|
//EekLayout *eek_xkb_layout_new (Display *display,
|
||||||
|
// GError **error);
|
||||||
|
//
|
||||||
|
//gboolean eek_xkb_layout_set_names (EekXkbLayout *layout,
|
||||||
|
// XkbComponentNamesRec *names,
|
||||||
|
// GError **error);
|
||||||
|
//
|
||||||
|
//G_END_DECLS
|
||||||
|
//#endif /* #ifndef EEK_XKB_LAYOUT_H */
|
||||||
@ -17,10 +17,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
* 02110-1301 USA
|
* 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
#ifndef EEK_XKL_H
|
//#ifndef EEK_XKB_H
|
||||||
#define EEK_XKL_H 1
|
//#define EEK_XKB_H 1
|
||||||
|
//
|
||||||
#include "eek.h"
|
//#include "eek.h"
|
||||||
#include "eek-xkl-layout.h"
|
//#include "eek-xkb-layout.h"
|
||||||
|
//
|
||||||
#endif /* EEK_XKL_H */
|
//#endif /* EEK_XKB_H */
|
||||||
@ -16,15 +16,15 @@
|
|||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
# 02110-1301 USA
|
# 02110-1301 USA
|
||||||
|
|
||||||
prefix=@prefix@
|
# prefix=@prefix@
|
||||||
exec_prefix=@exec_prefix@
|
# exec_prefix=@exec_prefix@
|
||||||
libdir=@libdir@
|
# libdir=@libdir@
|
||||||
includedir=@includedir@
|
# includedir=@includedir@
|
||||||
|
#
|
||||||
Name: libeek-xkb
|
# Name: libeek-xkl
|
||||||
Description: A Library to Create Keyboard-like UI (XKB Support)
|
# Description: A Library to Create Keyboard-like UI (Libxklavier Support)
|
||||||
URL: http://fedorahosted.org/eekboard/
|
# URL: http://fedorahosted.org/eekboard/
|
||||||
Version: @VERSION@
|
# Version: @VERSION@
|
||||||
Requires: eek-@EEK_API_VERSION@ gtk+-x11-@GTK_API_VERSION@
|
# Requires: eek-@EEK_API_VERSION@ libxklavier
|
||||||
Libs: -L${libdir} -leek-xkb
|
# Libs: -L${libdir} -leek-xkl
|
||||||
Cflags: -I${includedir}/eek-@EEK_API_VERSION@
|
# Cflags: -I${includedir}/eek-@EEK_API_VERSION@
|
||||||
663
eek/eek-wkl-layout.c
Normal file
663
eek/eek-wkl-layout.c
Normal file
@ -0,0 +1,663 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||||
|
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:eek-xkl-layout
|
||||||
|
* @short_description: Layout engine using Libxklavier configuration
|
||||||
|
*
|
||||||
|
* The #EekXklLayout is a simple wrapper around #EekXkbLayout class
|
||||||
|
* to use Libxklavier configuration.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#ifdef HAVE_CONFIG_H
|
||||||
|
//#include "config.h"
|
||||||
|
//#endif /* HAVE_CONFIG_H */
|
||||||
|
//
|
||||||
|
//#include <libxklavier/xklavier.h>
|
||||||
|
//#include <gio/gio.h>
|
||||||
|
//#include <string.h>
|
||||||
|
//
|
||||||
|
//#include "eek-xkl-layout.h"
|
||||||
|
//
|
||||||
|
//#define noKBDRAW_DEBUG
|
||||||
|
//
|
||||||
|
//static GInitableIface *parent_initable_iface;
|
||||||
|
//
|
||||||
|
//static void initable_iface_init (GInitableIface *initable_iface);
|
||||||
|
//
|
||||||
|
//G_DEFINE_TYPE_WITH_CODE (EekXklLayout, eek_xkl_layout, EEK_TYPE_XKB_LAYOUT,
|
||||||
|
// G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
|
||||||
|
// initable_iface_init));
|
||||||
|
//
|
||||||
|
//#define EEK_XKL_LAYOUT_GET_PRIVATE(obj) \
|
||||||
|
// (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayoutPrivate))
|
||||||
|
//
|
||||||
|
//enum {
|
||||||
|
// PROP_0,
|
||||||
|
// PROP_MODEL,
|
||||||
|
// PROP_LAYOUTS,
|
||||||
|
// PROP_VARIANTS,
|
||||||
|
// PROP_OPTIONS,
|
||||||
|
// PROP_LAST
|
||||||
|
//};
|
||||||
|
//
|
||||||
|
//struct _EekXklLayoutPrivate
|
||||||
|
//{
|
||||||
|
// XklEngine *engine;
|
||||||
|
// XklConfigRec *config;
|
||||||
|
//};
|
||||||
|
//
|
||||||
|
///* from gnome-keyboard-properties-xkbpv.c:
|
||||||
|
// * BAD STYLE: Taken from xklavier_private_xkb.h
|
||||||
|
// * Any ideas on architectural improvements are WELCOME
|
||||||
|
// */
|
||||||
|
//extern gboolean xkl_xkb_config_native_prepare (XklEngine * engine,
|
||||||
|
// const XklConfigRec * data,
|
||||||
|
// XkbComponentNamesPtr
|
||||||
|
// component_names);
|
||||||
|
//
|
||||||
|
//extern void xkl_xkb_config_native_cleanup (XklEngine * engine,
|
||||||
|
// XkbComponentNamesPtr
|
||||||
|
// component_names);
|
||||||
|
//
|
||||||
|
//static gboolean set_xkb_component_names (EekXklLayout *layout,
|
||||||
|
// XklConfigRec *config);
|
||||||
|
//
|
||||||
|
//static void
|
||||||
|
//eek_xkl_layout_dispose (GObject *object)
|
||||||
|
//{
|
||||||
|
// EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (object);
|
||||||
|
//
|
||||||
|
// if (priv->config) {
|
||||||
|
// g_object_unref (priv->config);
|
||||||
|
// priv->config = NULL;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// G_OBJECT_CLASS (eek_xkl_layout_parent_class)->dispose (object);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//static void
|
||||||
|
//eek_xkl_layout_set_property (GObject *object,
|
||||||
|
// guint prop_id,
|
||||||
|
// const GValue *value,
|
||||||
|
// GParamSpec *pspec)
|
||||||
|
//{
|
||||||
|
// EekXklLayout *layout = EEK_XKL_LAYOUT(object);
|
||||||
|
//
|
||||||
|
// switch (prop_id) {
|
||||||
|
// case PROP_MODEL:
|
||||||
|
// eek_xkl_layout_set_model (layout, g_value_get_string (value));
|
||||||
|
// break;
|
||||||
|
// case PROP_LAYOUTS:
|
||||||
|
// eek_xkl_layout_set_layouts (layout, g_value_get_boxed (value));
|
||||||
|
// break;
|
||||||
|
// case PROP_VARIANTS:
|
||||||
|
// eek_xkl_layout_set_variants (layout, g_value_get_boxed (value));
|
||||||
|
// break;
|
||||||
|
// case PROP_OPTIONS:
|
||||||
|
// eek_xkl_layout_set_options (layout, g_value_get_boxed (value));
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//static void
|
||||||
|
//eek_xkl_layout_get_property (GObject *object,
|
||||||
|
// guint prop_id,
|
||||||
|
// GValue *value,
|
||||||
|
// GParamSpec *pspec)
|
||||||
|
//{
|
||||||
|
// EekXklLayout *layout = EEK_XKL_LAYOUT(object);
|
||||||
|
//
|
||||||
|
// switch (prop_id) {
|
||||||
|
// case PROP_MODEL:
|
||||||
|
// g_value_set_string (value,
|
||||||
|
// eek_xkl_layout_get_model (layout));
|
||||||
|
// break;
|
||||||
|
// case PROP_LAYOUTS:
|
||||||
|
// g_value_set_boxed (value,
|
||||||
|
// eek_xkl_layout_get_layouts (layout));
|
||||||
|
// break;
|
||||||
|
// case PROP_VARIANTS:
|
||||||
|
// g_value_set_boxed (value,
|
||||||
|
// eek_xkl_layout_get_variants (layout));
|
||||||
|
// break;
|
||||||
|
// case PROP_OPTIONS:
|
||||||
|
// g_value_set_boxed (value,
|
||||||
|
// eek_xkl_layout_get_options (layout));
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//static void
|
||||||
|
//eek_xkl_layout_class_init (EekXklLayoutClass *klass)
|
||||||
|
//{
|
||||||
|
// GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
// GParamSpec *pspec;
|
||||||
|
//
|
||||||
|
// g_type_class_add_private (gobject_class, sizeof (EekXklLayoutPrivate));
|
||||||
|
//
|
||||||
|
// gobject_class->dispose = eek_xkl_layout_dispose;
|
||||||
|
// gobject_class->set_property = eek_xkl_layout_set_property;
|
||||||
|
// gobject_class->get_property = eek_xkl_layout_get_property;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * EekXklLayout:model:
|
||||||
|
// *
|
||||||
|
// * The libxklavier model name of #EekXklLayout.
|
||||||
|
// */
|
||||||
|
// pspec = g_param_spec_string ("model",
|
||||||
|
// "Model",
|
||||||
|
// "Libxklavier model",
|
||||||
|
// NULL,
|
||||||
|
// G_PARAM_READWRITE);
|
||||||
|
// g_object_class_install_property (gobject_class, PROP_MODEL, pspec);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * EekXklLayout:layouts:
|
||||||
|
// *
|
||||||
|
// * The libxklavier layout names of #EekXklLayout.
|
||||||
|
// */
|
||||||
|
// pspec = g_param_spec_boxed ("layouts",
|
||||||
|
// "Layouts",
|
||||||
|
// "Libxklavier layouts",
|
||||||
|
// G_TYPE_STRV,
|
||||||
|
// G_PARAM_READWRITE);
|
||||||
|
// g_object_class_install_property (gobject_class, PROP_LAYOUTS, pspec);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * EekXklLayout:variants:
|
||||||
|
// *
|
||||||
|
// * The libxklavier variant names of #EekXklLayout.
|
||||||
|
// */
|
||||||
|
// pspec = g_param_spec_boxed ("variants",
|
||||||
|
// "Variants",
|
||||||
|
// "Libxklavier variants",
|
||||||
|
// G_TYPE_STRV,
|
||||||
|
// G_PARAM_READWRITE);
|
||||||
|
// g_object_class_install_property (gobject_class, PROP_VARIANTS, pspec);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * EekXklLayout:options:
|
||||||
|
// *
|
||||||
|
// * The libxklavier option names of #EekXklLayout.
|
||||||
|
// */
|
||||||
|
// pspec = g_param_spec_boxed ("options",
|
||||||
|
// "Options",
|
||||||
|
// "Libxklavier options",
|
||||||
|
// G_TYPE_STRV,
|
||||||
|
// G_PARAM_READWRITE);
|
||||||
|
// g_object_class_install_property (gobject_class, PROP_OPTIONS, pspec);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//static void
|
||||||
|
//eek_xkl_layout_init (EekXklLayout *self)
|
||||||
|
//{
|
||||||
|
// self->priv = EEK_XKL_LAYOUT_GET_PRIVATE (self);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_new:
|
||||||
|
// *
|
||||||
|
// * Create a new #EekXklLayout.
|
||||||
|
// */
|
||||||
|
//EekLayout *
|
||||||
|
//eek_xkl_layout_new (Display *display, GError **error)
|
||||||
|
//{
|
||||||
|
// return (EekLayout *) g_initable_new (EEK_TYPE_XKL_LAYOUT,
|
||||||
|
// NULL,
|
||||||
|
// error,
|
||||||
|
// "display", display,
|
||||||
|
// NULL);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//G_INLINE_FUNC void
|
||||||
|
//merge_xkl_config_rec (XklConfigRec *dst, XklConfigRec *src)
|
||||||
|
//{
|
||||||
|
// if (src->model) {
|
||||||
|
// g_free (dst->model);
|
||||||
|
// dst->model = g_strdup (src->model);
|
||||||
|
// }
|
||||||
|
// if (src->layouts) {
|
||||||
|
// g_strfreev (dst->layouts);
|
||||||
|
// dst->layouts = g_strdupv (src->layouts);
|
||||||
|
// }
|
||||||
|
// if (src->variants) {
|
||||||
|
// g_strfreev (dst->variants);
|
||||||
|
// dst->variants = g_strdupv (src->variants);
|
||||||
|
// }
|
||||||
|
// if (src->options) {
|
||||||
|
// g_strfreev (dst->options);
|
||||||
|
// dst->options = g_strdupv (src->options);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_set_config: (skip)
|
||||||
|
// * @layout: an #EekXklLayout
|
||||||
|
// * @config: Libxklavier configuration
|
||||||
|
// *
|
||||||
|
// * Reconfigure @layout with @config.
|
||||||
|
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
|
||||||
|
// */
|
||||||
|
//gboolean
|
||||||
|
//eek_xkl_layout_set_config (EekXklLayout *layout,
|
||||||
|
// XklConfigRec *config)
|
||||||
|
//{
|
||||||
|
// EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||||
|
// XklConfigRec *c;
|
||||||
|
// gboolean retval;
|
||||||
|
//
|
||||||
|
// g_return_val_if_fail (priv, FALSE);
|
||||||
|
// c = xkl_config_rec_new ();
|
||||||
|
// merge_xkl_config_rec (c, priv->config);
|
||||||
|
// merge_xkl_config_rec (c, config);
|
||||||
|
// retval = set_xkb_component_names (layout, c);
|
||||||
|
// g_object_unref (c);
|
||||||
|
// merge_xkl_config_rec (priv->config, config);
|
||||||
|
// return retval;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_set_config_full:
|
||||||
|
// * @layout: an #EekXklLayout
|
||||||
|
// * @model: Libxklavier model name
|
||||||
|
// * @layouts: Libxklavier layouts
|
||||||
|
// * @variants: Libxklavier variants
|
||||||
|
// * @options: Libxklavier options
|
||||||
|
// *
|
||||||
|
// * Reconfigure @layout with @model, @layouts, @variants, and @options.
|
||||||
|
// * This function is merely a wrapper around
|
||||||
|
// * eek_xkl_layout_set_config() to avoid passing a pointer of
|
||||||
|
// * XklConfigRec, which is not currently available in the
|
||||||
|
// * gobject-introspection repository.
|
||||||
|
// *
|
||||||
|
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
|
||||||
|
// * Since: 0.0.2
|
||||||
|
// */
|
||||||
|
//gboolean
|
||||||
|
//eek_xkl_layout_set_config_full (EekXklLayout *layout,
|
||||||
|
// gchar *model,
|
||||||
|
// gchar **layouts,
|
||||||
|
// gchar **variants,
|
||||||
|
// gchar **options)
|
||||||
|
//{
|
||||||
|
// XklConfigRec *config;
|
||||||
|
// gboolean retval;
|
||||||
|
//
|
||||||
|
// config = xkl_config_rec_new ();
|
||||||
|
// config->model = g_strdup (model);
|
||||||
|
// config->layouts = g_strdupv (layouts);
|
||||||
|
// config->variants = g_strdupv (variants);
|
||||||
|
// config->options = g_strdupv (options);
|
||||||
|
// retval = eek_xkl_layout_set_config (layout, config);
|
||||||
|
// g_object_unref (config);
|
||||||
|
// return retval;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_set_model:
|
||||||
|
// * @layout: an #EekXklLayout
|
||||||
|
// * @model: model name
|
||||||
|
// *
|
||||||
|
// * Set the model name of @layout configuration (in the Libxklavier terminology).
|
||||||
|
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
|
||||||
|
// */
|
||||||
|
//gboolean
|
||||||
|
//eek_xkl_layout_set_model (EekXklLayout *layout,
|
||||||
|
// const gchar *model)
|
||||||
|
//{
|
||||||
|
// EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||||
|
// XklConfigRec *config;
|
||||||
|
// gboolean retval;
|
||||||
|
//
|
||||||
|
// g_return_val_if_fail (priv, FALSE);
|
||||||
|
// config = xkl_config_rec_new ();
|
||||||
|
// /* config->model will be freed on g_object_unref (config) */
|
||||||
|
// if (model)
|
||||||
|
// config->model = g_strdup (model);
|
||||||
|
// else
|
||||||
|
// config->model = NULL;
|
||||||
|
// retval = eek_xkl_layout_set_config (layout, config);
|
||||||
|
// g_object_unref (config);
|
||||||
|
// return retval;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_set_layouts:
|
||||||
|
// * @layout: an #EekXklLayout
|
||||||
|
// * @layouts: layout names
|
||||||
|
// *
|
||||||
|
// * Set the layout names of @layout (in the Libxklavier terminology).
|
||||||
|
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
|
||||||
|
// */
|
||||||
|
//gboolean
|
||||||
|
//eek_xkl_layout_set_layouts (EekXklLayout *layout,
|
||||||
|
// gchar **layouts)
|
||||||
|
//{
|
||||||
|
// EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||||
|
// XklConfigRec *config;
|
||||||
|
// gboolean retval;
|
||||||
|
//
|
||||||
|
// g_return_val_if_fail (priv, FALSE);
|
||||||
|
// config = xkl_config_rec_new ();
|
||||||
|
// /* config->layouts will be freed on g_object_unref (config) */
|
||||||
|
// if (layouts)
|
||||||
|
// config->layouts = g_strdupv (layouts);
|
||||||
|
// else
|
||||||
|
// config->layouts = layouts;
|
||||||
|
// retval = eek_xkl_layout_set_config (layout, config);
|
||||||
|
// g_object_unref (config);
|
||||||
|
// return retval;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_set_variants:
|
||||||
|
// * @layout: an #EekXklLayout
|
||||||
|
// * @variants: variant names
|
||||||
|
// *
|
||||||
|
// * Set the variant names of @layout (in the Libxklavier terminology).
|
||||||
|
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
|
||||||
|
// */
|
||||||
|
//gboolean
|
||||||
|
//eek_xkl_layout_set_variants (EekXklLayout *layout,
|
||||||
|
// gchar **variants)
|
||||||
|
//{
|
||||||
|
// EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||||
|
// XklConfigRec *config;
|
||||||
|
// gboolean retval;
|
||||||
|
//
|
||||||
|
// g_return_val_if_fail (priv, FALSE);
|
||||||
|
// config = xkl_config_rec_new ();
|
||||||
|
// /* config->variants will be freed on g_object_unref (config) */
|
||||||
|
// if (variants)
|
||||||
|
// config->variants = g_strdupv (variants);
|
||||||
|
// else
|
||||||
|
// config->variants = NULL;
|
||||||
|
// retval = eek_xkl_layout_set_config (layout, config);
|
||||||
|
// g_object_unref (config);
|
||||||
|
// return retval;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_set_options:
|
||||||
|
// * @layout: an #EekXklLayout
|
||||||
|
// * @options: option names
|
||||||
|
// *
|
||||||
|
// * Set the option names of @layout (in the Libxklavier terminology).
|
||||||
|
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
|
||||||
|
// */
|
||||||
|
//gboolean
|
||||||
|
//eek_xkl_layout_set_options (EekXklLayout *layout,
|
||||||
|
// gchar **options)
|
||||||
|
//{
|
||||||
|
// EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||||
|
// XklConfigRec *config;
|
||||||
|
// gboolean retval;
|
||||||
|
//
|
||||||
|
// g_return_val_if_fail (priv, FALSE);
|
||||||
|
// config = xkl_config_rec_new ();
|
||||||
|
// /* config->options will be freed on g_object_unref (config) */
|
||||||
|
// if (options)
|
||||||
|
// config->options = options;
|
||||||
|
// else
|
||||||
|
// config->options = NULL;
|
||||||
|
// retval = eek_xkl_layout_set_config (layout, config);
|
||||||
|
// g_object_unref (config);
|
||||||
|
// return retval;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_enable_option:
|
||||||
|
// * @layout: an #EekXklLayout
|
||||||
|
// * @option: option name
|
||||||
|
// *
|
||||||
|
// * Set the option of @layout (in the Libxklavier terminology).
|
||||||
|
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
|
||||||
|
// */
|
||||||
|
//gboolean
|
||||||
|
//eek_xkl_layout_enable_option (EekXklLayout *layout,
|
||||||
|
// const gchar *option)
|
||||||
|
//{
|
||||||
|
// gchar **options, **_options;
|
||||||
|
// gint i, j;
|
||||||
|
//
|
||||||
|
// options = eek_xkl_layout_get_options (layout);
|
||||||
|
// for (i = 0; options && options[i]; i++)
|
||||||
|
// if (g_strcmp0 (options[i], option) == 0)
|
||||||
|
// return TRUE;
|
||||||
|
// _options = g_new0 (gchar *, (i + 2));
|
||||||
|
// for (j = 0; j < i; j++)
|
||||||
|
// _options[j] = g_strdup (options[j]);
|
||||||
|
// _options[i] = g_strdup (option);
|
||||||
|
// /* eek_xkl_layout_set_options() will free _options and its elements. */
|
||||||
|
// return eek_xkl_layout_set_options (layout, _options);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_disable_option:
|
||||||
|
// * @layout: an #EekXklLayout
|
||||||
|
// * @option: option name
|
||||||
|
// *
|
||||||
|
// * Unset the option of @layout (in the Libxklavier terminology).
|
||||||
|
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
|
||||||
|
// */
|
||||||
|
//gboolean
|
||||||
|
//eek_xkl_layout_disable_option (EekXklLayout *layout,
|
||||||
|
// const gchar *option)
|
||||||
|
//{
|
||||||
|
// gchar **options, **_options;
|
||||||
|
// gint i, j, k;
|
||||||
|
//
|
||||||
|
// options = eek_xkl_layout_get_options (layout);
|
||||||
|
// if (!options)
|
||||||
|
// return TRUE;
|
||||||
|
// for (i = 0, k = 0; options[i]; i++)
|
||||||
|
// if (g_strcmp0 (options[i], option) == 0)
|
||||||
|
// k = i;
|
||||||
|
// if (options[k] == NULL)
|
||||||
|
// return TRUE;
|
||||||
|
// _options = g_new0 (gchar *, i);
|
||||||
|
// for (j = 0; j < k; j++)
|
||||||
|
// _options[j] = g_strdup (options[j]);
|
||||||
|
// for (j = k + 1; j < i; j++)
|
||||||
|
// _options[j] = g_strdup (options[j]);
|
||||||
|
// /* eek_xkl_layout_set_options() will free _options and its elements. */
|
||||||
|
// return eek_xkl_layout_set_options (layout, _options);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_get_model:
|
||||||
|
// * @layout: an #EekXklLayout
|
||||||
|
// *
|
||||||
|
// * Get the model name of @layout configuration (in the Libxklavier terminology).
|
||||||
|
// */
|
||||||
|
//gchar *
|
||||||
|
//eek_xkl_layout_get_model (EekXklLayout *layout)
|
||||||
|
//{
|
||||||
|
// EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||||
|
//
|
||||||
|
// g_return_val_if_fail (priv, NULL);
|
||||||
|
// return g_strdup (priv->config->model);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_get_layouts:
|
||||||
|
// * @layout: an #EekXklLayout
|
||||||
|
// *
|
||||||
|
// * Get the layout names of @layout configuration (in the Libxklavier
|
||||||
|
// * terminology).
|
||||||
|
// */
|
||||||
|
//gchar **
|
||||||
|
//eek_xkl_layout_get_layouts (EekXklLayout *layout)
|
||||||
|
//{
|
||||||
|
// EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||||
|
//
|
||||||
|
// g_return_val_if_fail (priv, NULL);
|
||||||
|
// return g_strdupv (priv->config->layouts);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_get_variants:
|
||||||
|
// * @layout: an #EekXklLayout
|
||||||
|
// *
|
||||||
|
// * Get the variant names of @layout configuration (in the Libxklavier
|
||||||
|
// * terminology).
|
||||||
|
// */
|
||||||
|
//gchar **
|
||||||
|
//eek_xkl_layout_get_variants (EekXklLayout *layout)
|
||||||
|
//{
|
||||||
|
// EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||||
|
//
|
||||||
|
// g_return_val_if_fail (priv, NULL);
|
||||||
|
// return g_strdupv (priv->config->variants);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_get_options:
|
||||||
|
// * @layout: an #EekXklLayout
|
||||||
|
// *
|
||||||
|
// * Get the option names of @layout configuration (in the Libxklavier
|
||||||
|
// * terminology).
|
||||||
|
// */
|
||||||
|
//gchar **
|
||||||
|
//eek_xkl_layout_get_options (EekXklLayout *layout)
|
||||||
|
//{
|
||||||
|
// EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||||
|
//
|
||||||
|
// g_return_val_if_fail (priv, NULL);
|
||||||
|
// return g_strdupv (priv->config->options);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//static gboolean
|
||||||
|
//set_xkb_component_names (EekXklLayout *layout, XklConfigRec *config)
|
||||||
|
//{
|
||||||
|
// EekXklLayoutPrivate *priv = layout->priv;
|
||||||
|
// XkbComponentNamesRec names;
|
||||||
|
// gboolean retval = FALSE;
|
||||||
|
//
|
||||||
|
//#if DEBUG
|
||||||
|
// if (config->layouts) {
|
||||||
|
// gint i;
|
||||||
|
//
|
||||||
|
// fprintf (stderr, "layout = ");
|
||||||
|
// for (i = 0; config->layouts[i] != NULL; i++)
|
||||||
|
// fprintf (stderr, "\"%s\" ", config->layouts[i]);
|
||||||
|
// fputc ('\n', stderr);
|
||||||
|
// } else
|
||||||
|
// fprintf (stderr, "layouts = NULL\n");
|
||||||
|
// if (config->variants) {
|
||||||
|
// gint i;
|
||||||
|
//
|
||||||
|
// fprintf (stderr, "variant = ");
|
||||||
|
// for (i = 0; config->variants[i]; i++)
|
||||||
|
// fprintf (stderr, "\"%s\" ", config->variants[i]);
|
||||||
|
// fputc ('\n', stderr);
|
||||||
|
// } else
|
||||||
|
// fprintf (stderr, "variants = NULL\n");
|
||||||
|
// if (config->options) {
|
||||||
|
// gint i;
|
||||||
|
//
|
||||||
|
// fprintf (stderr, "option = ");
|
||||||
|
// for (i = 0; config->options[i]; i++)
|
||||||
|
// fprintf (stderr, "\"%s\" ", config->options[i]);
|
||||||
|
// fputc ('\n', stderr);
|
||||||
|
// } else
|
||||||
|
// fprintf (stderr, "options = NULL\n");
|
||||||
|
//#endif
|
||||||
|
//
|
||||||
|
// if (xkl_xkb_config_native_prepare (priv->engine, config, &names)) {
|
||||||
|
// GError *error = NULL;
|
||||||
|
// retval = eek_xkb_layout_set_names (EEK_XKB_LAYOUT(layout),
|
||||||
|
// &names,
|
||||||
|
// &error);
|
||||||
|
// if (!retval)
|
||||||
|
// g_warning ("can't set XKB layout");
|
||||||
|
// xkl_xkb_config_native_cleanup (priv->engine, &names);
|
||||||
|
// }
|
||||||
|
// return retval;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * eek_xkl_layout_get_option:
|
||||||
|
// * @layout: an #EekXklLayout
|
||||||
|
// * @option: option name
|
||||||
|
// *
|
||||||
|
// * Tell if the option of @layout (in the Libxklavier terminology) is set.
|
||||||
|
// * Returns: %TRUE if the option is set, %FALSE otherwise
|
||||||
|
// */
|
||||||
|
//gboolean
|
||||||
|
//eek_xkl_layout_get_option (EekXklLayout *layout,
|
||||||
|
// const gchar *option)
|
||||||
|
//{
|
||||||
|
// gchar **options;
|
||||||
|
// gint i;
|
||||||
|
//
|
||||||
|
// options = eek_xkl_layout_get_options (layout);
|
||||||
|
// for (i = 0; options && options[i]; i++)
|
||||||
|
// if (g_strcmp0 (options[i], option) == 0)
|
||||||
|
// return TRUE;
|
||||||
|
// return FALSE;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//static gboolean
|
||||||
|
//initable_init (GInitable *initable,
|
||||||
|
// GCancellable *cancellable,
|
||||||
|
// GError **error)
|
||||||
|
//{
|
||||||
|
// EekXklLayout *layout = EEK_XKL_LAYOUT (initable);
|
||||||
|
// Display *display;
|
||||||
|
//
|
||||||
|
// if (!parent_initable_iface->init (initable, cancellable, error))
|
||||||
|
// return FALSE;
|
||||||
|
//
|
||||||
|
// layout->priv->config = xkl_config_rec_new ();
|
||||||
|
//
|
||||||
|
// g_object_get (G_OBJECT (initable),
|
||||||
|
// "display", &display,
|
||||||
|
// NULL);
|
||||||
|
//
|
||||||
|
// layout->priv->engine = xkl_engine_get_instance (display);
|
||||||
|
//
|
||||||
|
// if (!xkl_config_rec_get_from_server (layout->priv->config,
|
||||||
|
// layout->priv->engine)) {
|
||||||
|
// g_set_error (error,
|
||||||
|
// EEK_ERROR,
|
||||||
|
// EEK_ERROR_LAYOUT_ERROR,
|
||||||
|
// "can't load libxklavier configuration");
|
||||||
|
// return FALSE;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// set_xkb_component_names (layout, layout->priv->config);
|
||||||
|
// return TRUE;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//static void
|
||||||
|
//initable_iface_init (GInitableIface *initable_iface)
|
||||||
|
//{
|
||||||
|
// parent_initable_iface = g_type_interface_peek_parent (initable_iface);
|
||||||
|
// initable_iface->init = initable_init;
|
||||||
|
//}
|
||||||
|
|
||||||
97
eek/eek-wkl-layout.h
Normal file
97
eek/eek-wkl-layout.h
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||||
|
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
|
||||||
|
//#error "Only <eek/eek-xkl.h> can be included directly."
|
||||||
|
//#endif
|
||||||
|
//
|
||||||
|
//#ifndef EEK_XKL_LAYOUT_H
|
||||||
|
//#define EEK_XKL_LAYOUT_H 1
|
||||||
|
//
|
||||||
|
//#include <libxklavier/xklavier.h>
|
||||||
|
//#include "eek-xkb-layout.h"
|
||||||
|
//
|
||||||
|
//G_BEGIN_DECLS
|
||||||
|
//
|
||||||
|
//#define EEK_TYPE_XKL_LAYOUT (eek_xkl_layout_get_type())
|
||||||
|
//#define EEK_XKL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayout))
|
||||||
|
//#define EEK_XKL_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XKL_LAYOUT, EekXklLayoutClass))
|
||||||
|
//#define EEK_IS_XKL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XKL_LAYOUT))
|
||||||
|
//#define EEK_IS_XKL_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XKL_LAYOUT))
|
||||||
|
//#define EEK_XKL_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayoutClass))
|
||||||
|
//
|
||||||
|
//typedef struct _EekXklLayout EekXklLayout;
|
||||||
|
//typedef struct _EekXklLayoutClass EekXklLayoutClass;
|
||||||
|
//typedef struct _EekXklLayoutPrivate EekXklLayoutPrivate;
|
||||||
|
//
|
||||||
|
//struct _EekXklLayout
|
||||||
|
//{
|
||||||
|
// /*< private >*/
|
||||||
|
// EekXkbLayout parent;
|
||||||
|
//
|
||||||
|
// EekXklLayoutPrivate *priv;
|
||||||
|
//};
|
||||||
|
//
|
||||||
|
//struct _EekXklLayoutClass
|
||||||
|
//{
|
||||||
|
// /*< private >*/
|
||||||
|
// EekXkbLayoutClass parent_class;
|
||||||
|
//
|
||||||
|
// /*< private >*/
|
||||||
|
// /* padding */
|
||||||
|
// gpointer pdummy[24];
|
||||||
|
//};
|
||||||
|
//
|
||||||
|
//GType eek_xkl_layout_get_type (void) G_GNUC_CONST;
|
||||||
|
//
|
||||||
|
//EekLayout *eek_xkl_layout_new (Display *display,
|
||||||
|
// GError **error);
|
||||||
|
//
|
||||||
|
//gboolean eek_xkl_layout_set_config (EekXklLayout *layout,
|
||||||
|
// XklConfigRec *config);
|
||||||
|
//
|
||||||
|
//gboolean eek_xkl_layout_set_config_full (EekXklLayout *layout,
|
||||||
|
// gchar *model,
|
||||||
|
// gchar **layouts,
|
||||||
|
// gchar **variants,
|
||||||
|
// gchar **options);
|
||||||
|
//
|
||||||
|
//gboolean eek_xkl_layout_set_model (EekXklLayout *layout,
|
||||||
|
// const gchar *model);
|
||||||
|
//gboolean eek_xkl_layout_set_layouts (EekXklLayout *layout,
|
||||||
|
// gchar **layouts);
|
||||||
|
//gboolean eek_xkl_layout_set_variants (EekXklLayout *layout,
|
||||||
|
// gchar **variants);
|
||||||
|
//gboolean eek_xkl_layout_set_options (EekXklLayout *layout,
|
||||||
|
// gchar **options);
|
||||||
|
//gboolean eek_xkl_layout_enable_option (EekXklLayout *layout,
|
||||||
|
// const gchar *option);
|
||||||
|
//gboolean eek_xkl_layout_disable_option (EekXklLayout *layout,
|
||||||
|
// const gchar *option);
|
||||||
|
//
|
||||||
|
//gchar *eek_xkl_layout_get_model (EekXklLayout *layout);
|
||||||
|
//gchar **eek_xkl_layout_get_layouts (EekXklLayout *layout);
|
||||||
|
//gchar **eek_xkl_layout_get_variants (EekXklLayout *layout);
|
||||||
|
//gchar **eek_xkl_layout_get_options (EekXklLayout *layout);
|
||||||
|
//gboolean eek_xkl_layout_get_option (EekXklLayout *layout,
|
||||||
|
// const gchar *option);
|
||||||
|
//
|
||||||
|
//G_END_DECLS
|
||||||
|
//#endif /* #ifndef EEK_XKL_LAYOUT_H */
|
||||||
@ -17,10 +17,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
* 02110-1301 USA
|
* 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
#ifndef EEK_XKB_H
|
//#ifndef EEK_XKL_H
|
||||||
#define EEK_XKB_H 1
|
//#define EEK_XKL_H 1
|
||||||
|
//
|
||||||
#include "eek.h"
|
//#include "eek.h"
|
||||||
#include "eek-xkb-layout.h"
|
//#include "eek-xkl-layout.h"
|
||||||
|
//
|
||||||
#endif /* EEK_XKB_H */
|
//#endif /* EEK_XKL_H */
|
||||||
@ -1,679 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org>
|
|
||||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
|
||||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:eek-xkb-layout
|
|
||||||
* @short_description: Layout engine using XKB configuration
|
|
||||||
*
|
|
||||||
* The #EekXkbLayout inherits #EekLayout class and arranges keyboard
|
|
||||||
* elements using XKB.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif /* HAVE_CONFIG_H */
|
|
||||||
|
|
||||||
#include <X11/keysym.h>
|
|
||||||
#include <X11/XKBlib.h>
|
|
||||||
#include <X11/extensions/XKBgeom.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <gio/gio.h>
|
|
||||||
|
|
||||||
#include "eek-xkb-layout.h"
|
|
||||||
#include "eek-keyboard.h"
|
|
||||||
#include "eek-section.h"
|
|
||||||
#include "eek-key.h"
|
|
||||||
#include "eek-keysym.h"
|
|
||||||
|
|
||||||
#define XKB_COMPONENT_MASK (XkbGBN_GeometryMask | \
|
|
||||||
XkbGBN_KeyNamesMask | \
|
|
||||||
XkbGBN_OtherNamesMask | \
|
|
||||||
XkbGBN_SymbolsMask | \
|
|
||||||
XkbGBN_IndicatorMapMask)
|
|
||||||
|
|
||||||
static void initable_iface_init (GInitableIface *initable_iface);
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (EekXkbLayout, eek_xkb_layout, EEK_TYPE_LAYOUT,
|
|
||||||
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
|
|
||||||
initable_iface_init));
|
|
||||||
|
|
||||||
#define EEK_XKB_LAYOUT_GET_PRIVATE(obj) \
|
|
||||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutPrivate))
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_DISPLAY,
|
|
||||||
PROP_LAST
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _EekXkbLayoutPrivate
|
|
||||||
{
|
|
||||||
/* Configuration names that should synch'ed to the symbolic names
|
|
||||||
in priv->xkb->names. Since we use GLib's memory allocator,
|
|
||||||
don't store any address returned from the X server here. */
|
|
||||||
XkbComponentNamesRec names;
|
|
||||||
|
|
||||||
Display *display;
|
|
||||||
|
|
||||||
/* Actual XKB configuration of DISPLAY. */
|
|
||||||
XkbDescRec *xkb;
|
|
||||||
|
|
||||||
/* Hash table to cache orefs by shape address. */
|
|
||||||
GHashTable *shape_oref_hash;
|
|
||||||
|
|
||||||
gint scale_numerator;
|
|
||||||
gint scale_denominator;
|
|
||||||
};
|
|
||||||
|
|
||||||
static guint find_keycode (EekXkbLayout *layout,
|
|
||||||
gchar *key_name);
|
|
||||||
|
|
||||||
static gboolean get_keyboard_from_server (EekXkbLayout *layout,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
static gboolean get_names_from_server (EekXkbLayout *layout,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
static void setup_scaling (EekXkbLayout *layout,
|
|
||||||
gdouble width,
|
|
||||||
gdouble height);
|
|
||||||
|
|
||||||
G_INLINE_FUNC gint
|
|
||||||
xkb_to_pixmap_coord (EekXkbLayout *layout,
|
|
||||||
gint n)
|
|
||||||
{
|
|
||||||
EekXkbLayoutPrivate *priv = layout->priv;
|
|
||||||
return n * priv->scale_numerator / priv->scale_denominator;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_INLINE_FUNC gdouble
|
|
||||||
xkb_to_pixmap_double (EekXkbLayout *layout,
|
|
||||||
gdouble d)
|
|
||||||
{
|
|
||||||
EekXkbLayoutPrivate *priv = layout->priv;
|
|
||||||
return d * priv->scale_numerator / priv->scale_denominator;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
create_key (EekXkbLayout *layout,
|
|
||||||
EekKeyboard *keyboard,
|
|
||||||
EekSection *section,
|
|
||||||
gint column,
|
|
||||||
gint row,
|
|
||||||
gdouble x,
|
|
||||||
gdouble y,
|
|
||||||
XkbKeyRec *xkbkey)
|
|
||||||
{
|
|
||||||
XkbGeometryRec *xkbgeometry;
|
|
||||||
XkbBoundsRec *xkbbounds;
|
|
||||||
XkbShapeRec *xkbshape;
|
|
||||||
XkbOutlineRec *xkboutline;
|
|
||||||
EekXkbLayoutPrivate *priv = layout->priv;
|
|
||||||
EekKey *key;
|
|
||||||
EekBounds bounds;
|
|
||||||
EekSymbolMatrix *matrix = NULL;
|
|
||||||
gchar name[XkbKeyNameLength + 1];
|
|
||||||
KeyCode keycode;
|
|
||||||
gint num_groups, num_levels;
|
|
||||||
guint oref;
|
|
||||||
gpointer v;
|
|
||||||
|
|
||||||
xkbgeometry = priv->xkb->geom;
|
|
||||||
xkbshape = &xkbgeometry->shapes[xkbkey->shape_ndx];
|
|
||||||
if (g_hash_table_lookup_extended (priv->shape_oref_hash, xkbshape,
|
|
||||||
NULL, &v)) {
|
|
||||||
oref = GPOINTER_TO_UINT(v);
|
|
||||||
} else {
|
|
||||||
EekOutline *outline;
|
|
||||||
|
|
||||||
xkboutline = xkbshape->primary == NULL ? &xkbshape->outlines[0] :
|
|
||||||
xkbshape->primary;
|
|
||||||
|
|
||||||
outline = g_slice_new (EekOutline);
|
|
||||||
outline->corner_radius = xkb_to_pixmap_coord(layout,
|
|
||||||
xkboutline->corner_radius);
|
|
||||||
|
|
||||||
if (xkboutline->num_points <= 2) { /* rectangular */
|
|
||||||
gdouble x1, y1, x2, y2;
|
|
||||||
|
|
||||||
outline->num_points = 4;
|
|
||||||
outline->points = g_slice_alloc0 (sizeof (EekPoint) *
|
|
||||||
outline->num_points);
|
|
||||||
if (xkboutline->num_points == 1) {
|
|
||||||
x1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.x1);
|
|
||||||
y1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.y1);
|
|
||||||
x2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
|
|
||||||
y2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
|
|
||||||
} else {
|
|
||||||
x1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
|
|
||||||
y1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
|
|
||||||
x2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].x);
|
|
||||||
y2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].y);
|
|
||||||
}
|
|
||||||
outline->points[0].x = outline->points[3].x = x1;
|
|
||||||
outline->points[0].y = outline->points[1].y = y1;
|
|
||||||
outline->points[1].x = outline->points[2].x = x2;
|
|
||||||
outline->points[2].y = outline->points[3].y = y2;
|
|
||||||
} else { /* polygon */
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
outline->num_points = xkboutline->num_points;
|
|
||||||
outline->points = g_new0 (EekPoint, outline->num_points);
|
|
||||||
for (i = 0; i < xkboutline->num_points; i++) {
|
|
||||||
outline->points[i].x =
|
|
||||||
xkb_to_pixmap_coord(layout, xkboutline->points[i].x);
|
|
||||||
outline->points[i].y =
|
|
||||||
xkb_to_pixmap_coord(layout, xkboutline->points[i].y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
oref = eek_keyboard_add_outline (keyboard, outline);
|
|
||||||
eek_outline_free (outline);
|
|
||||||
g_hash_table_insert (priv->shape_oref_hash, xkbshape,
|
|
||||||
GUINT_TO_POINTER(oref));
|
|
||||||
}
|
|
||||||
|
|
||||||
memset (name, 0, sizeof name);
|
|
||||||
memcpy (name, xkbkey->name.name, sizeof name - 1);
|
|
||||||
|
|
||||||
xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
|
|
||||||
bounds.x = xkb_to_pixmap_coord(layout, xkbbounds->x1 + x);
|
|
||||||
bounds.y = xkb_to_pixmap_coord(layout, xkbbounds->y1 + y);
|
|
||||||
bounds.width = xkb_to_pixmap_coord(layout, xkbbounds->x2 - xkbbounds->x1);
|
|
||||||
bounds.height = xkb_to_pixmap_coord(layout, xkbbounds->y2 - xkbbounds->y1);
|
|
||||||
|
|
||||||
keycode = find_keycode (layout, name);
|
|
||||||
if (keycode == EEK_INVALID_KEYCODE) {
|
|
||||||
num_groups = num_levels = 0;
|
|
||||||
matrix = eek_symbol_matrix_new (0, 0);
|
|
||||||
} else {
|
|
||||||
KeySym keysym;
|
|
||||||
gint i, j;
|
|
||||||
|
|
||||||
num_groups = XkbKeyNumGroups (priv->xkb, keycode);
|
|
||||||
num_levels = XkbKeyGroupsWidth (priv->xkb, keycode);
|
|
||||||
matrix = eek_symbol_matrix_new (num_groups, num_levels);
|
|
||||||
for (i = 0; i < num_groups; i++)
|
|
||||||
for (j = 0; j < num_levels; j++) {
|
|
||||||
EekModifierType modifier;
|
|
||||||
|
|
||||||
keysym = XkbKeySymEntry (priv->xkb, keycode, j, i);
|
|
||||||
modifier = XkbKeysymToModifiers (priv->display, keysym);
|
|
||||||
matrix->data[i * num_levels + j] =
|
|
||||||
EEK_SYMBOL(eek_keysym_new_with_modifier (keysym,
|
|
||||||
modifier));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
key = eek_section_create_key (section, keycode, column, row);
|
|
||||||
eek_element_set_name (EEK_ELEMENT(key), name);
|
|
||||||
eek_element_set_bounds (EEK_ELEMENT(key), &bounds);
|
|
||||||
eek_key_set_symbol_matrix (key, matrix);
|
|
||||||
eek_symbol_matrix_free (matrix);
|
|
||||||
eek_key_set_oref (key, oref);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
create_section (EekXkbLayout *layout,
|
|
||||||
EekKeyboard *keyboard,
|
|
||||||
XkbSectionRec *xkbsection)
|
|
||||||
{
|
|
||||||
XkbGeometryRec *xkbgeometry;
|
|
||||||
EekXkbLayoutPrivate *priv;
|
|
||||||
EekSection *section;
|
|
||||||
EekBounds bounds;
|
|
||||||
gchar *name;
|
|
||||||
gfloat left, top;
|
|
||||||
gint i, j;
|
|
||||||
|
|
||||||
bounds.x = xkb_to_pixmap_coord(layout, xkbsection->left);
|
|
||||||
bounds.y = xkb_to_pixmap_coord(layout, xkbsection->top);
|
|
||||||
bounds.width = xkb_to_pixmap_coord(layout, xkbsection->width);
|
|
||||||
bounds.height = xkb_to_pixmap_coord(layout, xkbsection->height);
|
|
||||||
|
|
||||||
priv = layout->priv;
|
|
||||||
xkbgeometry = priv->xkb->geom;
|
|
||||||
section = eek_keyboard_create_section (keyboard);
|
|
||||||
name = XGetAtomName (priv->display, xkbsection->name);
|
|
||||||
eek_element_set_name (EEK_ELEMENT(section), name);
|
|
||||||
XFree (name);
|
|
||||||
eek_element_set_bounds (EEK_ELEMENT(section), &bounds);
|
|
||||||
eek_section_set_angle (section,
|
|
||||||
/* angle is in tenth of degree */
|
|
||||||
xkbsection->angle / 10);
|
|
||||||
|
|
||||||
for (i = 0; i < xkbsection->num_rows; i++) {
|
|
||||||
XkbRowRec *xkbrow;
|
|
||||||
|
|
||||||
xkbrow = &xkbsection->rows[i];
|
|
||||||
left = xkbrow->left;
|
|
||||||
top = xkbrow->top;
|
|
||||||
eek_section_add_row (section,
|
|
||||||
xkbrow->num_keys,
|
|
||||||
xkbrow->vertical ?
|
|
||||||
EEK_ORIENTATION_VERTICAL :
|
|
||||||
EEK_ORIENTATION_HORIZONTAL);
|
|
||||||
for (j = 0; j < xkbrow->num_keys; j++) {
|
|
||||||
XkbKeyRec *xkbkey;
|
|
||||||
XkbBoundsRec *xkbbounds;
|
|
||||||
|
|
||||||
xkbkey = &xkbrow->keys[j];
|
|
||||||
if (xkbrow->vertical)
|
|
||||||
top += xkbkey->gap;
|
|
||||||
else
|
|
||||||
left += xkbkey->gap;
|
|
||||||
create_key (layout, keyboard, section, j, i, left, top, xkbkey);
|
|
||||||
xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
|
|
||||||
if (xkbrow->vertical)
|
|
||||||
top += xkbbounds->y2 - xkbbounds->y1;
|
|
||||||
else
|
|
||||||
left += xkbbounds->x2 - xkbbounds->x1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
create_keyboard (EekXkbLayout *layout, EekKeyboard *keyboard)
|
|
||||||
{
|
|
||||||
EekXkbLayoutPrivate *priv = layout->priv;
|
|
||||||
XkbGeometryRec *xkbgeometry;
|
|
||||||
EekBounds bounds;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
g_return_if_fail (priv->xkb);
|
|
||||||
g_return_if_fail (priv->xkb->geom);
|
|
||||||
|
|
||||||
xkbgeometry = priv->xkb->geom;
|
|
||||||
|
|
||||||
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
|
|
||||||
setup_scaling (EEK_XKB_LAYOUT(layout), bounds.width, bounds.height);
|
|
||||||
|
|
||||||
bounds.x = bounds.y = 0;
|
|
||||||
bounds.width = xkb_to_pixmap_coord(layout, xkbgeometry->width_mm);
|
|
||||||
bounds.height = xkb_to_pixmap_coord(layout, xkbgeometry->height_mm);
|
|
||||||
|
|
||||||
for (i = 0; i < xkbgeometry->num_sections; i++) {
|
|
||||||
XkbSectionRec *xkbsection;
|
|
||||||
|
|
||||||
xkbsection = &xkbgeometry->sections[i];
|
|
||||||
create_section (layout, keyboard, xkbsection);
|
|
||||||
}
|
|
||||||
eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
|
|
||||||
}
|
|
||||||
|
|
||||||
static EekKeyboard *
|
|
||||||
eek_xkb_layout_real_create_keyboard (EekLayout *self,
|
|
||||||
gdouble initial_width,
|
|
||||||
gdouble initial_height)
|
|
||||||
{
|
|
||||||
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (self);
|
|
||||||
EekBounds bounds;
|
|
||||||
EekKeyboard *keyboard;
|
|
||||||
|
|
||||||
keyboard = g_object_new (EEK_TYPE_KEYBOARD, "layout", self, NULL);
|
|
||||||
bounds.x = bounds.y = 0.0;
|
|
||||||
bounds.width = initial_width;
|
|
||||||
bounds.height = initial_height;
|
|
||||||
eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
|
|
||||||
|
|
||||||
/* resolve modifiers dynamically assigned at run time */
|
|
||||||
eek_keyboard_set_num_lock_mask (keyboard,
|
|
||||||
XkbKeysymToModifiers (priv->display,
|
|
||||||
XK_Num_Lock));
|
|
||||||
eek_keyboard_set_alt_gr_mask (keyboard,
|
|
||||||
XkbKeysymToModifiers (priv->display,
|
|
||||||
XK_ISO_Level3_Shift));
|
|
||||||
|
|
||||||
if (priv->shape_oref_hash)
|
|
||||||
g_hash_table_destroy (priv->shape_oref_hash);
|
|
||||||
|
|
||||||
priv->shape_oref_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
|
|
||||||
create_keyboard (EEK_XKB_LAYOUT(self), keyboard);
|
|
||||||
g_hash_table_destroy (priv->shape_oref_hash);
|
|
||||||
|
|
||||||
return keyboard;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_xkb_layout_finalize (GObject *object)
|
|
||||||
{
|
|
||||||
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->names.keycodes);
|
|
||||||
g_free (priv->names.geometry);
|
|
||||||
g_free (priv->names.symbols);
|
|
||||||
XkbFreeKeyboard (priv->xkb, 0, TRUE); /* free_all = TRUE */
|
|
||||||
G_OBJECT_CLASS (eek_xkb_layout_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_xkb_layout_set_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
EekXkbLayout *layout = EEK_XKB_LAYOUT (object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_DISPLAY:
|
|
||||||
layout->priv->display = g_value_get_pointer (value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_xkb_layout_get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
EekXkbLayout *layout = EEK_XKB_LAYOUT (object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_DISPLAY:
|
|
||||||
g_value_set_pointer (value, layout->priv->display);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_xkb_layout_class_init (EekXkbLayoutClass *klass)
|
|
||||||
{
|
|
||||||
EekLayoutClass *layout_class = EEK_LAYOUT_CLASS (klass);
|
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
||||||
GParamSpec *pspec;
|
|
||||||
|
|
||||||
g_type_class_add_private (gobject_class, sizeof (EekXkbLayoutPrivate));
|
|
||||||
|
|
||||||
layout_class->create_keyboard = eek_xkb_layout_real_create_keyboard;
|
|
||||||
|
|
||||||
gobject_class->finalize = eek_xkb_layout_finalize;
|
|
||||||
gobject_class->set_property = eek_xkb_layout_set_property;
|
|
||||||
gobject_class->get_property = eek_xkb_layout_get_property;
|
|
||||||
|
|
||||||
pspec = g_param_spec_pointer ("display",
|
|
||||||
"Display",
|
|
||||||
"X Display",
|
|
||||||
G_PARAM_READWRITE |
|
|
||||||
G_PARAM_CONSTRUCT_ONLY);
|
|
||||||
g_object_class_install_property (gobject_class, PROP_DISPLAY, pspec);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_xkb_layout_init (EekXkbLayout *self)
|
|
||||||
{
|
|
||||||
self->priv = EEK_XKB_LAYOUT_GET_PRIVATE (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
get_names_from_server (EekXkbLayout *layout,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
EekXkbLayoutPrivate *priv = layout->priv;
|
|
||||||
gchar *name;
|
|
||||||
|
|
||||||
XkbGetNames (priv->display, XkbAllNamesMask, priv->xkb);
|
|
||||||
|
|
||||||
if (priv->xkb->names->keycodes <= 0)
|
|
||||||
g_warning ("XKB keycodes setting is not loaded properly");
|
|
||||||
else {
|
|
||||||
name = XGetAtomName (priv->display, priv->xkb->names->keycodes);
|
|
||||||
if (!name)
|
|
||||||
g_warning ("Can't get the name of keycodes");
|
|
||||||
else if (!priv->names.keycodes ||
|
|
||||||
g_strcmp0 (name, priv->names.keycodes)) {
|
|
||||||
g_free (priv->names.keycodes);
|
|
||||||
priv->names.keycodes = g_strdup (name);
|
|
||||||
XFree (name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->xkb->names->geometry <= 0)
|
|
||||||
g_warning ("XKB geometry setting is not loaded");
|
|
||||||
else {
|
|
||||||
name = XGetAtomName (priv->display, priv->xkb->names->geometry);
|
|
||||||
if (!name)
|
|
||||||
g_warning ("Can't get the name of geometry");
|
|
||||||
else if (!priv->names.geometry ||
|
|
||||||
g_strcmp0 (name, priv->names.geometry)) {
|
|
||||||
g_free (priv->names.geometry);
|
|
||||||
priv->names.geometry = g_strdup (name);
|
|
||||||
XFree (name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->xkb->names->symbols <= 0)
|
|
||||||
g_warning ("XKB symbols setting is not loaded");
|
|
||||||
else {
|
|
||||||
name = XGetAtomName (priv->display, priv->xkb->names->symbols);
|
|
||||||
if (!name)
|
|
||||||
g_warning ("Can't get the name of symbols");
|
|
||||||
else if (!priv->names.symbols ||
|
|
||||||
g_strcmp0 (name, priv->names.symbols)) {
|
|
||||||
g_free (priv->names.symbols);
|
|
||||||
priv->names.symbols = g_strdup (name);
|
|
||||||
XFree (name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkb_layout_new:
|
|
||||||
*
|
|
||||||
* Create a new #EekXkbLayout.
|
|
||||||
*/
|
|
||||||
EekLayout *
|
|
||||||
eek_xkb_layout_new (Display *display,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
return (EekLayout *) g_initable_new (EEK_TYPE_XKB_LAYOUT,
|
|
||||||
NULL,
|
|
||||||
error,
|
|
||||||
"display", display,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkb_layout_set_names: (skip)
|
|
||||||
* @layout: an #EekXkbLayout
|
|
||||||
* @names: XKB component names
|
|
||||||
* @error: a #GError
|
|
||||||
*
|
|
||||||
* Set the XKB component names to @layout.
|
|
||||||
* Returns: %TRUE if the component names are successfully set, %FALSE otherwise
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
eek_xkb_layout_set_names (EekXkbLayout *layout,
|
|
||||||
XkbComponentNamesRec *names,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
if (g_strcmp0 (names->keycodes, layout->priv->names.keycodes)) {
|
|
||||||
g_free (layout->priv->names.keycodes);
|
|
||||||
layout->priv->names.keycodes = g_strdup (names->keycodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_strcmp0 (names->geometry, layout->priv->names.geometry)) {
|
|
||||||
g_free (layout->priv->names.geometry);
|
|
||||||
layout->priv->names.geometry = g_strdup (names->geometry);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_strcmp0 (names->symbols, layout->priv->names.symbols)) {
|
|
||||||
g_free (layout->priv->names.symbols);
|
|
||||||
layout->priv->names.symbols = g_strdup (names->symbols);
|
|
||||||
}
|
|
||||||
|
|
||||||
return get_keyboard_from_server (layout, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
get_keyboard_from_server (EekXkbLayout *layout,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
EekXkbLayoutPrivate *priv = layout->priv;
|
|
||||||
|
|
||||||
if (priv->xkb) {
|
|
||||||
XkbFreeKeyboard (priv->xkb, 0, True);
|
|
||||||
priv->xkb = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->names.keycodes && priv->names.geometry && priv->names.symbols) {
|
|
||||||
priv->xkb = XkbGetKeyboardByName (priv->display,
|
|
||||||
XkbUseCoreKbd,
|
|
||||||
&priv->names,
|
|
||||||
0,
|
|
||||||
XKB_COMPONENT_MASK,
|
|
||||||
False);
|
|
||||||
} else {
|
|
||||||
priv->xkb = XkbGetKeyboard (priv->display,
|
|
||||||
XKB_COMPONENT_MASK,
|
|
||||||
XkbUseCoreKbd);
|
|
||||||
if (!get_names_from_server (layout, error)) {
|
|
||||||
XkbFreeKeyboard (priv->xkb, 0, True);
|
|
||||||
priv->xkb = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->xkb == NULL) {
|
|
||||||
g_set_error (error,
|
|
||||||
EEK_ERROR,
|
|
||||||
EEK_ERROR_LAYOUT_ERROR,
|
|
||||||
"can't get keyboard from server");
|
|
||||||
g_free (priv->names.keycodes);
|
|
||||||
priv->names.keycodes = NULL;
|
|
||||||
g_free (priv->names.geometry);
|
|
||||||
priv->names.geometry = NULL;
|
|
||||||
g_free (priv->names.symbols);
|
|
||||||
priv->names.symbols = NULL;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static guint
|
|
||||||
find_keycode (EekXkbLayout *layout, gchar *key_name)
|
|
||||||
{
|
|
||||||
#define KEYSYM_NAME_MAX_LENGTH 4
|
|
||||||
guint keycode;
|
|
||||||
gint i, j;
|
|
||||||
XkbKeyNamePtr pkey;
|
|
||||||
XkbKeyAliasPtr palias;
|
|
||||||
guint is_name_matched;
|
|
||||||
gchar *src, *dst;
|
|
||||||
EekXkbLayoutPrivate *priv = layout->priv;
|
|
||||||
|
|
||||||
if (!priv->xkb)
|
|
||||||
return EEK_INVALID_KEYCODE;
|
|
||||||
|
|
||||||
pkey = priv->xkb->names->keys + priv->xkb->min_key_code;
|
|
||||||
for (keycode = priv->xkb->min_key_code;
|
|
||||||
keycode <= priv->xkb->max_key_code; keycode++) {
|
|
||||||
is_name_matched = 1;
|
|
||||||
src = key_name;
|
|
||||||
dst = pkey->name;
|
|
||||||
for (i = KEYSYM_NAME_MAX_LENGTH; --i >= 0;) {
|
|
||||||
if ('\0' == *src)
|
|
||||||
break;
|
|
||||||
if (*src++ != *dst++) {
|
|
||||||
is_name_matched = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (is_name_matched)
|
|
||||||
return keycode;
|
|
||||||
pkey++;
|
|
||||||
}
|
|
||||||
|
|
||||||
palias = priv->xkb->names->key_aliases;
|
|
||||||
for (j = priv->xkb->names->num_key_aliases; --j >= 0;) {
|
|
||||||
is_name_matched = 1;
|
|
||||||
src = key_name;
|
|
||||||
dst = palias->alias;
|
|
||||||
for (i = KEYSYM_NAME_MAX_LENGTH; --i >= 0;) {
|
|
||||||
if ('\0' == *src)
|
|
||||||
break;
|
|
||||||
if (*src++ != *dst++) {
|
|
||||||
is_name_matched = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_name_matched) {
|
|
||||||
keycode = find_keycode (layout, palias->real);
|
|
||||||
return keycode;
|
|
||||||
}
|
|
||||||
palias++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EEK_INVALID_KEYCODE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
setup_scaling (EekXkbLayout *layout,
|
|
||||||
gdouble width,
|
|
||||||
gdouble height)
|
|
||||||
{
|
|
||||||
EekXkbLayoutPrivate *priv = layout->priv;
|
|
||||||
|
|
||||||
g_return_if_fail (priv->xkb);
|
|
||||||
|
|
||||||
g_return_if_fail (priv->xkb->geom->width_mm > 0);
|
|
||||||
g_return_if_fail (priv->xkb->geom->height_mm > 0);
|
|
||||||
|
|
||||||
if (width * priv->xkb->geom->height_mm <
|
|
||||||
height * priv->xkb->geom->width_mm) {
|
|
||||||
priv->scale_numerator = width;
|
|
||||||
priv->scale_denominator = priv->xkb->geom->width_mm;
|
|
||||||
} else {
|
|
||||||
priv->scale_numerator = height;
|
|
||||||
priv->scale_denominator = priv->xkb->geom->height_mm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
initable_init (GInitable *initable,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
EekXkbLayout *layout = EEK_XKB_LAYOUT (initable);
|
|
||||||
|
|
||||||
if (!get_keyboard_from_server (layout, error))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (!get_names_from_server (layout, error))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
initable_iface_init (GInitableIface *initable_iface)
|
|
||||||
{
|
|
||||||
initable_iface->init = initable_init;
|
|
||||||
}
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
|
||||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
|
|
||||||
#error "Only <eek/eek-xkb.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EEK_XKB_LAYOUT_H
|
|
||||||
#define EEK_XKB_LAYOUT_H 1
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/XKBlib.h>
|
|
||||||
#include "eek-layout.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define EEK_TYPE_XKB_LAYOUT (eek_xkb_layout_get_type())
|
|
||||||
#define EEK_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayout))
|
|
||||||
#define EEK_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
|
|
||||||
#define EEK_IS_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XKB_LAYOUT))
|
|
||||||
#define EEK_IS_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XKB_LAYOUT))
|
|
||||||
#define EEK_XKB_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
|
|
||||||
|
|
||||||
typedef struct _EekXkbLayout EekXkbLayout;
|
|
||||||
typedef struct _EekXkbLayoutClass EekXkbLayoutClass;
|
|
||||||
typedef struct _EekXkbLayoutPrivate EekXkbLayoutPrivate;
|
|
||||||
|
|
||||||
struct _EekXkbLayout
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
EekLayout parent;
|
|
||||||
|
|
||||||
EekXkbLayoutPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _EekXkbLayoutClass
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
EekLayoutClass parent_class;
|
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
/* padding */
|
|
||||||
gpointer pdummy[24];
|
|
||||||
};
|
|
||||||
|
|
||||||
GType eek_xkb_layout_get_type (void) G_GNUC_CONST;
|
|
||||||
EekLayout *eek_xkb_layout_new (Display *display,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean eek_xkb_layout_set_names (EekXkbLayout *layout,
|
|
||||||
XkbComponentNamesRec *names,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
#endif /* #ifndef EEK_XKB_LAYOUT_H */
|
|
||||||
@ -1,663 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
|
||||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:eek-xkl-layout
|
|
||||||
* @short_description: Layout engine using Libxklavier configuration
|
|
||||||
*
|
|
||||||
* The #EekXklLayout is a simple wrapper around #EekXkbLayout class
|
|
||||||
* to use Libxklavier configuration.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif /* HAVE_CONFIG_H */
|
|
||||||
|
|
||||||
#include <libxklavier/xklavier.h>
|
|
||||||
#include <gio/gio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "eek-xkl-layout.h"
|
|
||||||
|
|
||||||
#define noKBDRAW_DEBUG
|
|
||||||
|
|
||||||
static GInitableIface *parent_initable_iface;
|
|
||||||
|
|
||||||
static void initable_iface_init (GInitableIface *initable_iface);
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (EekXklLayout, eek_xkl_layout, EEK_TYPE_XKB_LAYOUT,
|
|
||||||
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
|
|
||||||
initable_iface_init));
|
|
||||||
|
|
||||||
#define EEK_XKL_LAYOUT_GET_PRIVATE(obj) \
|
|
||||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayoutPrivate))
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_MODEL,
|
|
||||||
PROP_LAYOUTS,
|
|
||||||
PROP_VARIANTS,
|
|
||||||
PROP_OPTIONS,
|
|
||||||
PROP_LAST
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _EekXklLayoutPrivate
|
|
||||||
{
|
|
||||||
XklEngine *engine;
|
|
||||||
XklConfigRec *config;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* from gnome-keyboard-properties-xkbpv.c:
|
|
||||||
* BAD STYLE: Taken from xklavier_private_xkb.h
|
|
||||||
* Any ideas on architectural improvements are WELCOME
|
|
||||||
*/
|
|
||||||
extern gboolean xkl_xkb_config_native_prepare (XklEngine * engine,
|
|
||||||
const XklConfigRec * data,
|
|
||||||
XkbComponentNamesPtr
|
|
||||||
component_names);
|
|
||||||
|
|
||||||
extern void xkl_xkb_config_native_cleanup (XklEngine * engine,
|
|
||||||
XkbComponentNamesPtr
|
|
||||||
component_names);
|
|
||||||
|
|
||||||
static gboolean set_xkb_component_names (EekXklLayout *layout,
|
|
||||||
XklConfigRec *config);
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_xkl_layout_dispose (GObject *object)
|
|
||||||
{
|
|
||||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
if (priv->config) {
|
|
||||||
g_object_unref (priv->config);
|
|
||||||
priv->config = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (eek_xkl_layout_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_xkl_layout_set_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
EekXklLayout *layout = EEK_XKL_LAYOUT(object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_MODEL:
|
|
||||||
eek_xkl_layout_set_model (layout, g_value_get_string (value));
|
|
||||||
break;
|
|
||||||
case PROP_LAYOUTS:
|
|
||||||
eek_xkl_layout_set_layouts (layout, g_value_get_boxed (value));
|
|
||||||
break;
|
|
||||||
case PROP_VARIANTS:
|
|
||||||
eek_xkl_layout_set_variants (layout, g_value_get_boxed (value));
|
|
||||||
break;
|
|
||||||
case PROP_OPTIONS:
|
|
||||||
eek_xkl_layout_set_options (layout, g_value_get_boxed (value));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_xkl_layout_get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
EekXklLayout *layout = EEK_XKL_LAYOUT(object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_MODEL:
|
|
||||||
g_value_set_string (value,
|
|
||||||
eek_xkl_layout_get_model (layout));
|
|
||||||
break;
|
|
||||||
case PROP_LAYOUTS:
|
|
||||||
g_value_set_boxed (value,
|
|
||||||
eek_xkl_layout_get_layouts (layout));
|
|
||||||
break;
|
|
||||||
case PROP_VARIANTS:
|
|
||||||
g_value_set_boxed (value,
|
|
||||||
eek_xkl_layout_get_variants (layout));
|
|
||||||
break;
|
|
||||||
case PROP_OPTIONS:
|
|
||||||
g_value_set_boxed (value,
|
|
||||||
eek_xkl_layout_get_options (layout));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_xkl_layout_class_init (EekXklLayoutClass *klass)
|
|
||||||
{
|
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
||||||
GParamSpec *pspec;
|
|
||||||
|
|
||||||
g_type_class_add_private (gobject_class, sizeof (EekXklLayoutPrivate));
|
|
||||||
|
|
||||||
gobject_class->dispose = eek_xkl_layout_dispose;
|
|
||||||
gobject_class->set_property = eek_xkl_layout_set_property;
|
|
||||||
gobject_class->get_property = eek_xkl_layout_get_property;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* EekXklLayout:model:
|
|
||||||
*
|
|
||||||
* The libxklavier model name of #EekXklLayout.
|
|
||||||
*/
|
|
||||||
pspec = g_param_spec_string ("model",
|
|
||||||
"Model",
|
|
||||||
"Libxklavier model",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READWRITE);
|
|
||||||
g_object_class_install_property (gobject_class, PROP_MODEL, pspec);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* EekXklLayout:layouts:
|
|
||||||
*
|
|
||||||
* The libxklavier layout names of #EekXklLayout.
|
|
||||||
*/
|
|
||||||
pspec = g_param_spec_boxed ("layouts",
|
|
||||||
"Layouts",
|
|
||||||
"Libxklavier layouts",
|
|
||||||
G_TYPE_STRV,
|
|
||||||
G_PARAM_READWRITE);
|
|
||||||
g_object_class_install_property (gobject_class, PROP_LAYOUTS, pspec);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* EekXklLayout:variants:
|
|
||||||
*
|
|
||||||
* The libxklavier variant names of #EekXklLayout.
|
|
||||||
*/
|
|
||||||
pspec = g_param_spec_boxed ("variants",
|
|
||||||
"Variants",
|
|
||||||
"Libxklavier variants",
|
|
||||||
G_TYPE_STRV,
|
|
||||||
G_PARAM_READWRITE);
|
|
||||||
g_object_class_install_property (gobject_class, PROP_VARIANTS, pspec);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* EekXklLayout:options:
|
|
||||||
*
|
|
||||||
* The libxklavier option names of #EekXklLayout.
|
|
||||||
*/
|
|
||||||
pspec = g_param_spec_boxed ("options",
|
|
||||||
"Options",
|
|
||||||
"Libxklavier options",
|
|
||||||
G_TYPE_STRV,
|
|
||||||
G_PARAM_READWRITE);
|
|
||||||
g_object_class_install_property (gobject_class, PROP_OPTIONS, pspec);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eek_xkl_layout_init (EekXklLayout *self)
|
|
||||||
{
|
|
||||||
self->priv = EEK_XKL_LAYOUT_GET_PRIVATE (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_new:
|
|
||||||
*
|
|
||||||
* Create a new #EekXklLayout.
|
|
||||||
*/
|
|
||||||
EekLayout *
|
|
||||||
eek_xkl_layout_new (Display *display, GError **error)
|
|
||||||
{
|
|
||||||
return (EekLayout *) g_initable_new (EEK_TYPE_XKL_LAYOUT,
|
|
||||||
NULL,
|
|
||||||
error,
|
|
||||||
"display", display,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
G_INLINE_FUNC void
|
|
||||||
merge_xkl_config_rec (XklConfigRec *dst, XklConfigRec *src)
|
|
||||||
{
|
|
||||||
if (src->model) {
|
|
||||||
g_free (dst->model);
|
|
||||||
dst->model = g_strdup (src->model);
|
|
||||||
}
|
|
||||||
if (src->layouts) {
|
|
||||||
g_strfreev (dst->layouts);
|
|
||||||
dst->layouts = g_strdupv (src->layouts);
|
|
||||||
}
|
|
||||||
if (src->variants) {
|
|
||||||
g_strfreev (dst->variants);
|
|
||||||
dst->variants = g_strdupv (src->variants);
|
|
||||||
}
|
|
||||||
if (src->options) {
|
|
||||||
g_strfreev (dst->options);
|
|
||||||
dst->options = g_strdupv (src->options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_set_config: (skip)
|
|
||||||
* @layout: an #EekXklLayout
|
|
||||||
* @config: Libxklavier configuration
|
|
||||||
*
|
|
||||||
* Reconfigure @layout with @config.
|
|
||||||
* Returns: %TRUE if the current layout changed, %FALSE otherwise
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
eek_xkl_layout_set_config (EekXklLayout *layout,
|
|
||||||
XklConfigRec *config)
|
|
||||||
{
|
|
||||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
|
||||||
XklConfigRec *c;
|
|
||||||
gboolean retval;
|
|
||||||
|
|
||||||
g_return_val_if_fail (priv, FALSE);
|
|
||||||
c = xkl_config_rec_new ();
|
|
||||||
merge_xkl_config_rec (c, priv->config);
|
|
||||||
merge_xkl_config_rec (c, config);
|
|
||||||
retval = set_xkb_component_names (layout, c);
|
|
||||||
g_object_unref (c);
|
|
||||||
merge_xkl_config_rec (priv->config, config);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_set_config_full:
|
|
||||||
* @layout: an #EekXklLayout
|
|
||||||
* @model: Libxklavier model name
|
|
||||||
* @layouts: Libxklavier layouts
|
|
||||||
* @variants: Libxklavier variants
|
|
||||||
* @options: Libxklavier options
|
|
||||||
*
|
|
||||||
* Reconfigure @layout with @model, @layouts, @variants, and @options.
|
|
||||||
* This function is merely a wrapper around
|
|
||||||
* eek_xkl_layout_set_config() to avoid passing a pointer of
|
|
||||||
* XklConfigRec, which is not currently available in the
|
|
||||||
* gobject-introspection repository.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the current layout changed, %FALSE otherwise
|
|
||||||
* Since: 0.0.2
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
eek_xkl_layout_set_config_full (EekXklLayout *layout,
|
|
||||||
gchar *model,
|
|
||||||
gchar **layouts,
|
|
||||||
gchar **variants,
|
|
||||||
gchar **options)
|
|
||||||
{
|
|
||||||
XklConfigRec *config;
|
|
||||||
gboolean retval;
|
|
||||||
|
|
||||||
config = xkl_config_rec_new ();
|
|
||||||
config->model = g_strdup (model);
|
|
||||||
config->layouts = g_strdupv (layouts);
|
|
||||||
config->variants = g_strdupv (variants);
|
|
||||||
config->options = g_strdupv (options);
|
|
||||||
retval = eek_xkl_layout_set_config (layout, config);
|
|
||||||
g_object_unref (config);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_set_model:
|
|
||||||
* @layout: an #EekXklLayout
|
|
||||||
* @model: model name
|
|
||||||
*
|
|
||||||
* Set the model name of @layout configuration (in the Libxklavier terminology).
|
|
||||||
* Returns: %TRUE if the current layout changed, %FALSE otherwise
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
eek_xkl_layout_set_model (EekXklLayout *layout,
|
|
||||||
const gchar *model)
|
|
||||||
{
|
|
||||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
|
||||||
XklConfigRec *config;
|
|
||||||
gboolean retval;
|
|
||||||
|
|
||||||
g_return_val_if_fail (priv, FALSE);
|
|
||||||
config = xkl_config_rec_new ();
|
|
||||||
/* config->model will be freed on g_object_unref (config) */
|
|
||||||
if (model)
|
|
||||||
config->model = g_strdup (model);
|
|
||||||
else
|
|
||||||
config->model = NULL;
|
|
||||||
retval = eek_xkl_layout_set_config (layout, config);
|
|
||||||
g_object_unref (config);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_set_layouts:
|
|
||||||
* @layout: an #EekXklLayout
|
|
||||||
* @layouts: layout names
|
|
||||||
*
|
|
||||||
* Set the layout names of @layout (in the Libxklavier terminology).
|
|
||||||
* Returns: %TRUE if the current layout changed, %FALSE otherwise
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
eek_xkl_layout_set_layouts (EekXklLayout *layout,
|
|
||||||
gchar **layouts)
|
|
||||||
{
|
|
||||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
|
||||||
XklConfigRec *config;
|
|
||||||
gboolean retval;
|
|
||||||
|
|
||||||
g_return_val_if_fail (priv, FALSE);
|
|
||||||
config = xkl_config_rec_new ();
|
|
||||||
/* config->layouts will be freed on g_object_unref (config) */
|
|
||||||
if (layouts)
|
|
||||||
config->layouts = g_strdupv (layouts);
|
|
||||||
else
|
|
||||||
config->layouts = layouts;
|
|
||||||
retval = eek_xkl_layout_set_config (layout, config);
|
|
||||||
g_object_unref (config);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_set_variants:
|
|
||||||
* @layout: an #EekXklLayout
|
|
||||||
* @variants: variant names
|
|
||||||
*
|
|
||||||
* Set the variant names of @layout (in the Libxklavier terminology).
|
|
||||||
* Returns: %TRUE if the current layout changed, %FALSE otherwise
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
eek_xkl_layout_set_variants (EekXklLayout *layout,
|
|
||||||
gchar **variants)
|
|
||||||
{
|
|
||||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
|
||||||
XklConfigRec *config;
|
|
||||||
gboolean retval;
|
|
||||||
|
|
||||||
g_return_val_if_fail (priv, FALSE);
|
|
||||||
config = xkl_config_rec_new ();
|
|
||||||
/* config->variants will be freed on g_object_unref (config) */
|
|
||||||
if (variants)
|
|
||||||
config->variants = g_strdupv (variants);
|
|
||||||
else
|
|
||||||
config->variants = NULL;
|
|
||||||
retval = eek_xkl_layout_set_config (layout, config);
|
|
||||||
g_object_unref (config);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_set_options:
|
|
||||||
* @layout: an #EekXklLayout
|
|
||||||
* @options: option names
|
|
||||||
*
|
|
||||||
* Set the option names of @layout (in the Libxklavier terminology).
|
|
||||||
* Returns: %TRUE if the current layout changed, %FALSE otherwise
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
eek_xkl_layout_set_options (EekXklLayout *layout,
|
|
||||||
gchar **options)
|
|
||||||
{
|
|
||||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
|
||||||
XklConfigRec *config;
|
|
||||||
gboolean retval;
|
|
||||||
|
|
||||||
g_return_val_if_fail (priv, FALSE);
|
|
||||||
config = xkl_config_rec_new ();
|
|
||||||
/* config->options will be freed on g_object_unref (config) */
|
|
||||||
if (options)
|
|
||||||
config->options = options;
|
|
||||||
else
|
|
||||||
config->options = NULL;
|
|
||||||
retval = eek_xkl_layout_set_config (layout, config);
|
|
||||||
g_object_unref (config);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_enable_option:
|
|
||||||
* @layout: an #EekXklLayout
|
|
||||||
* @option: option name
|
|
||||||
*
|
|
||||||
* Set the option of @layout (in the Libxklavier terminology).
|
|
||||||
* Returns: %TRUE if the current layout changed, %FALSE otherwise
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
eek_xkl_layout_enable_option (EekXklLayout *layout,
|
|
||||||
const gchar *option)
|
|
||||||
{
|
|
||||||
gchar **options, **_options;
|
|
||||||
gint i, j;
|
|
||||||
|
|
||||||
options = eek_xkl_layout_get_options (layout);
|
|
||||||
for (i = 0; options && options[i]; i++)
|
|
||||||
if (g_strcmp0 (options[i], option) == 0)
|
|
||||||
return TRUE;
|
|
||||||
_options = g_new0 (gchar *, (i + 2));
|
|
||||||
for (j = 0; j < i; j++)
|
|
||||||
_options[j] = g_strdup (options[j]);
|
|
||||||
_options[i] = g_strdup (option);
|
|
||||||
/* eek_xkl_layout_set_options() will free _options and its elements. */
|
|
||||||
return eek_xkl_layout_set_options (layout, _options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_disable_option:
|
|
||||||
* @layout: an #EekXklLayout
|
|
||||||
* @option: option name
|
|
||||||
*
|
|
||||||
* Unset the option of @layout (in the Libxklavier terminology).
|
|
||||||
* Returns: %TRUE if the current layout changed, %FALSE otherwise
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
eek_xkl_layout_disable_option (EekXklLayout *layout,
|
|
||||||
const gchar *option)
|
|
||||||
{
|
|
||||||
gchar **options, **_options;
|
|
||||||
gint i, j, k;
|
|
||||||
|
|
||||||
options = eek_xkl_layout_get_options (layout);
|
|
||||||
if (!options)
|
|
||||||
return TRUE;
|
|
||||||
for (i = 0, k = 0; options[i]; i++)
|
|
||||||
if (g_strcmp0 (options[i], option) == 0)
|
|
||||||
k = i;
|
|
||||||
if (options[k] == NULL)
|
|
||||||
return TRUE;
|
|
||||||
_options = g_new0 (gchar *, i);
|
|
||||||
for (j = 0; j < k; j++)
|
|
||||||
_options[j] = g_strdup (options[j]);
|
|
||||||
for (j = k + 1; j < i; j++)
|
|
||||||
_options[j] = g_strdup (options[j]);
|
|
||||||
/* eek_xkl_layout_set_options() will free _options and its elements. */
|
|
||||||
return eek_xkl_layout_set_options (layout, _options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_get_model:
|
|
||||||
* @layout: an #EekXklLayout
|
|
||||||
*
|
|
||||||
* Get the model name of @layout configuration (in the Libxklavier terminology).
|
|
||||||
*/
|
|
||||||
gchar *
|
|
||||||
eek_xkl_layout_get_model (EekXklLayout *layout)
|
|
||||||
{
|
|
||||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
|
||||||
|
|
||||||
g_return_val_if_fail (priv, NULL);
|
|
||||||
return g_strdup (priv->config->model);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_get_layouts:
|
|
||||||
* @layout: an #EekXklLayout
|
|
||||||
*
|
|
||||||
* Get the layout names of @layout configuration (in the Libxklavier
|
|
||||||
* terminology).
|
|
||||||
*/
|
|
||||||
gchar **
|
|
||||||
eek_xkl_layout_get_layouts (EekXklLayout *layout)
|
|
||||||
{
|
|
||||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
|
||||||
|
|
||||||
g_return_val_if_fail (priv, NULL);
|
|
||||||
return g_strdupv (priv->config->layouts);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_get_variants:
|
|
||||||
* @layout: an #EekXklLayout
|
|
||||||
*
|
|
||||||
* Get the variant names of @layout configuration (in the Libxklavier
|
|
||||||
* terminology).
|
|
||||||
*/
|
|
||||||
gchar **
|
|
||||||
eek_xkl_layout_get_variants (EekXklLayout *layout)
|
|
||||||
{
|
|
||||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
|
||||||
|
|
||||||
g_return_val_if_fail (priv, NULL);
|
|
||||||
return g_strdupv (priv->config->variants);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_get_options:
|
|
||||||
* @layout: an #EekXklLayout
|
|
||||||
*
|
|
||||||
* Get the option names of @layout configuration (in the Libxklavier
|
|
||||||
* terminology).
|
|
||||||
*/
|
|
||||||
gchar **
|
|
||||||
eek_xkl_layout_get_options (EekXklLayout *layout)
|
|
||||||
{
|
|
||||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
|
||||||
|
|
||||||
g_return_val_if_fail (priv, NULL);
|
|
||||||
return g_strdupv (priv->config->options);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
set_xkb_component_names (EekXklLayout *layout, XklConfigRec *config)
|
|
||||||
{
|
|
||||||
EekXklLayoutPrivate *priv = layout->priv;
|
|
||||||
XkbComponentNamesRec names;
|
|
||||||
gboolean retval = FALSE;
|
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
if (config->layouts) {
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fprintf (stderr, "layout = ");
|
|
||||||
for (i = 0; config->layouts[i] != NULL; i++)
|
|
||||||
fprintf (stderr, "\"%s\" ", config->layouts[i]);
|
|
||||||
fputc ('\n', stderr);
|
|
||||||
} else
|
|
||||||
fprintf (stderr, "layouts = NULL\n");
|
|
||||||
if (config->variants) {
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fprintf (stderr, "variant = ");
|
|
||||||
for (i = 0; config->variants[i]; i++)
|
|
||||||
fprintf (stderr, "\"%s\" ", config->variants[i]);
|
|
||||||
fputc ('\n', stderr);
|
|
||||||
} else
|
|
||||||
fprintf (stderr, "variants = NULL\n");
|
|
||||||
if (config->options) {
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
fprintf (stderr, "option = ");
|
|
||||||
for (i = 0; config->options[i]; i++)
|
|
||||||
fprintf (stderr, "\"%s\" ", config->options[i]);
|
|
||||||
fputc ('\n', stderr);
|
|
||||||
} else
|
|
||||||
fprintf (stderr, "options = NULL\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (xkl_xkb_config_native_prepare (priv->engine, config, &names)) {
|
|
||||||
GError *error = NULL;
|
|
||||||
retval = eek_xkb_layout_set_names (EEK_XKB_LAYOUT(layout),
|
|
||||||
&names,
|
|
||||||
&error);
|
|
||||||
if (!retval)
|
|
||||||
g_warning ("can't set XKB layout");
|
|
||||||
xkl_xkb_config_native_cleanup (priv->engine, &names);
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* eek_xkl_layout_get_option:
|
|
||||||
* @layout: an #EekXklLayout
|
|
||||||
* @option: option name
|
|
||||||
*
|
|
||||||
* Tell if the option of @layout (in the Libxklavier terminology) is set.
|
|
||||||
* Returns: %TRUE if the option is set, %FALSE otherwise
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
eek_xkl_layout_get_option (EekXklLayout *layout,
|
|
||||||
const gchar *option)
|
|
||||||
{
|
|
||||||
gchar **options;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
options = eek_xkl_layout_get_options (layout);
|
|
||||||
for (i = 0; options && options[i]; i++)
|
|
||||||
if (g_strcmp0 (options[i], option) == 0)
|
|
||||||
return TRUE;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
initable_init (GInitable *initable,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
EekXklLayout *layout = EEK_XKL_LAYOUT (initable);
|
|
||||||
Display *display;
|
|
||||||
|
|
||||||
if (!parent_initable_iface->init (initable, cancellable, error))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
layout->priv->config = xkl_config_rec_new ();
|
|
||||||
|
|
||||||
g_object_get (G_OBJECT (initable),
|
|
||||||
"display", &display,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
layout->priv->engine = xkl_engine_get_instance (display);
|
|
||||||
|
|
||||||
if (!xkl_config_rec_get_from_server (layout->priv->config,
|
|
||||||
layout->priv->engine)) {
|
|
||||||
g_set_error (error,
|
|
||||||
EEK_ERROR,
|
|
||||||
EEK_ERROR_LAYOUT_ERROR,
|
|
||||||
"can't load libxklavier configuration");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_xkb_component_names (layout, layout->priv->config);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
initable_iface_init (GInitableIface *initable_iface)
|
|
||||||
{
|
|
||||||
parent_initable_iface = g_type_interface_peek_parent (initable_iface);
|
|
||||||
initable_iface->init = initable_init;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
|
||||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
|
|
||||||
#error "Only <eek/eek-xkl.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EEK_XKL_LAYOUT_H
|
|
||||||
#define EEK_XKL_LAYOUT_H 1
|
|
||||||
|
|
||||||
#include <libxklavier/xklavier.h>
|
|
||||||
#include "eek-xkb-layout.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define EEK_TYPE_XKL_LAYOUT (eek_xkl_layout_get_type())
|
|
||||||
#define EEK_XKL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayout))
|
|
||||||
#define EEK_XKL_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XKL_LAYOUT, EekXklLayoutClass))
|
|
||||||
#define EEK_IS_XKL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XKL_LAYOUT))
|
|
||||||
#define EEK_IS_XKL_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XKL_LAYOUT))
|
|
||||||
#define EEK_XKL_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayoutClass))
|
|
||||||
|
|
||||||
typedef struct _EekXklLayout EekXklLayout;
|
|
||||||
typedef struct _EekXklLayoutClass EekXklLayoutClass;
|
|
||||||
typedef struct _EekXklLayoutPrivate EekXklLayoutPrivate;
|
|
||||||
|
|
||||||
struct _EekXklLayout
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
EekXkbLayout parent;
|
|
||||||
|
|
||||||
EekXklLayoutPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _EekXklLayoutClass
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
EekXkbLayoutClass parent_class;
|
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
/* padding */
|
|
||||||
gpointer pdummy[24];
|
|
||||||
};
|
|
||||||
|
|
||||||
GType eek_xkl_layout_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
EekLayout *eek_xkl_layout_new (Display *display,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean eek_xkl_layout_set_config (EekXklLayout *layout,
|
|
||||||
XklConfigRec *config);
|
|
||||||
|
|
||||||
gboolean eek_xkl_layout_set_config_full (EekXklLayout *layout,
|
|
||||||
gchar *model,
|
|
||||||
gchar **layouts,
|
|
||||||
gchar **variants,
|
|
||||||
gchar **options);
|
|
||||||
|
|
||||||
gboolean eek_xkl_layout_set_model (EekXklLayout *layout,
|
|
||||||
const gchar *model);
|
|
||||||
gboolean eek_xkl_layout_set_layouts (EekXklLayout *layout,
|
|
||||||
gchar **layouts);
|
|
||||||
gboolean eek_xkl_layout_set_variants (EekXklLayout *layout,
|
|
||||||
gchar **variants);
|
|
||||||
gboolean eek_xkl_layout_set_options (EekXklLayout *layout,
|
|
||||||
gchar **options);
|
|
||||||
gboolean eek_xkl_layout_enable_option (EekXklLayout *layout,
|
|
||||||
const gchar *option);
|
|
||||||
gboolean eek_xkl_layout_disable_option (EekXklLayout *layout,
|
|
||||||
const gchar *option);
|
|
||||||
|
|
||||||
gchar *eek_xkl_layout_get_model (EekXklLayout *layout);
|
|
||||||
gchar **eek_xkl_layout_get_layouts (EekXklLayout *layout);
|
|
||||||
gchar **eek_xkl_layout_get_variants (EekXklLayout *layout);
|
|
||||||
gchar **eek_xkl_layout_get_options (EekXklLayout *layout);
|
|
||||||
gboolean eek_xkl_layout_get_option (EekXklLayout *layout,
|
|
||||||
const gchar *option);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
#endif /* #ifndef EEK_XKL_LAYOUT_H */
|
|
||||||
@ -59,7 +59,7 @@ struct _EekXmlLayoutPrivate
|
|||||||
|
|
||||||
G_DEFINE_BOXED_TYPE(EekXmlKeyboardDesc, eek_xml_keyboard_desc, eek_xml_keyboard_desc_copy, eek_xml_keyboard_desc_free);
|
G_DEFINE_BOXED_TYPE(EekXmlKeyboardDesc, eek_xml_keyboard_desc, eek_xml_keyboard_desc_copy, eek_xml_keyboard_desc_free);
|
||||||
|
|
||||||
#define BUFSIZE 8192
|
#define BUFSIZE 8192
|
||||||
|
|
||||||
static GList *parse_keyboards (const gchar *path,
|
static GList *parse_keyboards (const gchar *path,
|
||||||
GError **error);
|
GError **error);
|
||||||
@ -1021,10 +1021,10 @@ eek_xml_layout_class_init (EekXmlLayoutClass *klass)
|
|||||||
gobject_class->finalize = eek_xml_layout_finalize;
|
gobject_class->finalize = eek_xml_layout_finalize;
|
||||||
|
|
||||||
pspec = g_param_spec_string ("id",
|
pspec = g_param_spec_string ("id",
|
||||||
"ID",
|
"ID",
|
||||||
"ID",
|
"ID",
|
||||||
NULL,
|
NULL,
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
g_object_class_install_property (gobject_class, PROP_ID, pspec);
|
g_object_class_install_property (gobject_class, PROP_ID, pspec);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,6 @@ libeekboard_la_CFLAGS = \
|
|||||||
$(NULL)
|
$(NULL)
|
||||||
libeekboard_la_LIBADD = \
|
libeekboard_la_LIBADD = \
|
||||||
$(top_builddir)/eek/libeek.la \
|
$(top_builddir)/eek/libeek.la \
|
||||||
$(top_builddir)/eek/libeek-xkl.la \
|
|
||||||
$(GIO2_LIBS) \
|
$(GIO2_LIBS) \
|
||||||
$(LIBXKLAVIER_LIBS) \
|
$(LIBXKLAVIER_LIBS) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include "eekboard/eekboard-context-service.h"
|
#include "eekboard/eekboard-context-service.h"
|
||||||
#include "eekboard/eekboard-xklutil.h"
|
#include "eekboard/eekboard-xklutil.h"
|
||||||
#include "eek/eek-xkl.h"
|
//#include "eek/eek-xkl.h" //x11_stub
|
||||||
|
|
||||||
#define CSW 640
|
#define CSW 640
|
||||||
#define CSH 480
|
#define CSH 480
|
||||||
@ -173,6 +173,8 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
|
|||||||
display = XOpenDisplay (NULL);
|
display = XOpenDisplay (NULL);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
|
/*
|
||||||
|
//x11_stub_start
|
||||||
layout = eek_xkl_layout_new (display, &error);
|
layout = eek_xkl_layout_new (display, &error);
|
||||||
if (layout == NULL) {
|
if (layout == NULL) {
|
||||||
g_warning ("can't create keyboard %s: %s",
|
g_warning ("can't create keyboard %s: %s",
|
||||||
@ -185,6 +187,8 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
|
|||||||
g_object_unref (layout);
|
g_object_unref (layout);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
//x11_stub_eend
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
error = NULL;
|
error = NULL;
|
||||||
layout = eek_xml_layout_new (keyboard_type, &error);
|
layout = eek_xml_layout_new (keyboard_type, &error);
|
||||||
|
|||||||
@ -29,7 +29,6 @@ eekboard_CFLAGS = \
|
|||||||
-I$(top_srcdir) \
|
-I$(top_srcdir) \
|
||||||
$(GIO2_CFLAGS) \
|
$(GIO2_CFLAGS) \
|
||||||
$(GTK_CFLAGS) \
|
$(GTK_CFLAGS) \
|
||||||
$(XKB_CFLAGS) \
|
|
||||||
$(LIBXKLAVIER_CFLAGS) \
|
$(LIBXKLAVIER_CFLAGS) \
|
||||||
-DLIBEXECDIR=\"$(libexecdir)\" \
|
-DLIBEXECDIR=\"$(libexecdir)\" \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
@ -37,10 +36,8 @@ eekboard_CFLAGS = \
|
|||||||
eekboard_LDADD = \
|
eekboard_LDADD = \
|
||||||
$(top_builddir)/eekboard/libeekboard.la \
|
$(top_builddir)/eekboard/libeekboard.la \
|
||||||
$(top_builddir)/eek/libeek.la \
|
$(top_builddir)/eek/libeek.la \
|
||||||
$(top_builddir)/eek/libeek-xkl.la \
|
|
||||||
$(GIO2_LIBS) \
|
$(GIO2_LIBS) \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(XKB_LIBS) \
|
|
||||||
$(LIBXKLAVIER_LIBS) \
|
$(LIBXKLAVIER_LIBS) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
@ -75,7 +72,6 @@ eekboard_server_LDADD = \
|
|||||||
$(top_builddir)/eekboard/libeekboard.la \
|
$(top_builddir)/eekboard/libeekboard.la \
|
||||||
$(top_builddir)/eek/libeek.la \
|
$(top_builddir)/eek/libeek.la \
|
||||||
$(top_builddir)/eek/libeek-gtk.la \
|
$(top_builddir)/eek/libeek-gtk.la \
|
||||||
$(top_builddir)/eek/libeek-xkl.la \
|
|
||||||
$(GIO2_LIBS) \
|
$(GIO2_LIBS) \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(LIBXKLAVIER_LIBS) \
|
$(LIBXKLAVIER_LIBS) \
|
||||||
@ -101,7 +97,6 @@ eekboard_setup_CFLAGS = \
|
|||||||
-I$(top_srcdir) \
|
-I$(top_srcdir) \
|
||||||
$(GIO2_CFLAGS) \
|
$(GIO2_CFLAGS) \
|
||||||
$(GTK_CFLAGS) \
|
$(GTK_CFLAGS) \
|
||||||
$(XKB_CFLAGS) \
|
|
||||||
$(LIBXKLAVIER_CFLAGS) \
|
$(LIBXKLAVIER_CFLAGS) \
|
||||||
-DPKGDATADIR=\"$(pkgdatadir)\" \
|
-DPKGDATADIR=\"$(pkgdatadir)\" \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|||||||
35
src/client.c
35
src/client.c
@ -29,12 +29,12 @@
|
|||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
|
|
||||||
#ifdef HAVE_XTEST
|
#ifdef HAVE_XTEST
|
||||||
#include <X11/extensions/XTest.h>
|
//#include <X11/extensions/XTest.h>
|
||||||
#include <X11/XKBlib.h>
|
//#include <X11/XKBlib.h>
|
||||||
#endif /* HAVE_XTEST */
|
#endif /* HAVE_XTEST */
|
||||||
|
|
||||||
#include "eek/eek.h"
|
#include "eek/eek.h"
|
||||||
#include "eek/eek-xkl.h"
|
//#include "eek/eek-xkl.h"
|
||||||
#include "eekboard/eekboard-client.h"
|
#include "eekboard/eekboard-client.h"
|
||||||
#include "eekboard/eekboard-xklutil.h"
|
#include "eekboard/eekboard-xklutil.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
@ -93,7 +93,7 @@ struct _Client {
|
|||||||
|
|
||||||
#ifdef HAVE_XTEST
|
#ifdef HAVE_XTEST
|
||||||
guint modifier_keycodes[8];
|
guint modifier_keycodes[8];
|
||||||
XkbDescRec *xkb;
|
// XkbDescRec *xkb; //x11_stub
|
||||||
#endif /* HAVE_XTEST */
|
#endif /* HAVE_XTEST */
|
||||||
|
|
||||||
GSettings *settings;
|
GSettings *settings;
|
||||||
@ -858,6 +858,8 @@ get_replaced_keycode (Client *client)
|
|||||||
{
|
{
|
||||||
guint keycode;
|
guint keycode;
|
||||||
|
|
||||||
|
/*
|
||||||
|
//x11_stub_start
|
||||||
for (keycode = client->xkb->max_key_code;
|
for (keycode = client->xkb->max_key_code;
|
||||||
keycode >= client->xkb->min_key_code;
|
keycode >= client->xkb->min_key_code;
|
||||||
--keycode) {
|
--keycode) {
|
||||||
@ -867,6 +869,8 @@ get_replaced_keycode (Client *client)
|
|||||||
return keycode;
|
return keycode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//x11_stub_eend
|
||||||
|
*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -889,6 +893,8 @@ replace_keycode (Client *client,
|
|||||||
int keysyms_per_keycode;
|
int keysyms_per_keycode;
|
||||||
KeySym *syms;
|
KeySym *syms;
|
||||||
|
|
||||||
|
/*
|
||||||
|
//x11_stub_start
|
||||||
g_return_val_if_fail (client->xkb->min_key_code <= keycode &&
|
g_return_val_if_fail (client->xkb->min_key_code <= keycode &&
|
||||||
keycode <= client->xkb->max_key_code,
|
keycode <= client->xkb->max_key_code,
|
||||||
FALSE);
|
FALSE);
|
||||||
@ -900,8 +906,11 @@ replace_keycode (Client *client,
|
|||||||
XChangeKeyboardMapping (xdisplay, keycode, 1, syms, 1);
|
XChangeKeyboardMapping (xdisplay, keycode, 1, syms, 1);
|
||||||
XSync (xdisplay, False);
|
XSync (xdisplay, False);
|
||||||
XFree (syms);
|
XFree (syms);
|
||||||
*keysym = old_keysym;
|
//x11_stub_eend
|
||||||
|
*/
|
||||||
|
|
||||||
|
*keysym = old_keysym;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1117,6 +1126,9 @@ client_enable_xtest (Client *client)
|
|||||||
|
|
||||||
g_assert (display);
|
g_assert (display);
|
||||||
|
|
||||||
|
/*
|
||||||
|
//x11_stub_start
|
||||||
|
|
||||||
if (!XTestQueryExtension (xdisplay,
|
if (!XTestQueryExtension (xdisplay,
|
||||||
&event_base, &error_base,
|
&event_base, &error_base,
|
||||||
&major_version, &minor_version)) {
|
&major_version, &minor_version)) {
|
||||||
@ -1141,15 +1153,20 @@ client_enable_xtest (Client *client)
|
|||||||
g_signal_connect (client->context, "key-activated",
|
g_signal_connect (client->context, "key-activated",
|
||||||
G_CALLBACK(on_key_activated), client);
|
G_CALLBACK(on_key_activated), client);
|
||||||
|
|
||||||
|
//x11_stub_eend
|
||||||
|
*/
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
client_disable_xtest (Client *client)
|
client_disable_xtest (Client *client)
|
||||||
{
|
{
|
||||||
if (client->xkb) {
|
//x11_stub_start
|
||||||
XkbFreeKeyboard (client->xkb, 0, TRUE); /* free_all = TRUE */
|
//if (client->xkb) {
|
||||||
client->xkb = NULL;
|
// XkbFreeKeyboard (client->xkb, 0, TRUE); /* free_all = TRUE */
|
||||||
}
|
// client->xkb = NULL;
|
||||||
|
//}
|
||||||
|
//x11_stub_eend
|
||||||
}
|
}
|
||||||
#endif /* HAVE_XTEST */
|
#endif /* HAVE_XTEST */
|
||||||
|
|||||||
@ -27,6 +27,6 @@ eek_simple_test_SOURCES = eek-simple-test.c
|
|||||||
eek_simple_test_LDADD = $(top_builddir)/eek/libeek.la $(GIO2_LIBS)
|
eek_simple_test_LDADD = $(top_builddir)/eek/libeek.la $(GIO2_LIBS)
|
||||||
|
|
||||||
eek_xml_test_SOURCES = eek-xml-test.c
|
eek_xml_test_SOURCES = eek-xml-test.c
|
||||||
eek_xml_test_LDADD = $(top_builddir)/eek/libeek.la $(top_builddir)/eek/libeek-xkl.la $(GIO2_LIBS) $(GTK_LIBS)
|
eek_xml_test_LDADD = $(top_builddir)/eek/libeek.la $(GIO2_LIBS) $(GTK_LIBS)
|
||||||
|
|
||||||
-include $(top_srcdir)/git.mk
|
-include $(top_srcdir)/git.mk
|
||||||
|
|||||||
Reference in New Issue
Block a user