Compare commits
4 Commits
click
...
fix-deprec
| Author | SHA1 | Date | |
|---|---|---|---|
| 33662d42ae | |||
| bf8e765c89 | |||
| 36ee547506 | |||
| 8e014aaaf8 |
@ -4,6 +4,10 @@ stages:
|
||||
- build
|
||||
|
||||
before_script:
|
||||
- apt-get -y update
|
||||
- apt-get -y install wget gnupg2
|
||||
- echo "deb http://ci.puri.sm/ scratch librem5" > /etc/apt/sources.list.d/ci.list
|
||||
- wget -O- https://ci.puri.sm/ci-repo.key | apt-key add -
|
||||
- apt-get -y update
|
||||
- apt-get -y build-dep .
|
||||
|
||||
|
||||
41
Makefile.am
Normal file
@ -0,0 +1,41 @@
|
||||
# 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
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
SUBDIRS = eek eekboard src tests bindings docs po data examples
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection
|
||||
AUTOMAKE_OPTIONS = foreign # allow README.md to exist
|
||||
|
||||
|
||||
GITIGNOREFILES = \
|
||||
INSTALL \
|
||||
aclocal.m4 \
|
||||
compile \
|
||||
config.guess \
|
||||
config.h.in \
|
||||
config.sub \
|
||||
depcomp \
|
||||
gtk-doc.make \
|
||||
install-sh \
|
||||
ltmain.sh \
|
||||
m4 \
|
||||
missing \
|
||||
mkinstalldirs \
|
||||
$(NULL)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
20
autogen.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
PKG_NAME="eekboard"
|
||||
|
||||
(test -f $srcdir/configure.ac \
|
||||
&& test -f $srcdir/README.md ) || {
|
||||
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
|
||||
echo " top-level $PKG_NAME directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4"
|
||||
REQUIRED_AUTOMAKE_VERSION=1.10
|
||||
REQUIRED_AUTOCONF_VERSION=2.60
|
||||
|
||||
. gnome-autogen.sh
|
||||
21
bindings/Makefile.am
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
|
||||
SUBDIRS = vala
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
96
bindings/vala/Makefile.am
Normal file
@ -0,0 +1,96 @@
|
||||
# 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
|
||||
|
||||
NULL =
|
||||
|
||||
if ENABLE_VALA
|
||||
vapidir = $(datadir)/vala/vapi
|
||||
dist_vapi_DATA = \
|
||||
eek-$(EEK_API_VERSION).vapi \
|
||||
eek-$(EEK_API_VERSION).deps \
|
||||
eek-gtk-$(EEK_API_VERSION).vapi \
|
||||
eek-gtk-$(EEK_API_VERSION).deps \
|
||||
eek-xkl-$(EEK_API_VERSION).vapi \
|
||||
eek-xkl-$(EEK_API_VERSION).deps \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DIST = \
|
||||
Eek-$(EEK_API_VERSION).metadata \
|
||||
EekGtk-$(EEK_API_VERSION).metadata \
|
||||
EekXkl-$(EEK_API_VERSION).metadata \
|
||||
$(NULL)
|
||||
|
||||
GITIGNOREFILES = \
|
||||
eek-$(EEK_API_VERSION).vapi \
|
||||
eek-gtk-$(EEK_API_VERSION).vapi \
|
||||
eek-xkl-$(EEK_API_VERSION).vapi \
|
||||
$(NULL)
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f *.vapi
|
||||
|
||||
eek_vapi_deps = \
|
||||
$(srcdir)/Eek-$(EEK_API_VERSION).metadata \
|
||||
| \
|
||||
$(top_builddir)/eek/Eek-$(EEK_API_VERSION).gir \
|
||||
$(NULL)
|
||||
|
||||
eek-$(EEK_API_VERSION).vapi: $(eek_vapi_deps)
|
||||
$(VAPIGEN_V)$(VAPIGEN) \
|
||||
--library eek-$(EEK_API_VERSION) \
|
||||
--pkg gio-2.0 \
|
||||
--metadatadir=$(srcdir) \
|
||||
$(top_builddir)/eek/Eek-$(EEK_API_VERSION).gir
|
||||
|
||||
eek_gtk_vapi_deps = \
|
||||
$(srcdir)/EekGtk-$(EEK_API_VERSION).metadata \
|
||||
| \
|
||||
$(top_builddir)/eek/EekGtk-$(EEK_API_VERSION).gir \
|
||||
$(NULL)
|
||||
|
||||
eek-gtk-$(EEK_API_VERSION).vapi: $(eek_gtk_vapi_deps)
|
||||
$(VAPIGEN_V)$(VAPIGEN) --vapidir=$(builddir) \
|
||||
--library eek-gtk-$(EEK_API_VERSION) \
|
||||
--pkg eek-$(EEK_API_VERSION) \
|
||||
--pkg gio-2.0 \
|
||||
--pkg gtk+-3.0 \
|
||||
--metadatadir=$(srcdir) \
|
||||
$(top_builddir)/eek/EekGtk-$(EEK_API_VERSION).gir
|
||||
|
||||
eek_xkl_vapi_deps = \
|
||||
$(srcdir)/EekXkl-$(EEK_API_VERSION).metadata \
|
||||
| \
|
||||
$(top_builddir)/eek/EekXkl-$(EEK_API_VERSION).gir \
|
||||
$(NULL)
|
||||
|
||||
eek-xkl-$(EEK_API_VERSION).vapi: $(eek_xkl_vapi_deps)
|
||||
$(VAPIGEN_V)$(VAPIGEN) \
|
||||
--vapidir=$(builddir) \
|
||||
--library eek-xkl-$(EEK_API_VERSION) \
|
||||
--pkg eek-$(EEK_API_VERSION) \
|
||||
--pkg gio-2.0 \
|
||||
--metadatadir=$(srcdir) \
|
||||
$(top_builddir)/eek/EekXkl-$(EEK_API_VERSION).gir
|
||||
|
||||
# set up the verbosity rules to avoid some build noise
|
||||
VAPIGEN_V = $(VAPIGEN_V_$(V))
|
||||
VAPIGEN_V_ = $(VAPIGEN_V_$(AM_DEFAULT_VERBOSITY))
|
||||
VAPIGEN_V_0 = @echo " VAPIG " $@;
|
||||
endif
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
245
configure.ac
Normal file
@ -0,0 +1,245 @@
|
||||
# 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
|
||||
|
||||
AC_PREREQ(2.63)
|
||||
dnl AC_CONFIG_SRCDIR([configure.ac])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AC_INIT([eekboard], [1.0.8], [ueno@unixuser.org])
|
||||
|
||||
dnl Init automake
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_MAINTAINER_MODE([enable])
|
||||
AC_GNU_SOURCE
|
||||
|
||||
dnl Support silent build
|
||||
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
||||
|
||||
dnl Check for programs
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CC_STDC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_CXX
|
||||
|
||||
# define PACKAGE_VERSION_* variables
|
||||
AM_DISABLE_STATIC
|
||||
AC_ISC_POSIX
|
||||
AC_HEADER_STDC
|
||||
LT_INIT
|
||||
IT_PROG_INTLTOOL([0.35.0])
|
||||
|
||||
GTK_API_VERSION=3.0
|
||||
GTK_REQUIRED=2.91.0
|
||||
EEK_API_VERSION=0.90
|
||||
EEK_API_MAJOR_VERSION=0
|
||||
EEK_API_MINOR_VERSION=90
|
||||
EEK_API_PC_VERSION=0.90
|
||||
EEK_LIBRARY_SUFFIX="-$EEK_API_VERSION"
|
||||
|
||||
AC_SUBST([GTK_API_VERSION])
|
||||
AC_SUBST([EEK_API_VERSION])
|
||||
AC_SUBST([EEK_API_MAJOR_VERSION])
|
||||
AC_SUBST([EEK_API_MINOR_VERSION])
|
||||
AC_SUBST([EEK_API_PC_VERSION])
|
||||
AC_SUBST([EEK_LIBRARY_SUFFIX])
|
||||
AC_SUBST([EEK_LIBRARY_SUFFIX_U],[AS_TR_SH([$EEK_LIBRARY_SUFFIX])])
|
||||
|
||||
AM_PATH_GLIB_2_0
|
||||
PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= 2.26.0], ,
|
||||
[AC_MSG_ERROR([GLib2 not found])])
|
||||
PKG_CHECK_MODULES([GIO2], [gio-2.0], ,
|
||||
[AC_MSG_ERROR([Gio2 not found])])
|
||||
GLIB_GSETTINGS
|
||||
|
||||
PKG_CHECK_MODULES([PANGOCAIRO], [pangocairo], ,
|
||||
[AC_MSG_ERROR([PangoCairo not found])])
|
||||
PKG_CHECK_MODULES([GTK], [
|
||||
gtk+-$GTK_API_VERSION >= $GTK_REQUIRED
|
||||
gdk-$GTK_API_VERSION >= $GTK_REQUIRED], ,
|
||||
[AC_MSG_ERROR([GTK not found])])
|
||||
PKG_CHECK_MODULES([LIBXKLAVIER], [libxklavier x11], ,
|
||||
[AC_MSG_ERROR([Libxklavier not found])])
|
||||
PKG_CHECK_MODULES([LIBCROCO], [libcroco-0.6], ,
|
||||
[AC_MSG_ERROR([libcroco not found])])
|
||||
|
||||
dnl use XTest to generate key events
|
||||
AC_MSG_CHECKING([whether you enable XTest])
|
||||
AC_ARG_ENABLE(xtest,
|
||||
AS_HELP_STRING([--enable-xtest=no/yes],
|
||||
[Enable XTest default=yes]),
|
||||
enable_xtest=$enableval,
|
||||
enable_xtest=yes)
|
||||
|
||||
if test x$enable_xtest = xyes; then
|
||||
PKG_CHECK_MODULES([XTEST], [xtst], , enable_xtest=no)
|
||||
if test x$enable_xtest = xyes; then
|
||||
AC_DEFINE([HAVE_XTEST], [1], [Define if XTest is found])
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL(ENABLE_XTEST, [test x$enable_xtest = xyes])
|
||||
AC_MSG_RESULT($enable_xtest)
|
||||
|
||||
dnl use X to mark the fullscreen window as dock
|
||||
AC_MSG_CHECKING([whether you enable X dock])
|
||||
AC_ARG_ENABLE(x-dock,
|
||||
AS_HELP_STRING([--enable-x-dock=no/yes],
|
||||
[Enable X dock default=yes]),
|
||||
enable_x_dock=$enableval,
|
||||
enable_x_dock=yes)
|
||||
|
||||
if test x$enable_x_dock = xyes; then
|
||||
PKG_CHECK_MODULES([XDOCK], [x11], , enable_x_dock=no)
|
||||
if test x$enable_x_dock = xyes; then
|
||||
AC_DEFINE([HAVE_XDOCK], [1], [Define if X dock is found])
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL(ENABLE_XDOCK, [test x$enable_x_dock = xyes])
|
||||
AC_MSG_RESULT($enable_x_dock)
|
||||
|
||||
focus_listeners="ibus"
|
||||
keystroke_listeners=""
|
||||
|
||||
dnl use AT-SPI 2 to capture focus/keystroke events
|
||||
AC_MSG_CHECKING([whether you enable AT-SPI 2 event handling])
|
||||
AC_ARG_ENABLE(atspi,
|
||||
AS_HELP_STRING([--enable-atspi=no/yes],
|
||||
[Enable AT-SPI 2 event handling default=yes]),
|
||||
enable_atspi=$enableval,
|
||||
enable_atspi=yes)
|
||||
|
||||
if test x$enable_atspi = xyes; then
|
||||
PKG_CHECK_MODULES([ATSPI2], [atspi-2], , enable_atspi=no)
|
||||
if test x$enable_atspi = xyes; then
|
||||
AC_DEFINE([HAVE_ATSPI], [1], [Define if AT-SPI 2 is found])
|
||||
focus_listeners="atspi $focus_listeners"
|
||||
keystroke_listeners="atspi $keystroke_listeners"
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT($enable_atspi)
|
||||
AM_CONDITIONAL(ENABLE_ATSPI, [test x$enable_atspi = xyes])
|
||||
|
||||
if test -n "$focus_listeners"; then
|
||||
AC_DEFINE(ENABLE_FOCUS_LISTENER, [1], [Define if eekboard can follow focus changes])
|
||||
fi
|
||||
|
||||
GOBJECT_INTROSPECTION_CHECK([0.9.0])
|
||||
|
||||
dnl Vala langauge binding
|
||||
AC_MSG_CHECKING([whether you enable Vala language support])
|
||||
AC_ARG_ENABLE(vala,
|
||||
AS_HELP_STRING([--enable-vala=no/yes],
|
||||
[Enable Vala language binding default=yes]),
|
||||
enable_vala=$enableval,
|
||||
enable_vala=yes)
|
||||
if test x$enable_vala = xyes; then
|
||||
if test "x$INTROSPECTION_SCANNER" = x; then
|
||||
enable_vala=no
|
||||
AC_MSG_WARN([GObject-Introspection must be enabled for Vala bindings])
|
||||
fi
|
||||
|
||||
AM_PROG_VALAC([0.10.0])
|
||||
have_vala=yes
|
||||
|
||||
AC_PATH_PROG(VALAC, valac, valac)
|
||||
AC_SUBST(VALAC)
|
||||
AC_SUBST(VALAFLAGS)
|
||||
|
||||
AC_PATH_PROG([VAPIGEN], [vapigen], [false])
|
||||
|
||||
if test "x$VAPIGEN" = "xfalse"; then
|
||||
enable_vala=no
|
||||
AC_MSG_WARN([vapigen not found. Was vala compiled with --enable-vapigen?])
|
||||
fi
|
||||
|
||||
AC_SUBST(VAPIGEN)
|
||||
fi
|
||||
AC_MSG_RESULT($enable_vala)
|
||||
AM_CONDITIONAL(ENABLE_VALA, [test x$enable_vala = xyes])
|
||||
|
||||
dnl libcanberra
|
||||
AC_MSG_CHECKING([whether you enable libcanberra])
|
||||
AC_ARG_ENABLE(libcanberra,
|
||||
AS_HELP_STRING([--enable-libcanberra=no/yes],
|
||||
[Enable libcanberra user interface default=no]),
|
||||
enable_libcanberra=$enableval,
|
||||
enable_libcanberra=yes)
|
||||
|
||||
if test x$enable_libcanberra = xyes; then
|
||||
PKG_CHECK_MODULES([LIBCANBERRA], [libcanberra-gtk3], , enable_libcanberra=no)
|
||||
if test x$enable_libcanberra = xyes; then
|
||||
AC_DEFINE([HAVE_LIBCANBERRA], [1], [Define if libcanberra is found])
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL(ENABLE_LIBCANBERRA, [test x$enable_libcanberra = xyes])
|
||||
AC_MSG_RESULT($enable_libcanberra)
|
||||
|
||||
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
|
||||
|
||||
dnl define GETTEXT_* variables
|
||||
GETTEXT_PACKAGE=$PACKAGE
|
||||
AC_SUBST(GETTEXT_PACKAGE)
|
||||
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define to the read-only architecture-independent data directory.])
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
AM_GLIB_DEFINE_LOCALEDIR(EEKBOARD_LOCALEDIR)
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_FILES([Makefile
|
||||
eek/Makefile
|
||||
eekboard/Makefile
|
||||
src/Makefile
|
||||
tests/Makefile
|
||||
bindings/Makefile
|
||||
bindings/vala/Makefile
|
||||
docs/Makefile
|
||||
docs/reference/Makefile
|
||||
docs/reference/eek/Makefile
|
||||
docs/reference/eekboard/Makefile
|
||||
po/Makefile.in
|
||||
data/Makefile
|
||||
data/icons/Makefile
|
||||
data/icons/16x16/Makefile
|
||||
data/icons/22x22/Makefile
|
||||
data/icons/24x24/Makefile
|
||||
data/icons/32x32/Makefile
|
||||
data/icons/48x48/Makefile
|
||||
data/icons/scalable/Makefile
|
||||
data/themes/Makefile
|
||||
data/keyboards/Makefile
|
||||
examples/Makefile
|
||||
examples/simple-client/Makefile
|
||||
eek/eek-${EEK_API_VERSION}.pc
|
||||
eek/eek-gtk-${EEK_API_VERSION}.pc
|
||||
eek/eek-xkl-${EEK_API_VERSION}.pc
|
||||
eekboard/eekboard-${EEK_API_VERSION}.pc])
|
||||
AC_OUTPUT
|
||||
AC_MSG_RESULT([
|
||||
Build options:
|
||||
Version $VERSION
|
||||
Install prefix $prefix
|
||||
Build shared libs $enable_shared
|
||||
Build static libs $enable_static
|
||||
CFLAGS $CFLAGS
|
||||
Build Vala binding $enable_vala
|
||||
Sound support $enable_libcanberra
|
||||
Build document $enable_gtk_doc
|
||||
Focus listeners $focus_listeners
|
||||
Keystroke listeners $keystroke_listeners
|
||||
])
|
||||
|
||||
|
||||
35
data/Makefile.am
Normal file
@ -0,0 +1,35 @@
|
||||
SUBDIRS = icons themes keyboards
|
||||
|
||||
@GSETTINGS_RULES@
|
||||
@INTLTOOL_XML_NOMERGE_RULE@
|
||||
gsettings_schemas_in_files = org.fedorahosted.eekboard.gschema.xml.in
|
||||
gsettings_SCHEMAS = $(gsettings_schemas_in_files:.gschema.xml.in=.gschema.xml)
|
||||
|
||||
servicedir = $(datadir)/dbus-1/services
|
||||
service_in_files = eekboard-server.service.in
|
||||
service_DATA = $(service_in_files:.service.in=.service)
|
||||
|
||||
$(service_DATA): $(service_in_files) Makefile
|
||||
$(AM_V_GEN) sed -e "s|\@bindir\@|$(bindir)|" $< > $@
|
||||
|
||||
desktopdir = $(datadir)/applications
|
||||
desktop_in_files = eekboard.desktop.in
|
||||
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
|
||||
|
||||
if ENABLE_ATSPI
|
||||
autostartdir = $(sysconfdir)/xdg/autostart
|
||||
autostart_in_files = eekboard-autostart.desktop.in
|
||||
autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
|
||||
endif
|
||||
|
||||
@INTLTOOL_DESKTOP_RULE@
|
||||
|
||||
CLEANFILES = $(service_DATA) $(desktop_DATA) $(gsettings_SCHEMAS)
|
||||
EXTRA_DIST = $(service_in_files) $(desktop_in_files) $(gsettings_schemas_in_files)
|
||||
|
||||
if ENABLE_ATSPI
|
||||
CLEANFILES += $(autostart_DATA)
|
||||
EXTRA_DIST += $(autostart_in_files)
|
||||
endif
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
|
||||
<interface name="sm.puri.OSK0">
|
||||
<method name="SetVisible">
|
||||
<arg name="visible" type="b" direction="in"/>
|
||||
<doc:doc><doc:description>
|
||||
Switch keyboard visibility
|
||||
</doc:description></doc:doc>
|
||||
</method>
|
||||
<method name="GetVisible">
|
||||
<arg name="visible" type="b" direction="out"/>
|
||||
<doc:doc><doc:description>
|
||||
Get keyboard visibility
|
||||
</doc:description></doc:doc>
|
||||
</method>
|
||||
<property name="Visible" type="b" access="read">
|
||||
</property>
|
||||
</interface>
|
||||
</node>
|
||||
17
data/icons/16x16/Makefile.am
Normal file
@ -0,0 +1,17 @@
|
||||
size = 16x16
|
||||
|
||||
icondir = $(datadir)/icons/hicolor/$(size)/apps
|
||||
dist_icon_DATA = eekboard.png
|
||||
|
||||
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
|
||||
|
||||
install-data-hook:
|
||||
@-if test -z "$(DESTDIR)"; then \
|
||||
echo "Updating Gtk icon cache."; \
|
||||
$(gtk_update_icon_cache); \
|
||||
else \
|
||||
echo "*** Icon cache not updated. After install, run this:"; \
|
||||
echo "*** $(gtk_update_icon_cache)"; \
|
||||
fi
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
BIN
data/icons/16x16/eekboard.png
Normal file
|
After Width: | Height: | Size: 606 B |
17
data/icons/22x22/Makefile.am
Normal file
@ -0,0 +1,17 @@
|
||||
size = 22x22
|
||||
|
||||
icondir = $(datadir)/icons/hicolor/$(size)/apps
|
||||
dist_icon_DATA = eekboard.png
|
||||
|
||||
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
|
||||
|
||||
install-data-hook:
|
||||
@-if test -z "$(DESTDIR)"; then \
|
||||
echo "Updating Gtk icon cache."; \
|
||||
$(gtk_update_icon_cache); \
|
||||
else \
|
||||
echo "*** Icon cache not updated. After install, run this:"; \
|
||||
echo "*** $(gtk_update_icon_cache)"; \
|
||||
fi
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
BIN
data/icons/22x22/eekboard.png
Normal file
|
After Width: | Height: | Size: 892 B |
17
data/icons/24x24/Makefile.am
Normal file
@ -0,0 +1,17 @@
|
||||
size = 24x24
|
||||
|
||||
icondir = $(datadir)/icons/hicolor/$(size)/apps
|
||||
dist_icon_DATA = eekboard.png
|
||||
|
||||
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
|
||||
|
||||
install-data-hook:
|
||||
@-if test -z "$(DESTDIR)"; then \
|
||||
echo "Updating Gtk icon cache."; \
|
||||
$(gtk_update_icon_cache); \
|
||||
else \
|
||||
echo "*** Icon cache not updated. After install, run this:"; \
|
||||
echo "*** $(gtk_update_icon_cache)"; \
|
||||
fi
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
BIN
data/icons/24x24/eekboard.png
Normal file
|
After Width: | Height: | Size: 957 B |
17
data/icons/32x32/Makefile.am
Normal file
@ -0,0 +1,17 @@
|
||||
size = 32x32
|
||||
|
||||
icondir = $(datadir)/icons/hicolor/$(size)/apps
|
||||
dist_icon_DATA = eekboard.png
|
||||
|
||||
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
|
||||
|
||||
install-data-hook:
|
||||
@-if test -z "$(DESTDIR)"; then \
|
||||
echo "Updating Gtk icon cache."; \
|
||||
$(gtk_update_icon_cache); \
|
||||
else \
|
||||
echo "*** Icon cache not updated. After install, run this:"; \
|
||||
echo "*** $(gtk_update_icon_cache)"; \
|
||||
fi
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
BIN
data/icons/32x32/eekboard.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
17
data/icons/48x48/Makefile.am
Normal file
@ -0,0 +1,17 @@
|
||||
size = 48x48
|
||||
|
||||
icondir = $(datadir)/icons/hicolor/$(size)/apps
|
||||
dist_icon_DATA = eekboard.png
|
||||
|
||||
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
|
||||
|
||||
install-data-hook:
|
||||
@-if test -z "$(DESTDIR)"; then \
|
||||
echo "Updating Gtk icon cache."; \
|
||||
$(gtk_update_icon_cache); \
|
||||
else \
|
||||
echo "*** Icon cache not updated. After install, run this:"; \
|
||||
echo "*** $(gtk_update_icon_cache)"; \
|
||||
fi
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
BIN
data/icons/48x48/eekboard.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
3
data/icons/Makefile.am
Normal file
@ -0,0 +1,3 @@
|
||||
SUBDIRS = 16x16 22x22 24x24 32x32 48x48 scalable
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"
|
||||
version="1.1" viewBox="0 0 24 24">
|
||||
|
||||
<path d="M 24,1 L 24,10 C 24,15 20,17 17,17 L 7,17 L 10,20 L 10,23
|
||||
L 7,23 L 0,15 L 7,7 L 10,7 L 10,10 L 7,13 L 17,13
|
||||
C 19,13 20,12 20,10 L 20,1 Z"
|
||||
stroke="none" fill="black" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 388 B |
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"
|
||||
version="1.1" viewBox="0 0 24 24">
|
||||
|
||||
<path d="M 12,2 L 22,14 L 16,14 L 16,22 L 8,22 L 8,14 L 2,14 Z"
|
||||
stroke="none" fill="black" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 279 B |
@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
id="svg4043"
|
||||
version="1.1"
|
||||
viewBox="0 0 4.2333331 4.2333093"
|
||||
height="4.2333093mm"
|
||||
width="4.2333331mm">
|
||||
<defs
|
||||
id="defs4037" />
|
||||
<metadata
|
||||
id="metadata4040">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(-86.329776,-68.097636)"
|
||||
id="layer1">
|
||||
<g
|
||||
style="stroke-width:1.00004983;fill:#2e3436;fill-opacity:1"
|
||||
transform="matrix(0.99990029,0,0,1,-7.1823833,-1.8799927)"
|
||||
id="g842">
|
||||
<g
|
||||
style="stroke-width:1.00004983;fill:#2e3436;fill-opacity:1"
|
||||
id="g836">
|
||||
<path
|
||||
id="path5166"
|
||||
d="m 95.636719,69.978516 c -1.165869,0 -2.115235,0.949365 -2.115235,2.115234 0,1.165869 0.949366,2.117188 2.115235,2.117188 1.165869,0 2.117187,-0.951319 2.117187,-2.117188 0,-1.165869 -0.951318,-2.115234 -2.117187,-2.115234 z m 0,0.529296 c 0.879886,0 1.58789,0.706052 1.58789,1.585938 0,0.879886 -0.708004,1.587891 -1.58789,1.587891 -0.879886,0 -1.585938,-0.708005 -1.585938,-1.587891 0,-0.879886 0.706052,-1.585937 1.585938,-1.585938 z"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52919304;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||
</g>
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26459652;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 95.636719,70.109375 c -0.144398,0 -0.27248,0.07793 -0.373047,0.189453 -0.100567,0.111521 -0.18209,0.261405 -0.25,0.439453 -0.135821,0.356096 -0.214844,0.830395 -0.214844,1.355469 0,0.525074 0.07902,1.001326 0.214844,1.357422 0.06791,0.178048 0.149433,0.327932 0.25,0.439453 0.100567,0.111521 0.228649,0.1875 0.373047,0.1875 0.144397,0 0.27248,-0.07598 0.373047,-0.1875 0.100566,-0.111521 0.182089,-0.261405 0.25,-0.439453 0.135821,-0.356096 0.216797,-0.832348 0.216796,-1.357422 0,-0.525074 -0.08097,-0.999373 -0.216796,-1.355469 -0.06791,-0.178048 -0.149434,-0.327932 -0.25,-0.439453 -0.100567,-0.111521 -0.22865,-0.189453 -0.373047,-0.189453 z m 0,0.265625 c 0.05067,0 0.109272,0.02564 0.177734,0.101562 0.06846,0.07592 0.139293,0.198356 0.199219,0.355469 0.119851,0.314227 0.197266,0.763915 0.197266,1.261719 0,0.497804 -0.07742,0.949446 -0.197266,1.263672 -0.05993,0.157113 -0.130756,0.279549 -0.199219,0.355469 -0.06846,0.07592 -0.12706,0.101562 -0.177734,0.101562 -0.05067,0 -0.107319,-0.02564 -0.175781,-0.101562 -0.06846,-0.07592 -0.139294,-0.198356 -0.199219,-0.355469 C 95.141867,73.043196 95.0625,72.591554 95.0625,72.09375 c 0,-0.497804 0.07937,-0.947492 0.199219,-1.261719 0.05993,-0.157113 0.130756,-0.279549 0.199219,-0.355469 C 95.5294,70.400643 95.586045,70.375 95.636719,70.375 Z"
|
||||
id="circle5168" />
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26459652;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 93.697266,71.962891 v 0.263671 h 3.96875 v -0.263671 z"
|
||||
id="path5170" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 6.6 KiB |
15
data/icons/scalable/Makefile.am
Normal file
@ -0,0 +1,15 @@
|
||||
icondir = $(datadir)/icons/hicolor/scalable/apps
|
||||
dist_icon_DATA = eekboard.svg
|
||||
|
||||
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
|
||||
|
||||
install-data-hook:
|
||||
@-if test -z "$(DESTDIR)"; then \
|
||||
echo "Updating Gtk icon cache."; \
|
||||
$(gtk_update_icon_cache); \
|
||||
else \
|
||||
echo "*** Icon cache not updated. After install, run this:"; \
|
||||
echo "*** $(gtk_update_icon_cache)"; \
|
||||
fi
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
3486
data/icons/scalable/eekboard.svg
Normal file
|
After Width: | Height: | Size: 472 KiB |
40
data/keyboards/Makefile.am
Normal file
@ -0,0 +1,40 @@
|
||||
keyboardsdir = $(pkgdatadir)/keyboards
|
||||
|
||||
nobase_dist_keyboards_DATA = \
|
||||
keyboards.xml \
|
||||
geometry/compact.xml \
|
||||
symbols/ar.xml \
|
||||
symbols/be.xml \
|
||||
symbols/fa.xml \
|
||||
symbols/he.xml \
|
||||
symbols/ja-kana.xml \
|
||||
symbols/kk.xml \
|
||||
symbols/ks.xml \
|
||||
symbols/my.xml \
|
||||
symbols/ru.xml \
|
||||
symbols/th.xml \
|
||||
symbols/ua.xml \
|
||||
symbols/ug.xml \
|
||||
symbols/us.xml \
|
||||
symbols/zh-bopomofo.xml \
|
||||
$(inscript_symbols) \
|
||||
$(NULL)
|
||||
|
||||
inscript_symbols = \
|
||||
symbols/as-inscript.xml \
|
||||
symbols/bn-inscript.xml \
|
||||
symbols/gu-inscript.xml \
|
||||
symbols/hi-inscript.xml \
|
||||
symbols/kn-inscript.xml \
|
||||
symbols/ks-inscript.xml \
|
||||
symbols/mai-inscript.xml \
|
||||
symbols/ml-inscript.xml \
|
||||
symbols/mr-inscript.xml \
|
||||
symbols/or-inscript.xml \
|
||||
symbols/pa-inscript.xml \
|
||||
symbols/sd-inscript.xml \
|
||||
symbols/ta-inscript.xml \
|
||||
symbols/te-inscript.xml \
|
||||
$(NULL)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
@ -1,53 +1,123 @@
|
||||
<?xml version="1.0"?>
|
||||
<geometry version="0.90">
|
||||
<bounds x="0" y="10.000000" width="426.0000" height="296.5853"/>
|
||||
<bounds x="0.000000" y="0.000000" width="426.0000" height="296.5853"/>
|
||||
<section angle="0">
|
||||
<bounds x="0" y="0" width="608.7804" height="201.3658"/>
|
||||
<row orientation="1">
|
||||
<key keycode="24" name="AD01" oref="outline2" />
|
||||
<key keycode="25" name="AD02" oref="outline2" />
|
||||
<key keycode="26" name="AD03" oref="outline2" />
|
||||
<key keycode="27" name="AD04" oref="outline2" />
|
||||
<key keycode="28" name="AD05" oref="outline2" />
|
||||
<key keycode="29" name="AD06" oref="outline2" />
|
||||
<key keycode="30" name="AD07" oref="outline2" />
|
||||
<key keycode="31" name="AD08" oref="outline2" />
|
||||
<key keycode="32" name="AD09" oref="outline2" />
|
||||
<key keycode="33" name="AD10" oref="outline2" />
|
||||
<key keycode="24" name="AD01" oref="outline2">
|
||||
<bounds x="65.56097" y="42.14634" width="37.46341" height="52.44877"/>
|
||||
</key>
|
||||
<key keycode="25" name="AD02" oref="outline2">
|
||||
<bounds x="106.1463" y="42.14634" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="26" name="AD03" oref="outline2">
|
||||
<bounds x="145.1707" y="42.14634" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="27" name="AD04" oref="outline2">
|
||||
<bounds x="185.7560" y="42.14634" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="28" name="AD05" oref="outline2">
|
||||
<bounds x="226.3414" y="42.14634" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="29" name="AD06" oref="outline2">
|
||||
<bounds x="266.9268" y="42.14634" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="30" name="AD07" oref="outline2">
|
||||
<bounds x="307.5121" y="42.14634" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="31" name="AD08" oref="outline2">
|
||||
<bounds x="348.0975" y="42.14634" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="32" name="AD09" oref="outline2">
|
||||
<bounds x="388.6829" y="42.14634" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="33" name="AD10" oref="outline2">
|
||||
<bounds x="429.2682" y="42.14634" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
</row>
|
||||
</section>
|
||||
<section angle="0">
|
||||
<bounds x="0" y="0" width="608.7804" height="201.3658"/>
|
||||
<row orientation="1">
|
||||
<key keycode="38" name="AC01" oref="outline2" />
|
||||
<key keycode="39" name="AC02" oref="outline2" />
|
||||
<key keycode="40" name="AC03" oref="outline2" />
|
||||
<key keycode="41" name="AC04" oref="outline2" />
|
||||
<key keycode="42" name="AC05" oref="outline2" />
|
||||
<key keycode="43" name="AC06" oref="outline2" />
|
||||
<key keycode="44" name="AC07" oref="outline2" />
|
||||
<key keycode="45" name="AC08" oref="outline2" />
|
||||
<key keycode="46" name="AC09" oref="outline2" />
|
||||
<key keycode="38" name="AC01" oref="outline2">
|
||||
<bounds x="76.48780" y="82.73170" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="39" name="AC02" oref="outline2">
|
||||
<bounds x="115.5121" y="82.73170" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="40" name="AC03" oref="outline2">
|
||||
<bounds x="156.0975" y="82.73170" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="41" name="AC04" oref="outline2">
|
||||
<bounds x="196.6829" y="82.73170" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="42" name="AC05" oref="outline2">
|
||||
<bounds x="237.2682" y="82.73170" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="43" name="AC06" oref="outline2">
|
||||
<bounds x="277.8536" y="82.73170" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="44" name="AC07" oref="outline2">
|
||||
<bounds x="318.4390" y="82.73170" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="45" name="AC08" oref="outline2">
|
||||
<bounds x="359.0243" y="82.73170" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="46" name="AC09" oref="outline2">
|
||||
<bounds x="399.6097" y="82.73170" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
</row>
|
||||
</section>
|
||||
<section angle="0">
|
||||
<bounds x="0" y="0" width="608.7804" height="201.3658"/>
|
||||
<row orientation="1">
|
||||
<key keycode="50" name="LFSH" oref="altline" />
|
||||
<key keycode="52" name="AB01" oref="outline2" />
|
||||
<key keycode="53" name="AB02" oref="outline2" />
|
||||
<key keycode="54" name="AB03" oref="outline2" />
|
||||
<key keycode="55" name="AB04" oref="outline2" />
|
||||
<key keycode="56" name="AB05" oref="outline2" />
|
||||
<key keycode="57" name="AB06" oref="outline2" />
|
||||
<key keycode="58" name="AB07" oref="outline2" />
|
||||
<key keycode="22" name="BKSP" oref="altline" />
|
||||
<key keycode="50" name="LFSH" oref="altline">
|
||||
<bounds x="3.121951" y="121.7560" width="88.97561" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="52" name="AB01" oref="outline2">
|
||||
<bounds x="95.21951" y="121.7560" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="53" name="AB02" oref="outline2">
|
||||
<bounds x="135.8048" y="121.7560" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="54" name="AB03" oref="outline2">
|
||||
<bounds x="176.3902" y="121.7560" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="55" name="AB04" oref="outline2">
|
||||
<bounds x="215.4146" y="121.7560" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="56" name="AB05" oref="outline2">
|
||||
<bounds x="256.0000" y="121.7560" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="57" name="AB06" oref="outline2">
|
||||
<bounds x="296.5853" y="121.7560" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="58" name="AB07" oref="outline2">
|
||||
<bounds x="337.1707" y="121.7560" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="22" name="BKSP" oref="altline">
|
||||
<bounds x="529.1707" y="1.560976" width="79.60975" height="37.46341"/>
|
||||
</key>
|
||||
</row>
|
||||
</section>
|
||||
<section angle="0">
|
||||
<bounds x="0" y="0" width="608.7804" height="201.3658"/>
|
||||
<row orientation="1">
|
||||
<key keycode="0" name="ABC123" oref="altline" />
|
||||
<key keycode="150" name="I150" oref="altline" />
|
||||
<key keycode="65" name="SPCE" oref="spaceline" />
|
||||
<key keycode="60" name="AB09" oref="outline2" />
|
||||
<key keycode="36" name="RTRN" oref="outline7" />
|
||||
<key keycode="37" name="LCTL" oref="altline">
|
||||
<bounds x="62.43902" y="162.3414" width="48.39024" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="66" name="ALTGR" oref="altline">
|
||||
<bounds x="113.9512" y="162.3414" width="48.39024" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="65" name="SPCE" oref="spaceline">
|
||||
<bounds x="165.4634" y="162.3414" width="217.5853" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="60" name="AB09" oref="outline2">
|
||||
<bounds x="418.3414" y="121.7560" width="37.46341" height="37.46341"/>
|
||||
</key>
|
||||
<key keycode="36" name="RTRN" oref="outline7">
|
||||
<bounds x="519.8048" y="82.73170" width="88.97561" height="37.46341"/>
|
||||
</key>
|
||||
</row>
|
||||
</section>
|
||||
<outline id="outline2" corner-radius="1.000000">
|
||||
|
||||
@ -39,8 +39,61 @@
|
||||
<key keycode="96" name="FK12">
|
||||
<keysym keyval="65481">F12</keysym>
|
||||
</key>
|
||||
<key keycode="49" name="TLDE">
|
||||
<keysym keyval="96">quoteleft</keysym>
|
||||
<keysym keyval="126">asciitilde</keysym>
|
||||
</key>
|
||||
<key keycode="10" name="AE01">
|
||||
<keysym keyval="49">1</keysym>
|
||||
<keysym keyval="33">exclam</keysym>
|
||||
</key>
|
||||
<key keycode="11" name="AE02">
|
||||
<keysym keyval="50">2</keysym>
|
||||
<keysym keyval="64">at</keysym>
|
||||
</key>
|
||||
<key keycode="12" name="AE03">
|
||||
<keysym keyval="51">3</keysym>
|
||||
<keysym keyval="35">numbersign</keysym>
|
||||
</key>
|
||||
<key keycode="13" name="AE04">
|
||||
<keysym keyval="52">4</keysym>
|
||||
<keysym keyval="36">dollar</keysym>
|
||||
</key>
|
||||
<key keycode="14" name="AE05">
|
||||
<keysym keyval="53">5</keysym>
|
||||
<keysym keyval="37">percent</keysym>
|
||||
<keysym keyval="8364">EuroSign</keysym>
|
||||
</key>
|
||||
<key keycode="15" name="AE06">
|
||||
<keysym keyval="54">6</keysym>
|
||||
<keysym keyval="94">asciicircum</keysym>
|
||||
</key>
|
||||
<key keycode="16" name="AE07">
|
||||
<keysym keyval="55">7</keysym>
|
||||
<keysym keyval="38">ampersand</keysym>
|
||||
</key>
|
||||
<key keycode="17" name="AE08">
|
||||
<keysym keyval="56">8</keysym>
|
||||
<keysym keyval="42">asterisk</keysym>
|
||||
</key>
|
||||
<key keycode="18" name="AE09">
|
||||
<keysym keyval="57">9</keysym>
|
||||
<keysym keyval="40">parenleft</keysym>
|
||||
</key>
|
||||
<key keycode="19" name="AE10">
|
||||
<keysym keyval="48">0</keysym>
|
||||
<keysym keyval="41">parenright</keysym>
|
||||
</key>
|
||||
<key keycode="20" name="AE11">
|
||||
<keysym keyval="45">minus</keysym>
|
||||
<keysym keyval="95">underscore</keysym>
|
||||
</key>
|
||||
<key keycode="21" name="AE12">
|
||||
<keysym keyval="61">equal</keysym>
|
||||
<keysym keyval="43">plus</keysym>
|
||||
</key>
|
||||
<key keycode="22" name="BKSP">
|
||||
<keysym keyval="65288" icon="edit-clear-symbolic">backspace</keysym>
|
||||
<keysym keyval="65288">BackSpace</keysym>
|
||||
</key>
|
||||
<key keycode="23" name="TAB">
|
||||
<keysym keyval="65289">Tab</keysym>
|
||||
@ -50,25 +103,21 @@
|
||||
<keysym keyval="113">q</keysym>
|
||||
<keysym keyval="81">Q</keysym>
|
||||
<keysym keyval="49">1</keysym>
|
||||
<keysym keyval="126">asciitilde</keysym>
|
||||
</key>
|
||||
<key keycode="25" name="AD02">
|
||||
<keysym keyval="119">w</keysym>
|
||||
<keysym keyval="87">W</keysym>
|
||||
<keysym keyval="50">2</keysym>
|
||||
<keysym keyval="96">quoteleft</keysym>
|
||||
</key>
|
||||
<key keycode="26" name="AD03">
|
||||
<keysym keyval="101">e</keysym>
|
||||
<keysym keyval="69">E</keysym>
|
||||
<keysym keyval="51">3</keysym>
|
||||
<keysym keyval="124">bar</keysym>
|
||||
</key>
|
||||
<key keycode="27" name="AD04">
|
||||
<keysym keyval="114">r</keysym>
|
||||
<keysym keyval="82">R</keysym>
|
||||
<keysym keyval="52">4</keysym>
|
||||
<keysym keyval="183">middledot</keysym>
|
||||
</key>
|
||||
<key keycode="28" name="AD05">
|
||||
<keysym keyval="116">t</keysym>
|
||||
@ -112,64 +161,52 @@
|
||||
<keysym keyval="92">backslash</keysym>
|
||||
<keysym keyval="124">bar</keysym>
|
||||
</key>
|
||||
<key keycode="0" name="ABC123">
|
||||
<symbol label="123">show-numbers</symbol>
|
||||
<symbol label="123">show-numbers</symbol>
|
||||
<symbol label="ABC">show-letters</symbol>
|
||||
<symbol label="ABC">show-letters</symbol>
|
||||
<key keycode="66" name="ALTGR">
|
||||
<keysym keyval="65027">ISO_Level3_Shift</keysym>
|
||||
</key>
|
||||
<key keycode="38" name="AC01">
|
||||
<keysym keyval="97">a</keysym>
|
||||
<keysym keyval="65">A</keysym>
|
||||
<keysym keyval="64">at</keysym>
|
||||
<keysym keyval="169">copyright</keysym>
|
||||
</key>
|
||||
<key keycode="39" name="AC02">
|
||||
<keysym keyval="115">s</keysym>
|
||||
<keysym keyval="83">S</keysym>
|
||||
<keysym keyval="35">numbersign</keysym>
|
||||
<keysym keyval="174">registeredtrademark</keysym>
|
||||
</key>
|
||||
<key keycode="40" name="AC03">
|
||||
<keysym keyval="100">d</keysym>
|
||||
<keysym keyval="68">D</keysym>
|
||||
<keysym keyval="36">dollar</keysym>
|
||||
<keysym keyval="163">poundsign</keysym>
|
||||
</key>
|
||||
<key keycode="41" name="AC04">
|
||||
<keysym keyval="102">f</keysym>
|
||||
<keysym keyval="70">F</keysym>
|
||||
<keysym keyval="37">percent</keysym>
|
||||
<text>€</text>
|
||||
</key>
|
||||
<key keycode="42" name="AC05">
|
||||
<keysym keyval="103">g</keysym>
|
||||
<keysym keyval="71">G</keysym>
|
||||
<keysym keyval="38">ampersand</keysym>
|
||||
<keysym keyval="165">yensign</keysym>
|
||||
</key>
|
||||
<key keycode="43" name="AC06">
|
||||
<keysym keyval="104">h</keysym>
|
||||
<keysym keyval="72">H</keysym>
|
||||
<keysym keyval="45">minus</keysym>
|
||||
<keysym keyval="94">asciicircum</keysym>
|
||||
</key>
|
||||
<key keycode="44" name="AC07">
|
||||
<keysym keyval="106">j</keysym>
|
||||
<keysym keyval="74">J</keysym>
|
||||
<keysym keyval="43">plus</keysym>
|
||||
<keysym keyval="176">degreesign</keysym>
|
||||
<keysym keyval="95">underscore</keysym>
|
||||
</key>
|
||||
<key keycode="45" name="AC08">
|
||||
<keysym keyval="107">k</keysym>
|
||||
<keysym keyval="75">K</keysym>
|
||||
<keysym keyval="40">parenleft</keysym>
|
||||
<keysym keyval="123">braceleft</keysym>
|
||||
</key>
|
||||
<key keycode="46" name="AC09">
|
||||
<keysym keyval="108">l</keysym>
|
||||
<keysym keyval="76">L</keysym>
|
||||
<keysym keyval="41">parenright</keysym>
|
||||
<keysym keyval="125">braceright</keysym>
|
||||
</key>
|
||||
<key keycode="47" name="AC10">
|
||||
@ -181,55 +218,45 @@
|
||||
<keysym keyval="34">quotedbl</keysym>
|
||||
</key>
|
||||
<key keycode="36" name="RTRN">
|
||||
<keysym keyval="65293" icon="key-enter">Return</keysym>
|
||||
<keysym keyval="65293">Return</keysym>
|
||||
</key>
|
||||
<key keycode="50" name="LFSH">
|
||||
<keysym keyval="65505" icon="key-shift">Shift_L</keysym>
|
||||
<keysym keyval="65505" icon="key-shift">Shift_L</keysym>
|
||||
<keysym keyval="65505" label="=/+">Shift_L</keysym>
|
||||
<keysym keyval="65505" label="123">Shift_L</keysym>
|
||||
<keysym keyval="65505">Shift_L</keysym>
|
||||
</key>
|
||||
<key keycode="52" name="AB01">
|
||||
<keysym keyval="122">z</keysym>
|
||||
<keysym keyval="90">Z</keysym>
|
||||
<keysym keyval="44">comma</keysym>
|
||||
<keysym keyval="92">backslash</keysym>
|
||||
<keysym keyval="43">plus</keysym>
|
||||
</key>
|
||||
<key keycode="53" name="AB02">
|
||||
<keysym keyval="120">x</keysym>
|
||||
<keysym keyval="88">X</keysym>
|
||||
<keysym keyval="34">quotedbl</keysym>
|
||||
<keysym keyval="47">slash</keysym>
|
||||
</key>
|
||||
<key keycode="54" name="AB03">
|
||||
<keysym keyval="99">c</keysym>
|
||||
<keysym keyval="67">C</keysym>
|
||||
<keysym keyval="39">quoteright</keysym>
|
||||
<keysym keyval="60">less</keysym>
|
||||
</key>
|
||||
<key keycode="55" name="AB04">
|
||||
<keysym keyval="118">v</keysym>
|
||||
<keysym keyval="86">V</keysym>
|
||||
<keysym keyval="58">colon</keysym>
|
||||
<keysym keyval="62">greater</keysym>
|
||||
</key>
|
||||
<key keycode="56" name="AB05">
|
||||
<keysym keyval="98">b</keysym>
|
||||
<keysym keyval="66">B</keysym>
|
||||
<keysym keyval="59">semicolon</keysym>
|
||||
<keysym keyval="61">equal</keysym>
|
||||
</key>
|
||||
<key keycode="57" name="AB06">
|
||||
<keysym keyval="110">n</keysym>
|
||||
<keysym keyval="78">N</keysym>
|
||||
<keysym keyval="33">exclam</keysym>
|
||||
<keysym keyval="91">bracketleft</keysym>
|
||||
</key>
|
||||
<key keycode="58" name="AB07">
|
||||
<keysym keyval="109">m</keysym>
|
||||
<keysym keyval="77">M</keysym>
|
||||
<keysym keyval="63">question</keysym>
|
||||
<keysym keyval="93">bracketright</keysym>
|
||||
</key>
|
||||
<key keycode="59" name="AB08">
|
||||
<keysym keyval="44">comma</keysym>
|
||||
@ -237,6 +264,7 @@
|
||||
</key>
|
||||
<key keycode="60" name="AB09">
|
||||
<keysym keyval="46">period</keysym>
|
||||
<keysym keyval="62">greater</keysym>
|
||||
</key>
|
||||
<key keycode="61" name="AB10">
|
||||
<keysym keyval="47">slash</keysym>
|
||||
@ -249,7 +277,7 @@
|
||||
<symbol label="⌨" icon="input-keyboard-symbolic" tooltip="Change keyboard">cycle-keyboard</symbol>
|
||||
</key>
|
||||
<key keycode="150" name="I150">
|
||||
<symbol label="☺" icon="keyboard-mode-symbolic" tooltip="Setup">preferences</symbol>
|
||||
<symbol label="☺" icon="preferences-system-symbolic" tooltip="Setup">preferences</symbol>
|
||||
</key>
|
||||
<key keycode="37" name="LCTL">
|
||||
<keysym keyval="65507">Control_L</keysym>
|
||||
|
||||
@ -1,12 +1,57 @@
|
||||
gnome = import('gnome')
|
||||
|
||||
squeekboard_resources = gnome.compile_resources(
|
||||
'squeekboard-resources',
|
||||
'squeekboard.gresources.xml',
|
||||
|
||||
c_name: 'squeekboard',
|
||||
install_data(
|
||||
'themes/default.css',
|
||||
install_dir: pkgdatadir + '/themes',
|
||||
)
|
||||
|
||||
install_data(
|
||||
'keyboards/keyboards.xml',
|
||||
install_dir: pkgdatadir + '/keyboards/',
|
||||
)
|
||||
|
||||
install_data(
|
||||
'keyboards/geometry/compact.xml',
|
||||
install_dir: pkgdatadir + '/keyboards/geometry/',
|
||||
)
|
||||
|
||||
symbols = [
|
||||
'ar.xml',
|
||||
'as-inscript.xml',
|
||||
'be.xml',
|
||||
'bn-inscript.xml',
|
||||
'fa.xml',
|
||||
'gu-inscript.xml',
|
||||
'he.xml',
|
||||
'hi-inscript.xml',
|
||||
'ja-kana.xml',
|
||||
'kk.xml',
|
||||
'kn-inscript.xml',
|
||||
'ks-inscript.xml',
|
||||
'ks.xml',
|
||||
'mai-inscript.xml',
|
||||
'ml-inscript.xml',
|
||||
'mr-inscript.xml',
|
||||
'my.xml',
|
||||
'or-inscript.xml',
|
||||
'pa-inscript.xml',
|
||||
'ru.xml',
|
||||
'sd-inscript.xml',
|
||||
'ta-inscript.xml',
|
||||
'te-inscript.xml',
|
||||
'th.xml',
|
||||
'ua.xml',
|
||||
'ug.xml',
|
||||
'us.xml',
|
||||
'zh-bopomofo.xml',
|
||||
]
|
||||
|
||||
foreach symbol: symbols
|
||||
install_data(
|
||||
'keyboards/symbols/' + symbol,
|
||||
install_dir: pkgdatadir + '/keyboards/symbols/',
|
||||
)
|
||||
endforeach
|
||||
|
||||
desktop_file = 'sm.puri.Squeekboard.desktop'
|
||||
|
||||
i18n.merge_file('desktop',
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/sm/puri/squeekboard">
|
||||
<file compressed="true">style.css</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/geometry/compact.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/keyboards.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ar.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/as-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/be.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/bn-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/fa.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/gu-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/he.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/hi-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ja-kana.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/kk.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/kn-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ks-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ks.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/mai-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ml-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/mr-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/my.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/or-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/pa-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ru.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/sd-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ta-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/te-inscript.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/th.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ua.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ug.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/us.xml</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/zh-bopomofo.xml</file>
|
||||
<file>icons/key-enter.svg</file>
|
||||
<file>icons/key-shift.svg</file>
|
||||
<file>icons/keyboard-mode-symbolic.svg</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
4
data/themes/Makefile.am
Normal file
@ -0,0 +1,4 @@
|
||||
themedir = $(pkgdatadir)/themes
|
||||
dist_theme_DATA = default.css
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
1
debian/control
vendored
@ -11,6 +11,7 @@ Build-Depends:
|
||||
libcroco3-dev,
|
||||
libwayland-dev (>= 1.16),
|
||||
rustc,
|
||||
virtboard,
|
||||
wayland-protocols (>= 1.14)
|
||||
Standards-Version: 4.1.3
|
||||
Homepage: https://source.puri.sm/Librem5/squeekboard
|
||||
|
||||
53
debian/copyright
vendored
@ -3,58 +3,7 @@ Upstream-Name: evscript
|
||||
Source: https://source.puri.sm/david.boddie/evscript
|
||||
|
||||
Files: *
|
||||
Copyright: 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
2010-2011 Red Hat, Inc.
|
||||
2019 Purism SPC
|
||||
License: GPL-3+
|
||||
|
||||
Files: eek/layersurface.c
|
||||
src/wayland.c
|
||||
src/key-emitter.c
|
||||
meson.build
|
||||
src/meson.build
|
||||
po/meson.build
|
||||
Copyright: 2018-2019 Purism SPC
|
||||
License: GPL-3+
|
||||
|
||||
Files: eekboard/keymap.c
|
||||
Copyright: 2000 Red Hat, Inc.
|
||||
2019 Purism, SPC
|
||||
License: LGPL-2+
|
||||
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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Files: protocols/wlr-layer-shell-unstable-v1.xml
|
||||
Copytight: Copyright © 2017 Drew DeVault
|
||||
License: X11
|
||||
Permission to use, copy, modify, distribute, and sell this software and
|
||||
its documentation for any purpose is hereby granted without fee, provided
|
||||
that the above copyright notice appear in all copies and fthat both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation, and that the name of the copyright holders not be used in
|
||||
advertising or publicity pertaining to distribution of the software
|
||||
without specific, written prior permission. The copyright holders make
|
||||
no representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied warranty.
|
||||
.
|
||||
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
||||
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
Copyright: 2019 Purism SPC
|
||||
License: GPL-3+
|
||||
This package is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
21
docs/Makefile.am
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
|
||||
SUBDIRS = reference
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
21
docs/reference/Makefile.am
Normal file
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
|
||||
SUBDIRS = eek eekboard
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
133
docs/reference/eek/Makefile.am
Normal file
@ -0,0 +1,133 @@
|
||||
# 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
|
||||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
# We require automake 1.6 at least.
|
||||
AUTOMAKE_OPTIONS = 1.6
|
||||
|
||||
# This is a blank Makefile.am for using gtk-doc.
|
||||
# Copy this to your project's API docs directory and modify the variables to
|
||||
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
|
||||
# of using the various options.
|
||||
|
||||
# The name of the module, e.g. 'glib'.
|
||||
DOC_MODULE=eek
|
||||
|
||||
# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
|
||||
#DOC_MODULE_VERSION=2
|
||||
|
||||
|
||||
# The top-level SGML file. You can change this if you want to.
|
||||
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
|
||||
|
||||
# The directory containing the source code. Relative to $(srcdir).
|
||||
# gtk-doc will search all .c & .h files beneath here for inline comments
|
||||
# documenting the functions and macros.
|
||||
# e.g. DOC_SOURCE_DIR=../../../gtk
|
||||
DOC_SOURCE_DIR=../../../eek
|
||||
|
||||
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
|
||||
SCANGOBJ_OPTIONS=
|
||||
|
||||
# Extra options to supply to gtkdoc-scan.
|
||||
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
|
||||
SCAN_OPTIONS=--rebuild-types --deprecated-guards="EEK_DISABLE_DEPRECATED"
|
||||
|
||||
# Extra options to supply to gtkdoc-mkdb.
|
||||
# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
|
||||
MKDB_OPTIONS=--sgml-mode --output-format=xml
|
||||
|
||||
# Extra options to supply to gtkdoc-mktmpl
|
||||
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
|
||||
MKTMPL_OPTIONS=
|
||||
|
||||
# Extra options to supply to gtkdoc-mkhtml
|
||||
MKHTML_OPTIONS=
|
||||
|
||||
# Extra options to supply to gtkdoc-fixref. Not normally needed.
|
||||
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
|
||||
FIXXREF_OPTIONS=
|
||||
|
||||
# Used for dependencies. The docs will be rebuilt if any of these change.
|
||||
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
|
||||
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
|
||||
HFILE_GLOB=$(top_srcdir)/eek/*.h
|
||||
CFILE_GLOB=$(top_srcdir)/eek/*.c
|
||||
|
||||
# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
|
||||
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
|
||||
EXTRA_HFILES=
|
||||
|
||||
# Header files to ignore when scanning. Use base file name, no paths
|
||||
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
|
||||
IGNORE_HFILES = \
|
||||
config.h \
|
||||
eek-renderer.h \
|
||||
eek-gtk-renderer.h \
|
||||
eek-theme.h \
|
||||
eek-theme-node.h \
|
||||
eek-enumtypes.h
|
||||
|
||||
# Images to copy into HTML directory.
|
||||
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
|
||||
HTML_IMAGES=
|
||||
|
||||
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
|
||||
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
|
||||
content_files=eek-overview.xml
|
||||
|
||||
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
|
||||
# These files must be listed here *and* in content_files
|
||||
# e.g. expand_content_files=running.sgml
|
||||
expand_content_files=eek-overview.xml
|
||||
|
||||
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
|
||||
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
|
||||
# signals and properties.
|
||||
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
|
||||
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
|
||||
GTKDOC_CFLAGS = $(GIO2_CFLAGS)
|
||||
GTKDOC_LIBS = $(top_builddir)/eek/libeek.la \
|
||||
$(top_builddir)/eek/libeek-gtk.la \
|
||||
$(top_builddir)/eek/libeek-xkl.la \
|
||||
$(GIO2_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
$(LIBXKLAVIER_LIBS)
|
||||
|
||||
# This includes the standard gtk-doc make rules, copied by gtkdocize.
|
||||
include $(top_srcdir)/gtk-doc.make
|
||||
|
||||
# Other files to distribute
|
||||
# e.g. EXTRA_DIST += version.xml.in
|
||||
EXTRA_DIST +=
|
||||
|
||||
# Files not to distribute
|
||||
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
|
||||
# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
|
||||
#DISTCLEANFILES +=
|
||||
|
||||
# Comment this out if you want your docs-status tested during 'make check'
|
||||
if ENABLE_GTK_DOC
|
||||
#TESTS_ENVIRONMENT = cd $(srcsrc) &&
|
||||
#TESTS = $(GTKDOC_CHECK)
|
||||
endif
|
||||
|
||||
-include $(top_srcdir)/gtk-doc.mk
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
122
docs/reference/eekboard/Makefile.am
Normal file
@ -0,0 +1,122 @@
|
||||
# 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
|
||||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
# We require automake 1.6 at least.
|
||||
AUTOMAKE_OPTIONS = 1.6
|
||||
|
||||
# This is a blank Makefile.am for using gtk-doc.
|
||||
# Copy this to your project's API docs directory and modify the variables to
|
||||
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
|
||||
# of using the various options.
|
||||
|
||||
# The name of the module, e.g. 'glib'.
|
||||
DOC_MODULE=eekboard
|
||||
|
||||
# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
|
||||
#DOC_MODULE_VERSION=2
|
||||
|
||||
|
||||
# The top-level SGML file. You can change this if you want to.
|
||||
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
|
||||
|
||||
# The directory containing the source code. Relative to $(srcdir).
|
||||
# gtk-doc will search all .c & .h files beneath here for inline comments
|
||||
# documenting the functions and macros.
|
||||
# e.g. DOC_SOURCE_DIR=../../../gtk
|
||||
DOC_SOURCE_DIR=../../../eekboard
|
||||
|
||||
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
|
||||
SCANGOBJ_OPTIONS=
|
||||
|
||||
# Extra options to supply to gtkdoc-scan.
|
||||
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
|
||||
SCAN_OPTIONS=
|
||||
|
||||
# Extra options to supply to gtkdoc-mkdb.
|
||||
# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
|
||||
MKDB_OPTIONS=--sgml-mode --output-format=xml
|
||||
|
||||
# Extra options to supply to gtkdoc-mktmpl
|
||||
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
|
||||
MKTMPL_OPTIONS=
|
||||
|
||||
# Extra options to supply to gtkdoc-mkhtml
|
||||
MKHTML_OPTIONS=
|
||||
|
||||
# Extra options to supply to gtkdoc-fixref. Not normally needed.
|
||||
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
|
||||
FIXXREF_OPTIONS=
|
||||
|
||||
# Used for dependencies. The docs will be rebuilt if any of these change.
|
||||
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
|
||||
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
|
||||
HFILE_GLOB=$(top_srcdir)/eekboard/*.h
|
||||
CFILE_GLOB=$(top_srcdir)/eekboard/*.c
|
||||
|
||||
# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
|
||||
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
|
||||
EXTRA_HFILES=
|
||||
|
||||
# Header files to ignore when scanning. Use base file name, no paths
|
||||
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
|
||||
IGNORE_HFILES=config.h eekboard.h
|
||||
|
||||
# Images to copy into HTML directory.
|
||||
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
|
||||
HTML_IMAGES=
|
||||
|
||||
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
|
||||
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
|
||||
# content_files=eekboard-overview.xml
|
||||
|
||||
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
|
||||
# These files must be listed here *and* in content_files
|
||||
# e.g. expand_content_files=running.sgml
|
||||
# expand_content_files=eekboard-overview.xml
|
||||
|
||||
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
|
||||
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
|
||||
# signals and properties.
|
||||
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
|
||||
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
|
||||
GTKDOC_CFLAGS = $(GIO2_CFLAGS)
|
||||
GTKDOC_LIBS = $(top_builddir)/eekboard/libeekboard.la $(GIO2_LIBS)
|
||||
|
||||
# This includes the standard gtk-doc make rules, copied by gtkdocize.
|
||||
include $(top_srcdir)/gtk-doc.make
|
||||
|
||||
# Other files to distribute
|
||||
# e.g. EXTRA_DIST += version.xml.in
|
||||
# EXTRA_DIST +=
|
||||
|
||||
# Files not to distribute
|
||||
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
|
||||
# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
|
||||
#DISTCLEANFILES +=
|
||||
|
||||
# Comment this out if you want your docs-status tested during 'make check'
|
||||
if ENABLE_GTK_DOC
|
||||
#TESTS_ENVIRONMENT = cd $(srcsrc) &&
|
||||
#TESTS = $(GTKDOC_CHECK)
|
||||
endif
|
||||
|
||||
-include $(top_srcdir)/gtk-doc.mk
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
298
eek/Makefile.am
Normal file
@ -0,0 +1,298 @@
|
||||
# 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
|
||||
|
||||
NULL =
|
||||
|
||||
lib_LTLIBRARIES = \
|
||||
libeek.la \
|
||||
libeek-gtk.la \
|
||||
libeek-xkl.la \
|
||||
$(NULL)
|
||||
|
||||
libeek_public_headers = \
|
||||
$(srcdir)/eek-layout.h \
|
||||
$(srcdir)/eek-element.h \
|
||||
$(srcdir)/eek-container.h \
|
||||
$(srcdir)/eek-keyboard.h \
|
||||
$(srcdir)/eek-section.h \
|
||||
$(srcdir)/eek-key.h \
|
||||
$(srcdir)/eek-symbol.h \
|
||||
$(srcdir)/eek-keysym.h \
|
||||
$(srcdir)/eek-text.h \
|
||||
$(srcdir)/eek-symbol-matrix.h \
|
||||
$(srcdir)/eek-types.h \
|
||||
$(srcdir)/eek-xml.h \
|
||||
$(srcdir)/eek-xml-layout.h \
|
||||
$(srcdir)/eek-serializable.h \
|
||||
$(srcdir)/eek-theme.h \
|
||||
$(srcdir)/eek.h \
|
||||
$(NULL)
|
||||
|
||||
libeek_private_headers = \
|
||||
$(srcdir)/eek-renderer.h \
|
||||
$(libeek_keysym_headers) \
|
||||
$(builddir)/eek-marshalers.h \
|
||||
$(srcdir)/eek-theme-context.h \
|
||||
$(srcdir)/eek-theme-private.h \
|
||||
$(srcdir)/eek-theme-node.h \
|
||||
$(NULL)
|
||||
|
||||
libeek_sources = \
|
||||
$(srcdir)/eek.c \
|
||||
$(srcdir)/eek-layout.c \
|
||||
$(srcdir)/eek-element.c \
|
||||
$(srcdir)/eek-container.c \
|
||||
$(srcdir)/eek-keyboard.c \
|
||||
$(srcdir)/eek-section.c \
|
||||
$(srcdir)/eek-key.c \
|
||||
$(srcdir)/eek-symbol-matrix.c \
|
||||
$(srcdir)/eek-symbol.c \
|
||||
$(srcdir)/eek-keysym.c \
|
||||
$(srcdir)/eek-text.c \
|
||||
$(srcdir)/eek-types.c \
|
||||
$(srcdir)/eek-serializable.c \
|
||||
$(srcdir)/eek-xml.c \
|
||||
$(srcdir)/eek-xml-layout.c \
|
||||
$(srcdir)/eek-renderer.c \
|
||||
$(srcdir)/eek-keyboard-drawing.c \
|
||||
$(srcdir)/eek-theme.c \
|
||||
$(srcdir)/eek-theme-context.c \
|
||||
$(srcdir)/eek-theme-node.c \
|
||||
$(NULL)
|
||||
|
||||
libeek_keysym_headers = \
|
||||
$(builddir)/eek-special-keysym-entries.h \
|
||||
$(builddir)/eek-unicode-keysym-entries.h \
|
||||
$(builddir)/eek-xkeysym-keysym-entries.h \
|
||||
$(NULL)
|
||||
|
||||
libeek_enumtypes_sources = \
|
||||
$(builddir)/eek-enumtypes.c \
|
||||
$(builddir)/eek-enumtypes.h \
|
||||
$(NULL)
|
||||
|
||||
libeek_marshalers_sources = \
|
||||
$(builddir)/eek-marshalers.c \
|
||||
$(builddir)/eek-marshalers.h \
|
||||
$(NULL)
|
||||
|
||||
BUILT_SOURCES = \
|
||||
$(libeek_keysym_headers) \
|
||||
$(libeek_enumtypes_sources) \
|
||||
$(libeek_marshalers_sources) \
|
||||
$(NULL)
|
||||
|
||||
libeek_la_SOURCES = \
|
||||
$(libeek_sources) \
|
||||
$(builddir)/eek-enumtypes.c \
|
||||
$(builddir)/eek-marshalers.c \
|
||||
$(NULL)
|
||||
|
||||
libeek_la_CFLAGS = \
|
||||
-DEEK_COMPILATION=1 \
|
||||
-DKEYBOARDSDIR=\"$(pkgdatadir)/keyboards\" \
|
||||
$(GIO2_CFLAGS) \
|
||||
$(PANGOCAIRO_CFLAGS) \
|
||||
$(LIBCROCO_CFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
libeek_la_LIBADD = \
|
||||
$(GIO2_LIBS) \
|
||||
$(PANGOCAIRO_LIBS) \
|
||||
$(LIBCROCO_LIBS) \
|
||||
-lm \
|
||||
$(NULL)
|
||||
|
||||
libeek_gtk_public_headers = \
|
||||
$(srcdir)/eek-gtk-keyboard.h \
|
||||
$(srcdir)/eek-gtk.h \
|
||||
$(NULL)
|
||||
libeek_gtk_private_headers = \
|
||||
$(srcdir)/eek-gtk-renderer.h \
|
||||
$(NULL)
|
||||
libeek_gtk_sources = \
|
||||
$(srcdir)/eek-gtk-keyboard.c \
|
||||
$(srcdir)/eek-gtk-renderer.c \
|
||||
$(NULL)
|
||||
|
||||
libeek_gtk_la_SOURCES = $(libeek_gtk_sources)
|
||||
libeek_gtk_la_CFLAGS = -DEEK_COMPILATION=1 $(GTK_CFLAGS) $(LIBCANBERRA_CFLAGS)
|
||||
libeek_gtk_la_LIBADD = libeek.la $(GTK_LIBS) $(LIBCANBERRA_LIBS)
|
||||
|
||||
libeek_xkl_public_headers = \
|
||||
$(srcdir)/eek-xkl-layout.h \
|
||||
$(srcdir)/eek-xkl.h \
|
||||
$(srcdir)/eek-xkb-layout.h \
|
||||
$(srcdir)/eek-xkb.h \
|
||||
$(NULL)
|
||||
|
||||
libeek_xkl_sources = \
|
||||
$(srcdir)/eek-xkb-layout.c \
|
||||
$(srcdir)/eek-xkl-layout.c \
|
||||
$(NULL)
|
||||
|
||||
libeek_xkl_la_SOURCES = $(libeek_xkl_sources)
|
||||
libeek_xkl_la_CFLAGS = -DEEK_COMPILATION=1 $(LIBXKLAVIER_CFLAGS)
|
||||
libeek_xkl_la_LIBADD = libeek.la $(LIBXKLAVIER_LIBS)
|
||||
|
||||
eekdir = $(includedir)/eek-$(EEK_API_VERSION)/eek
|
||||
eek_HEADERS = \
|
||||
$(libeek_public_headers) \
|
||||
$(builddir)/eek-enumtypes.h \
|
||||
$(libeek_gtk_public_headers) \
|
||||
$(libeek_xkl_public_headers) \
|
||||
$(NULL)
|
||||
|
||||
noinst_HEADERS = \
|
||||
$(libeek_private_headers) \
|
||||
$(libeek_gtk_private_headers) \
|
||||
$(libeek_xkl_private_headers) \
|
||||
$(NULL)
|
||||
|
||||
eek-special-keysym-entries.h: special-keysym-entries.txt
|
||||
$(AM_V_GEN) $(PYTHON) $(srcdir)/gen-keysym-entries.py \
|
||||
special_keysym_entries \
|
||||
< $< > $@
|
||||
eek-unicode-keysym-entries.h: unicode-keysym-entries.txt
|
||||
$(AM_V_GEN) $(PYTHON) $(srcdir)/gen-keysym-entries.py \
|
||||
unicode_keysym_entries \
|
||||
< $< > $@
|
||||
eek-xkeysym-keysym-entries.h: xkeysym-keysym-entries.txt
|
||||
$(AM_V_GEN) $(PYTHON) $(srcdir)/gen-keysym-entries.py \
|
||||
xkeysym_keysym_entries \
|
||||
< $< > $@
|
||||
|
||||
eek-enumtypes.h: $(libeek_public_headers) eek-enumtypes.h.template
|
||||
$(AM_V_GEN) $(GLIB_MKENUMS) \
|
||||
--template $(srcdir)/eek-enumtypes.h.template \
|
||||
$(libeek_public_headers) > eek-enumtypes.h.tmp && \
|
||||
mv eek-enumtypes.h.tmp eek-enumtypes.h
|
||||
|
||||
eek-enumtypes.c: $(libeek_public_headers) eek-enumtypes.c.template
|
||||
$(AM_V_GEN) $(GLIB_MKENUMS) \
|
||||
--template $(srcdir)/eek-enumtypes.c.template \
|
||||
$(libeek_public_headers) > eek-enumtypes.c.tmp && \
|
||||
mv eek-enumtypes.c.tmp eek-enumtypes.c
|
||||
|
||||
# gen marshal
|
||||
eek-marshalers.h: eek-marshalers.list
|
||||
$(AM_V_GEN) $(GLIB_GENMARSHAL) \
|
||||
--prefix=_eek_marshal $(srcdir)/eek-marshalers.list \
|
||||
--header --internal > $@.tmp && \
|
||||
mv $@.tmp $@
|
||||
|
||||
eek-marshalers.c: eek-marshalers.list eek-marshalers.h
|
||||
$(AM_V_GEN) (echo "#include \"eek-marshalers.h\""; \
|
||||
$(GLIB_GENMARSHAL) --prefix=_eek_marshal \
|
||||
$(srcdir)/eek-marshalers.list --body --internal) > $@.tmp && \
|
||||
mv $@.tmp $@
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = \
|
||||
eek-$(EEK_API_VERSION).pc \
|
||||
eek-gtk-$(EEK_API_VERSION).pc \
|
||||
eek-xkl-$(EEK_API_VERSION).pc \
|
||||
$(NULL)
|
||||
|
||||
CLEANFILES =
|
||||
|
||||
DISTCLEANFILES = \
|
||||
$(BUILT_SOURCES) \
|
||||
$(pkgconfig_DATA) \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DIST = \
|
||||
gen-keysym-entries.py \
|
||||
special-keysym-entries.txt \
|
||||
unicode-keysym-entries.txt \
|
||||
xkeysym-keysym-entries.txt \
|
||||
eek-enumtypes.h.template \
|
||||
eek-enumtypes.c.template \
|
||||
eek-marshalers.list \
|
||||
$(NULL)
|
||||
|
||||
-include $(INTROSPECTION_MAKEFILE)
|
||||
INTROSPECTION_GIRS =
|
||||
INTROSPECTION_SCANNER_ARGS = --add-include-path=$(builddir)
|
||||
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
|
||||
|
||||
if HAVE_INTROSPECTION
|
||||
|
||||
Eek@EEK_LIBRARY_SUFFIX@.gir: libeek.la
|
||||
Eek@EEK_LIBRARY_SUFFIX_U@_gir_SCANNERFLAGS = \
|
||||
--identifier-prefix=Eek \
|
||||
--symbol-prefix=eek \
|
||||
--pkg=glib-2.0 \
|
||||
--pkg-export=eek-$(EEK_API_VERSION) \
|
||||
$(NULL)
|
||||
Eek@EEK_LIBRARY_SUFFIX_U@_gir_INCLUDES = GLib-2.0 GObject-2.0 Gio-2.0
|
||||
Eek@EEK_LIBRARY_SUFFIX_U@_gir_CFLAGS = $(libeek_la_CFLAGS)
|
||||
Eek@EEK_LIBRARY_SUFFIX_U@_gir_LIBS = libeek.la
|
||||
Eek@EEK_LIBRARY_SUFFIX_U@_gir_FILES = \
|
||||
$(libeek_sources) \
|
||||
$(libeek_public_headers) \
|
||||
$(builddir)/eek-enumtypes.h \
|
||||
$(NULL)
|
||||
|
||||
EekGtk@EEK_LIBRARY_SUFFIX@.gir: libeek-gtk.la Eek@EEK_LIBRARY_SUFFIX@.gir
|
||||
EekGtk@EEK_LIBRARY_SUFFIX_U@_gir_SCANNERFLAGS = \
|
||||
--identifier-prefix=Eek \
|
||||
--symbol-prefix=eek \
|
||||
--pkg-export=eek-gtk-$(EEK_API_VERSION) \
|
||||
$(NULL)
|
||||
EekGtk@EEK_LIBRARY_SUFFIX_U@_gir_INCLUDES = \
|
||||
GObject-2.0 \
|
||||
Gtk-@GTK_API_VERSION@ \
|
||||
Eek@EEK_LIBRARY_SUFFIX@ \
|
||||
$(NULL)
|
||||
EekGtk@EEK_LIBRARY_SUFFIX_U@_gir_CFLAGS = $(libeek_gtk_la_CFLAGS)
|
||||
EekGtk@EEK_LIBRARY_SUFFIX_U@_gir_LIBS = libeek-gtk.la
|
||||
EekGtk@EEK_LIBRARY_SUFFIX_U@_gir_FILES = \
|
||||
$(libeek_gtk_sources) \
|
||||
$(libeek_gtk_public_headers) \
|
||||
$(NULL)
|
||||
|
||||
EekXkl@EEK_LIBRARY_SUFFIX@.gir: libeek-xkl.la Eek@EEK_LIBRARY_SUFFIX@.gir
|
||||
EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_SCANNERFLAGS = \
|
||||
--identifier-prefix=Eek \
|
||||
--symbol-prefix=eek \
|
||||
$(NULL)
|
||||
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_LIBS = libeek-xkl.la
|
||||
EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_FILES = \
|
||||
$(libeek_xkl_sources) \
|
||||
$(libeek_xkl_public_headers) \
|
||||
$(NULL)
|
||||
|
||||
INTROSPECTION_GIRS += \
|
||||
Eek@EEK_LIBRARY_SUFFIX@.gir \
|
||||
EekGtk@EEK_LIBRARY_SUFFIX@.gir \
|
||||
EekXkl@EEK_LIBRARY_SUFFIX@.gir \
|
||||
$(NULL)
|
||||
|
||||
girdir = $(datadir)/gir-1.0
|
||||
gir_DATA = $(INTROSPECTION_GIRS)
|
||||
|
||||
typelibdir = $(libdir)/girepository-1.0
|
||||
typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
|
||||
|
||||
CLEANFILES += $(gir_DATA) $(typelib_DATA)
|
||||
endif
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
0
eek/config.h
Normal file
@ -23,13 +23,14 @@
|
||||
* @short_description: a #GtkWidget displaying #EekKeyboard
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#ifdef HAVE_GSOUND
|
||||
#include <gsound.h>
|
||||
#ifdef HAVE_LIBCANBERRA
|
||||
#include <canberra-gtk.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "eek-gtk-keyboard.h"
|
||||
@ -55,10 +56,10 @@ typedef struct _EekGtkKeyboardPrivate
|
||||
{
|
||||
EekRenderer *renderer;
|
||||
EekKeyboard *keyboard;
|
||||
gulong key_locked_handler;
|
||||
gulong key_unlocked_handler;
|
||||
gulong symbol_index_changed_handler;
|
||||
EekTheme *theme;
|
||||
#ifdef HAVE_GSOUND
|
||||
GSoundContext *sound_ctx;
|
||||
#endif
|
||||
|
||||
GdkEventSequence *sequence; // unowned reference
|
||||
} EekGtkKeyboardPrivate;
|
||||
@ -122,8 +123,6 @@ eek_gtk_keyboard_real_draw (GtkWidget *self,
|
||||
eek_renderer_set_allocation_size (priv->renderer,
|
||||
allocation.width,
|
||||
allocation.height);
|
||||
eek_renderer_set_scale_factor (priv->renderer,
|
||||
gtk_widget_get_scale_factor (self));
|
||||
}
|
||||
|
||||
eek_renderer_render_keyboard (priv->renderer, cr);
|
||||
@ -330,23 +329,17 @@ eek_gtk_keyboard_set_keyboard (EekGtkKeyboard *self,
|
||||
EekKeyboard *keyboard)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
|
||||
|
||||
if (priv->keyboard == keyboard)
|
||||
return;
|
||||
|
||||
if (priv->keyboard) {
|
||||
g_signal_handlers_disconnect_by_data(priv->keyboard, self);
|
||||
g_object_unref (priv->keyboard);
|
||||
}
|
||||
|
||||
priv->keyboard = g_object_ref (keyboard);
|
||||
|
||||
g_signal_connect (priv->keyboard, "key-locked",
|
||||
G_CALLBACK(on_key_locked), self);
|
||||
g_signal_connect (priv->keyboard, "key-unlocked",
|
||||
G_CALLBACK(on_key_unlocked), self);
|
||||
g_signal_connect (priv->keyboard, "symbol-index-changed",
|
||||
G_CALLBACK(on_symbol_index_changed), self);
|
||||
priv->key_locked_handler =
|
||||
g_signal_connect (priv->keyboard, "key-locked",
|
||||
G_CALLBACK(on_key_locked), self);
|
||||
priv->key_unlocked_handler =
|
||||
g_signal_connect (priv->keyboard, "key-unlocked",
|
||||
G_CALLBACK(on_key_unlocked), self);
|
||||
priv->symbol_index_changed_handler =
|
||||
g_signal_connect (priv->keyboard, "symbol-index-changed",
|
||||
G_CALLBACK(on_symbol_index_changed), self);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -380,9 +373,21 @@ eek_gtk_keyboard_dispose (GObject *object)
|
||||
}
|
||||
|
||||
if (priv->keyboard) {
|
||||
if (g_signal_handler_is_connected (priv->keyboard,
|
||||
priv->key_locked_handler))
|
||||
g_signal_handler_disconnect (priv->keyboard,
|
||||
priv->key_locked_handler);
|
||||
if (g_signal_handler_is_connected (priv->keyboard,
|
||||
priv->key_unlocked_handler))
|
||||
g_signal_handler_disconnect (priv->keyboard,
|
||||
priv->key_unlocked_handler);
|
||||
if (g_signal_handler_is_connected (priv->keyboard,
|
||||
priv->symbol_index_changed_handler))
|
||||
g_signal_handler_disconnect (priv->keyboard,
|
||||
priv->symbol_index_changed_handler);
|
||||
|
||||
GList *list, *head;
|
||||
|
||||
g_signal_handlers_disconnect_by_data(priv->keyboard, self);
|
||||
list = eek_keyboard_get_pressed_keys (priv->keyboard);
|
||||
for (head = list; head; head = g_list_next (head)) {
|
||||
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekKey pressed");
|
||||
@ -439,16 +444,7 @@ eek_gtk_keyboard_class_init (EekGtkKeyboardClass *klass)
|
||||
static void
|
||||
eek_gtk_keyboard_init (EekGtkKeyboard *self)
|
||||
{
|
||||
#if HAVE_GSOUND
|
||||
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
|
||||
GError *err = NULL;
|
||||
|
||||
priv->sound_ctx = gsound_context_new(NULL, &err);
|
||||
if (!priv->sound_ctx) {
|
||||
g_warning ("GSound init failed: %s", err->message);
|
||||
g_clear_error (&err);
|
||||
}
|
||||
#endif
|
||||
/* void */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -495,27 +491,28 @@ render_pressed_key (GtkWidget *widget,
|
||||
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
|
||||
EekBounds bounds, large_bounds;
|
||||
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
cairo_region_t *region = gdk_window_get_clip_region (window);
|
||||
GdkDrawingContext *context = gdk_window_begin_draw_frame (window, region);
|
||||
cairo_t *cr = gdk_drawing_context_get_cairo_context (context);
|
||||
|
||||
eek_renderer_get_key_bounds (priv->renderer, key, &bounds, TRUE);
|
||||
magnify_bounds (widget, &bounds, &large_bounds, 1.5);
|
||||
|
||||
GdkWindow *window = GDK_DRAWABLE (gtk_widget_get_window (widget));
|
||||
cairo_region_t *region = gdk_window_get_clip_region (window);
|
||||
|
||||
GdkDrawingContext *context = gdk_window_begin_draw_frame(
|
||||
window, region
|
||||
);
|
||||
cairo_t *cr = gdk_drawing_context_get_cairo_context(context);
|
||||
cairo_save (cr);
|
||||
cairo_translate (cr, bounds.x, bounds.y);
|
||||
eek_renderer_render_key (priv->renderer, cr, key, 1.0, TRUE);
|
||||
cairo_restore (cr);
|
||||
/*
|
||||
|
||||
cairo_save (cr);
|
||||
cairo_translate (cr, large_bounds.x, large_bounds.y);
|
||||
eek_renderer_render_key (priv->renderer, cr, key, 1.5, TRUE);
|
||||
cairo_restore (cr);
|
||||
*/
|
||||
gdk_window_end_draw_frame (window, context);
|
||||
|
||||
cairo_region_destroy (region);
|
||||
gdk_window_end_draw_frame(window, context);
|
||||
cairo_region_destroy(region);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -538,7 +535,7 @@ render_locked_key (GtkWidget *widget,
|
||||
|
||||
gdk_window_end_draw_frame (window, context);
|
||||
|
||||
cairo_region_destroy (region);
|
||||
cairo_region_destroy(region);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -555,13 +552,25 @@ render_released_key (GtkWidget *widget,
|
||||
cairo_t *cr = gdk_drawing_context_get_cairo_context (context);
|
||||
|
||||
eek_renderer_get_key_bounds (priv->renderer, key, &bounds, TRUE);
|
||||
magnify_bounds (widget, &bounds, &large_bounds, 1.5);
|
||||
magnify_bounds (widget, &bounds, &large_bounds, 2.0);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
large_bounds.x,
|
||||
large_bounds.y,
|
||||
large_bounds.width,
|
||||
large_bounds.height);
|
||||
cairo_rectangle (cr,
|
||||
bounds.x,
|
||||
bounds.y,
|
||||
bounds.width,
|
||||
bounds.height);
|
||||
cairo_clip (cr);
|
||||
|
||||
eek_renderer_render_keyboard (priv->renderer, cr);
|
||||
|
||||
gdk_window_end_draw_frame (window, context);
|
||||
|
||||
cairo_region_destroy (region);
|
||||
cairo_region_destroy(region);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -575,14 +584,13 @@ on_key_pressed (EekKey *key,
|
||||
return;
|
||||
|
||||
render_pressed_key (GTK_WIDGET(self), key);
|
||||
gtk_widget_queue_draw (GTK_WIDGET(self));
|
||||
|
||||
#if HAVE_GSOUND
|
||||
g_return_if_fail (GSOUND_IS_CONTEXT (priv->sound_ctx));
|
||||
gsound_context_play_simple(priv->sound_ctx, NULL, NULL,
|
||||
GSOUND_ATTR_EVENT_ID, "button-pressed",
|
||||
GSOUND_ATTR_EVENT_DESCRIPTION, "Button pressed",
|
||||
NULL);
|
||||
#if HAVE_LIBCANBERRA
|
||||
ca_gtk_play_for_widget (widget, 0,
|
||||
CA_PROP_EVENT_ID, "button-pressed",
|
||||
CA_PROP_EVENT_DESCRIPTION, "virtual key pressed",
|
||||
CA_PROP_APPLICATION_ID, "org.fedorahosted.Eekboard",
|
||||
NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -597,14 +605,13 @@ on_key_released (EekKey *key,
|
||||
return;
|
||||
|
||||
render_released_key (GTK_WIDGET(self), key);
|
||||
gtk_widget_queue_draw (GTK_WIDGET(self));
|
||||
|
||||
#if HAVE_GSOUND
|
||||
g_return_if_fail (GSOUND_IS_CONTEXT (priv->sound_ctx));
|
||||
gsound_context_play_simple(priv->sound_ctx, NULL, NULL,
|
||||
GSOUND_ATTR_EVENT_ID, "button-released",
|
||||
GSOUND_ATTR_EVENT_DESCRIPTION, "Button released",
|
||||
NULL);
|
||||
#if HAVE_LIBCANBERRA
|
||||
ca_gtk_play_for_widget (widget, 0,
|
||||
CA_PROP_EVENT_ID, "button-released",
|
||||
CA_PROP_EVENT_DESCRIPTION, "virtual key pressed",
|
||||
CA_PROP_APPLICATION_ID, "org.fedorahosted.Eekboard",
|
||||
NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -621,7 +628,6 @@ on_key_locked (EekKeyboard *keyboard,
|
||||
return;
|
||||
|
||||
render_locked_key (widget, key);
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -637,7 +643,6 @@ on_key_unlocked (EekKeyboard *keyboard,
|
||||
return;
|
||||
|
||||
render_released_key (widget, key);
|
||||
gtk_widget_queue_draw (GTK_WIDGET(widget));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -30,29 +30,52 @@
|
||||
|
||||
G_DEFINE_TYPE (EekGtkRenderer, eek_gtk_renderer, EEK_TYPE_RENDERER);
|
||||
|
||||
static cairo_surface_t *
|
||||
pixbuf_to_cairo_surface (GdkPixbuf *pixbuf)
|
||||
{
|
||||
cairo_surface_t *dummy_surface;
|
||||
cairo_pattern_t *pattern;
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
|
||||
dummy_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
|
||||
|
||||
cr = cairo_create (dummy_surface);
|
||||
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
|
||||
pattern = cairo_get_source (cr);
|
||||
cairo_pattern_get_surface (pattern, &surface);
|
||||
cairo_surface_reference (surface);
|
||||
cairo_destroy (cr);
|
||||
cairo_surface_destroy (dummy_surface);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
eek_gtk_renderer_real_get_icon_surface (EekRenderer *self,
|
||||
const gchar *icon_name,
|
||||
gint size,
|
||||
gint scale)
|
||||
gint size)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GdkPixbuf *pixbuf;
|
||||
GError *error;
|
||||
cairo_surface_t *surface;
|
||||
|
||||
surface = gtk_icon_theme_load_surface (gtk_icon_theme_get_default (),
|
||||
icon_name,
|
||||
size,
|
||||
scale,
|
||||
NULL,
|
||||
0,
|
||||
&error);
|
||||
if (surface == NULL) {
|
||||
g_warning ("can't get icon surface for %s: %s",
|
||||
error = NULL;
|
||||
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
|
||||
icon_name,
|
||||
size,
|
||||
0,
|
||||
&error);
|
||||
if (pixbuf == NULL) {
|
||||
g_warning ("can't get icon pixbuf for %s: %s",
|
||||
icon_name,
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
surface = pixbuf_to_cairo_surface (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
return surface;
|
||||
}
|
||||
|
||||
@ -67,9 +90,6 @@ eek_gtk_renderer_class_init (EekGtkRendererClass *klass)
|
||||
static void
|
||||
eek_gtk_renderer_init (EekGtkRenderer *self)
|
||||
{
|
||||
GtkIconTheme *theme = gtk_icon_theme_get_default ();
|
||||
|
||||
gtk_icon_theme_add_resource_path (theme, "/sm/puri/squeekboard/icons");
|
||||
}
|
||||
|
||||
EekRenderer *
|
||||
|
||||
@ -53,15 +53,10 @@ enum {
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
VIEW_LETTERS_LOWER,
|
||||
VIEW_LETTERS_UPPER,
|
||||
VIEW_NUMBERS,
|
||||
VIEW_SYMBOLS
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
G_DEFINE_TYPE (EekKeyboard, eek_keyboard, EEK_TYPE_CONTAINER);
|
||||
|
||||
#define EEK_KEYBOARD_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_KEYBOARD, EekKeyboardPrivate))
|
||||
|
||||
@ -70,7 +65,6 @@ struct _EekKeyboardPrivate
|
||||
EekLayout *layout;
|
||||
EekModifierBehavior modifier_behavior;
|
||||
EekModifierType modifiers;
|
||||
unsigned int old_level;
|
||||
GList *pressed_keys;
|
||||
GList *locked_keys;
|
||||
GArray *outline_array;
|
||||
@ -81,8 +75,6 @@ struct _EekKeyboardPrivate
|
||||
EekModifierType alt_gr_mask;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (EekKeyboard, eek_keyboard, EEK_TYPE_CONTAINER);
|
||||
|
||||
G_DEFINE_BOXED_TYPE(EekModifierKey, eek_modifier_key,
|
||||
eek_modifier_key_copy, eek_modifier_key_free);
|
||||
|
||||
@ -211,58 +203,15 @@ eek_keyboard_get_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
set_level_from_modifiers (EekKeyboard *self, EekKey *key)
|
||||
set_level_from_modifiers (EekKeyboard *self)
|
||||
{
|
||||
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
|
||||
gint level = 0;
|
||||
|
||||
/* The levels are: 0 Letters, 1 Upper case letters, 2 Numbers, 3 Symbols */
|
||||
|
||||
/* Use the numbers/letters bit from the old level */
|
||||
gint level = priv->old_level & 2;
|
||||
|
||||
/* Handle non-emitting keys */
|
||||
if (key && (eek_key_get_keycode(key) == 0)) {
|
||||
const gchar *name = eek_element_get_name(EEK_ELEMENT(key));
|
||||
if (g_strcmp0(name, "ABC123") == 0)
|
||||
level ^= 2;
|
||||
}
|
||||
|
||||
level |= ((priv->modifiers & EEK_SHIFT_MASK) ? 1 : 0);
|
||||
|
||||
switch (priv->old_level) {
|
||||
case VIEW_LETTERS_UPPER:
|
||||
{
|
||||
/* Redirect upper case letters to numbers instead of symbols, clearing
|
||||
the shift modifier to keep the modifiers in sync with the level */
|
||||
if (level == VIEW_SYMBOLS) {
|
||||
level = VIEW_NUMBERS;
|
||||
priv->modifiers &= ~EEK_SHIFT_MASK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VIEW_SYMBOLS:
|
||||
{
|
||||
/* Redirect symbols to lower case letters instead of upper case,
|
||||
clearing the shift modifier to keep the modifiers in sync with the
|
||||
level */
|
||||
if (level == VIEW_LETTERS_UPPER) {
|
||||
level = VIEW_LETTERS_LOWER;
|
||||
priv->modifiers &= ~EEK_SHIFT_MASK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VIEW_LETTERS_LOWER: /* Direct transitions between views */
|
||||
case VIEW_NUMBERS:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (level == VIEW_NUMBERS || level == VIEW_SYMBOLS)
|
||||
priv->modifier_behavior = EEK_MODIFIER_BEHAVIOR_LOCK;
|
||||
else
|
||||
priv->modifier_behavior = EEK_MODIFIER_BEHAVIOR_LATCH;
|
||||
|
||||
priv->old_level = level;
|
||||
if (priv->modifiers & priv->alt_gr_mask)
|
||||
level |= 2;
|
||||
if (priv->modifiers & EEK_SHIFT_MASK)
|
||||
level |= 1;
|
||||
eek_element_set_level (EEK_ELEMENT(self), level);
|
||||
}
|
||||
|
||||
@ -318,7 +267,7 @@ void eek_keyboard_press_key(EekKeyboard *keyboard, EekKey *key, guint32 timestam
|
||||
EekModifierType modifier = eek_symbol_get_modifier_mask (symbol);
|
||||
if (priv->modifier_behavior == EEK_MODIFIER_BEHAVIOR_NONE) {
|
||||
set_modifiers_with_key (keyboard, key, priv->modifiers | modifier);
|
||||
set_level_from_modifiers (keyboard, key);
|
||||
set_level_from_modifiers (keyboard);
|
||||
}
|
||||
|
||||
// "Borrowed" from eek-context-service; doesn't influence the state but forwards the event
|
||||
@ -367,7 +316,7 @@ void eek_keyboard_release_key( EekKeyboard *keyboard,
|
||||
(priv->modifiers ^ modifier) & modifier);
|
||||
break;
|
||||
}
|
||||
set_level_from_modifiers (keyboard, key);
|
||||
set_level_from_modifiers (keyboard);
|
||||
|
||||
// "Borrowed" from eek-context-service; doesn't influence the state but forwards the event
|
||||
|
||||
@ -441,6 +390,9 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
|
||||
g_type_class_add_private (gobject_class,
|
||||
sizeof (EekKeyboardPrivate));
|
||||
|
||||
klass->create_section = eek_keyboard_real_create_section;
|
||||
|
||||
/* signals */
|
||||
@ -633,7 +585,7 @@ eek_keyboard_set_modifiers (EekKeyboard *keyboard,
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEYBOARD(keyboard));
|
||||
keyboard->priv->modifiers = modifiers;
|
||||
set_level_from_modifiers (keyboard, NULL);
|
||||
set_level_from_modifiers (keyboard);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
/*
|
||||
/*
|
||||
* 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
|
||||
@ -48,7 +48,6 @@ typedef struct _EekRendererPrivate
|
||||
gdouble allocation_width;
|
||||
gdouble allocation_height;
|
||||
gdouble scale;
|
||||
gint scale_factor; /* the outputs scale factor */
|
||||
|
||||
PangoFontDescription *ascii_font;
|
||||
PangoFontDescription *font;
|
||||
@ -110,7 +109,7 @@ create_keyboard_surface_key_callback (EekElement *element,
|
||||
cairo_save (data->cr);
|
||||
|
||||
eek_element_get_bounds (element, &bounds);
|
||||
cairo_translate (data->cr, bounds.x * priv->scale, bounds.y * priv->scale);
|
||||
cairo_translate (data->cr, bounds.x * priv->scale, bounds.y * priv->scale);
|
||||
cairo_rectangle (data->cr,
|
||||
0.0,
|
||||
0.0,
|
||||
@ -138,7 +137,7 @@ create_keyboard_surface_section_callback (EekElement *element,
|
||||
|
||||
angle = eek_section_get_angle (EEK_SECTION(element));
|
||||
cairo_rotate (data->cr, angle * G_PI / 180);
|
||||
|
||||
|
||||
eek_container_foreach_child (EEK_CONTAINER(element),
|
||||
create_keyboard_surface_key_callback,
|
||||
data);
|
||||
@ -163,14 +162,9 @@ create_keyboard_surface (EekRenderer *renderer)
|
||||
&background);
|
||||
|
||||
eek_element_get_bounds (EEK_ELEMENT(priv->keyboard), &bounds);
|
||||
|
||||
/* Create a surface that encompasses the dimensions of the keyboard as well
|
||||
as the margin around the edge. */
|
||||
keyboard_surface = cairo_image_surface_create (
|
||||
CAIRO_FORMAT_ARGB32,
|
||||
ceil(((bounds.x * 2) + bounds.width) * priv->scale),
|
||||
ceil(((bounds.y * 2) + bounds.height) * priv->scale));
|
||||
|
||||
keyboard_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
ceil(bounds.width * priv->scale),
|
||||
ceil(bounds.height * priv->scale));
|
||||
data.cr = cairo_create (keyboard_surface);
|
||||
data.renderer = renderer;
|
||||
|
||||
@ -219,7 +213,7 @@ render_key_outline (EekRenderer *renderer,
|
||||
outline = eek_keyboard_get_outline (priv->keyboard, oref);
|
||||
if (outline == NULL)
|
||||
return;
|
||||
|
||||
|
||||
theme_node = g_object_get_data (G_OBJECT(key),
|
||||
active ?
|
||||
"theme-node-pressed" :
|
||||
@ -249,9 +243,7 @@ render_key_outline (EekRenderer *renderer,
|
||||
border_color.alpha = foreground.alpha;
|
||||
}
|
||||
|
||||
eek_element_get_bounds(EEK_ELEMENT(key), &bounds);
|
||||
outline = eek_outline_copy (outline);
|
||||
|
||||
for (guint i = 0; i < outline->num_points; i++) {
|
||||
outline->points[i].x *= priv->scale;
|
||||
outline->points[i].y *= priv->scale;
|
||||
@ -465,8 +457,7 @@ render_key (EekRenderer *self,
|
||||
if (!outline_surface) {
|
||||
cairo_t *cr;
|
||||
|
||||
// Outline will be drawn on the outside of the button, so the
|
||||
// surface needs to be bigger than the button
|
||||
// Outline will be drawn on the outside of the button, so the surface needs to be bigger than the button
|
||||
outline_surface =
|
||||
cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
(int)ceil(bounds.width) + 10,
|
||||
@ -492,38 +483,44 @@ render_key (EekRenderer *self,
|
||||
cairo_set_source_surface (cr, outline_surface, 0.0, 0.0);
|
||||
cairo_paint (cr);
|
||||
|
||||
eek_renderer_get_foreground_color (self, EEK_ELEMENT(key), &foreground);
|
||||
/* render icon (if any) */
|
||||
symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
|
||||
if (!symbol)
|
||||
return;
|
||||
|
||||
#define SCALE 0.4
|
||||
if (eek_symbol_get_icon_name (symbol)) {
|
||||
gint scale = priv->scale_factor;
|
||||
cairo_surface_t *icon_surface =
|
||||
eek_renderer_get_icon_surface (self,
|
||||
eek_symbol_get_icon_name (symbol),
|
||||
SCALE * MIN(bounds.width, bounds.height),
|
||||
scale);
|
||||
MIN(bounds.width, bounds.height) * 0.7);
|
||||
if (icon_surface) {
|
||||
gint width = cairo_image_surface_get_width (icon_surface);
|
||||
gint height = cairo_image_surface_get_height (icon_surface);
|
||||
gdouble scale;
|
||||
|
||||
if (width < bounds.width && height < bounds.height)
|
||||
scale = 1;
|
||||
else {
|
||||
if (height * bounds.width / width <= bounds.height)
|
||||
scale = bounds.width / width;
|
||||
else if (width * bounds.height / height <= bounds.width)
|
||||
scale = bounds.height / height;
|
||||
else {
|
||||
if (width * bounds.height < height * bounds.width)
|
||||
scale = width / bounds.width;
|
||||
else
|
||||
scale = height / bounds.height;
|
||||
}
|
||||
}
|
||||
|
||||
cairo_save (cr);
|
||||
cairo_translate (cr,
|
||||
(bounds.width - width / scale) / 2,
|
||||
(bounds.height - height / scale) / 2);
|
||||
(bounds.width - width * scale) / 2,
|
||||
(bounds.height - height * scale) / 2);
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
cairo_clip (cr);
|
||||
/* Draw the shape of the icon using the foreground color */
|
||||
cairo_set_source_rgba (cr, foreground.red,
|
||||
foreground.green,
|
||||
foreground.blue,
|
||||
foreground.alpha);
|
||||
cairo_mask_surface (cr, icon_surface, 0.0, 0.0);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_set_source_surface (cr, icon_surface, 0.0, 0.0);
|
||||
cairo_paint (cr);
|
||||
cairo_restore (cr);
|
||||
return;
|
||||
}
|
||||
@ -540,6 +537,7 @@ render_key (EekRenderer *self,
|
||||
(bounds.width - extents.width / PANGO_SCALE) / 2,
|
||||
(bounds.height - extents.height / PANGO_SCALE) / 2);
|
||||
|
||||
eek_renderer_get_foreground_color (self, EEK_ELEMENT(key), &foreground);
|
||||
cairo_set_source_rgba (cr,
|
||||
foreground.red,
|
||||
foreground.green,
|
||||
@ -845,7 +843,6 @@ eek_renderer_init (EekRenderer *self)
|
||||
priv->allocation_width = 0.0;
|
||||
priv->allocation_height = 0.0;
|
||||
priv->scale = 1.0;
|
||||
priv->scale_factor = 1;
|
||||
priv->font = NULL;
|
||||
priv->outline_surface_cache =
|
||||
g_hash_table_new_full (g_direct_hash,
|
||||
@ -1030,15 +1027,6 @@ eek_renderer_get_scale (EekRenderer *renderer)
|
||||
return priv->scale;
|
||||
}
|
||||
|
||||
void
|
||||
eek_renderer_set_scale_factor (EekRenderer *renderer, gint scale)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_RENDERER(renderer));
|
||||
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
|
||||
priv->scale_factor = scale;
|
||||
}
|
||||
|
||||
PangoLayout *
|
||||
eek_renderer_create_pango_layout (EekRenderer *renderer)
|
||||
{
|
||||
@ -1082,8 +1070,7 @@ eek_renderer_render_key_outline (EekRenderer *renderer,
|
||||
cairo_surface_t *
|
||||
eek_renderer_get_icon_surface (EekRenderer *renderer,
|
||||
const gchar *icon_name,
|
||||
gint size,
|
||||
gint scale)
|
||||
gint size)
|
||||
{
|
||||
EekRendererClass *klass;
|
||||
|
||||
@ -1091,7 +1078,7 @@ eek_renderer_get_icon_surface (EekRenderer *renderer,
|
||||
|
||||
klass = EEK_RENDERER_GET_CLASS(renderer);
|
||||
if (klass->get_icon_surface)
|
||||
return klass->get_icon_surface (renderer, icon_name, size, scale);
|
||||
return klass->get_icon_surface (renderer, icon_name, size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -58,8 +58,7 @@ struct _EekRendererClass
|
||||
|
||||
cairo_surface_t *(* get_icon_surface) (EekRenderer *self,
|
||||
const gchar *icon_name,
|
||||
gint size,
|
||||
gint scale);
|
||||
gint size);
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
@ -82,8 +81,6 @@ void eek_renderer_get_key_bounds (EekRenderer *renderer,
|
||||
gboolean rotate);
|
||||
|
||||
gdouble eek_renderer_get_scale (EekRenderer *renderer);
|
||||
void eek_renderer_set_scale_factor (EekRenderer *renderer,
|
||||
gint scale);
|
||||
|
||||
PangoLayout *eek_renderer_create_pango_layout
|
||||
(EekRenderer *renderer);
|
||||
@ -106,8 +103,7 @@ void eek_renderer_render_key (EekRenderer *renderer,
|
||||
|
||||
cairo_surface_t *eek_renderer_get_icon_surface (EekRenderer *renderer,
|
||||
const gchar *icon_name,
|
||||
gint size,
|
||||
gint scale);
|
||||
gint size);
|
||||
|
||||
void eek_renderer_render_keyboard (EekRenderer *renderer,
|
||||
cairo_t *cr);
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
/*
|
||||
/*
|
||||
* 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
|
||||
@ -126,7 +126,7 @@ static EekKey *
|
||||
eek_section_real_create_key (EekSection *self,
|
||||
guint keycode,
|
||||
gint column_index,
|
||||
gint row_index)
|
||||
guint row_index)
|
||||
{
|
||||
EekKey *key;
|
||||
gint num_rows;
|
||||
|
||||
@ -89,6 +89,9 @@ static void eek_theme_node_finalize (GObject *object);
|
||||
|
||||
static const EekColor BLACK_COLOR = { 0, 0, 0, 0xff };
|
||||
static const EekColor TRANSPARENT_COLOR = { 0, 0, 0, 0 };
|
||||
static const EekColor DEFAULT_SUCCESS_COLOR = { 0x4e, 0x9a, 0x06, 0xff };
|
||||
static const EekColor DEFAULT_WARNING_COLOR = { 0xf5, 0x79, 0x3e, 0xff };
|
||||
static const EekColor DEFAULT_ERROR_COLOR = { 0xcc, 0x00, 0x00, 0xff };
|
||||
|
||||
static void
|
||||
eek_theme_node_init (EekThemeNode *self)
|
||||
|
||||
138
eek/eek-theme.c
@ -43,7 +43,6 @@
|
||||
* Copyright (C) 2003-2004 Dodji Seketeli. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#define G_LOG_DOMAIN "eek-theme"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -167,65 +166,103 @@ eek_theme_class_init (EekThemeClass *klass)
|
||||
|
||||
}
|
||||
|
||||
/* This is a workaround for a bug in libcroco < 0.6.2 where
|
||||
* function starting with 'r' (and 'u') are misparsed. We work
|
||||
* around this by exploiting the fact that libcroco is incomformant
|
||||
* with the CSS-spec and case sensitive and pre-convert all
|
||||
* occurrences of rgba to RGBA. Then we make our own parsing
|
||||
* code check for RGBA as well.
|
||||
*/
|
||||
#if LIBCROCO_VERSION_NUMBER < 602
|
||||
static gboolean
|
||||
is_identifier_character (char c)
|
||||
{
|
||||
/* Actual CSS rules allow for unicode > 0x00a1 and escaped
|
||||
* characters, but we'll assume we won't do that in our stylesheets
|
||||
* or at least not next to the string 'rgba'.
|
||||
*/
|
||||
return g_ascii_isalnum(c) || c == '-' || c == '_';
|
||||
}
|
||||
|
||||
static void
|
||||
convert_rgba_RGBA (char *buf)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = strstr (buf, "rgba");
|
||||
while (p)
|
||||
{
|
||||
/* Check if this looks like a complete token; this is to
|
||||
* avoiding mangling, say, a selector '.rgba-entry' */
|
||||
if (!((p > buf && is_identifier_character (*(p - 1))) ||
|
||||
(is_identifier_character (*(p + 4)))))
|
||||
memcpy(p, "RGBA", 4);
|
||||
p += 4;
|
||||
p = strstr (p, "rgba");
|
||||
}
|
||||
}
|
||||
|
||||
static CRStyleSheet *
|
||||
parse_stylesheet (const char *filename,
|
||||
GError **error)
|
||||
{
|
||||
enum CRStatus status;
|
||||
char *contents;
|
||||
gsize length;
|
||||
CRStyleSheet *stylesheet = NULL;
|
||||
|
||||
if (filename == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!g_file_get_contents (filename, &contents, &length, error))
|
||||
return NULL;
|
||||
|
||||
convert_rgba_RGBA (contents);
|
||||
|
||||
status = cr_om_parser_simply_parse_buf ((const guchar *) contents,
|
||||
length,
|
||||
CR_UTF_8,
|
||||
&stylesheet);
|
||||
g_free (contents);
|
||||
|
||||
if (status != CR_OK)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Error parsing stylesheet '%s'; errcode:%d", filename, status);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return stylesheet;
|
||||
}
|
||||
|
||||
CRDeclaration *
|
||||
_eek_theme_parse_declaration_list (const char *str)
|
||||
{
|
||||
char *copy = g_strdup (str);
|
||||
CRDeclaration *result;
|
||||
|
||||
convert_rgba_RGBA (copy);
|
||||
|
||||
result = cr_declaration_parse_list_from_buf ((const guchar *)copy,
|
||||
CR_UTF_8);
|
||||
g_free (copy);
|
||||
|
||||
return result;
|
||||
}
|
||||
#else /* LIBCROCO_VERSION_NUMBER >= 602 */
|
||||
static CRStyleSheet *
|
||||
parse_stylesheet (const char *filename,
|
||||
GError **error)
|
||||
{
|
||||
enum CRStatus status;
|
||||
CRStyleSheet *stylesheet;
|
||||
g_autoptr (GFileInputStream) stream = NULL;
|
||||
g_autoptr (GFileInfo) info = NULL;
|
||||
g_autoptr (GFile) file = NULL;
|
||||
g_autofree guchar* contents = NULL;
|
||||
goffset size;
|
||||
gsize out = 0;
|
||||
GError *err = NULL;
|
||||
|
||||
if (filename == NULL)
|
||||
return NULL;
|
||||
|
||||
g_debug ("Parsing %s", filename);
|
||||
if (g_strcmp0 (filename, "resource://") > 0) {
|
||||
file = g_file_new_for_uri (filename);
|
||||
stream = g_file_read (file, NULL, &err);
|
||||
if (!stream) {
|
||||
g_warning ("Failed to open %s: %s", filename, err->message);
|
||||
g_clear_error (&err);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
info = g_file_input_stream_query_info (stream,
|
||||
G_FILE_ATTRIBUTE_STANDARD_SIZE,
|
||||
NULL,
|
||||
&err);
|
||||
|
||||
if (!info) {
|
||||
g_warning ("Failed to stat %s: %s", filename, err->message);
|
||||
g_clear_error (&err);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size = g_file_info_get_size (info);
|
||||
contents = g_malloc0 (size);
|
||||
if (!g_input_stream_read_all (G_INPUT_STREAM (stream),
|
||||
contents,
|
||||
size,
|
||||
&out,
|
||||
NULL,
|
||||
&err)) {
|
||||
g_warning ("Failed to read %s: %s", filename, err->message);
|
||||
g_clear_error (&err);
|
||||
return NULL;
|
||||
}
|
||||
status = cr_om_parser_simply_parse_buf (contents,
|
||||
size,
|
||||
CR_UTF_8,
|
||||
&stylesheet);
|
||||
} else {
|
||||
status = cr_om_parser_simply_parse_file ((const guchar *) filename,
|
||||
CR_UTF_8,
|
||||
&stylesheet);
|
||||
}
|
||||
status = cr_om_parser_simply_parse_file ((const guchar *) filename,
|
||||
CR_UTF_8,
|
||||
&stylesheet);
|
||||
|
||||
if (status != CR_OK)
|
||||
{
|
||||
@ -243,6 +280,7 @@ _eek_theme_parse_declaration_list (const char *str)
|
||||
return cr_declaration_parse_list_from_buf ((const guchar *)str,
|
||||
CR_UTF_8);
|
||||
}
|
||||
#endif /* LIBCROCO_VERSION_NUMBER < 602 */
|
||||
|
||||
/* Just g_warning for now until we have something nicer to do */
|
||||
static CRStyleSheet *
|
||||
|
||||
30
eek/eek-xkb-0.90.pc.in
Normal file
@ -0,0 +1,30 @@
|
||||
# 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
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: libeek-xkb
|
||||
Description: A Library to Create Keyboard-like UI (XKB Support)
|
||||
URL: http://fedorahosted.org/eekboard/
|
||||
Version: @VERSION@
|
||||
Requires: eek-@EEK_API_VERSION@ gtk+-x11-@GTK_API_VERSION@
|
||||
Libs: -L${libdir} -leek-xkb
|
||||
Cflags: -I${includedir}/eek-@EEK_API_VERSION@
|
||||
684
eek/eek-xkb-layout.c
Normal file
@ -0,0 +1,684 @@
|
||||
/*
|
||||
* 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 "eek-xkb-layout.h"
|
||||
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/extensions/XKBgeom.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <gio/gio.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);
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DISPLAY,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
typedef 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;
|
||||
} EekXkbLayoutPrivate;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (EekXkbLayout, eek_xkb_layout, EEK_TYPE_LAYOUT,
|
||||
0, /* GTypeFlags */
|
||||
G_ADD_PRIVATE(EekXkbLayout)
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
|
||||
initable_iface_init))
|
||||
|
||||
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 = eek_xkb_layout_get_instance_private (layout);
|
||||
return n * priv->scale_numerator / priv->scale_denominator;
|
||||
}
|
||||
|
||||
G_INLINE_FUNC gdouble
|
||||
xkb_to_pixmap_double (EekXkbLayout *layout,
|
||||
gdouble d)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = eek_xkb_layout_get_instance_private (layout);
|
||||
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 = eek_xkb_layout_get_instance_private (layout);
|
||||
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 = eek_xkb_layout_get_instance_private (layout);
|
||||
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);
|
||||
|
||||
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 = eek_xkb_layout_get_instance_private (layout);
|
||||
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 (EekboardContextService *manager,
|
||||
EekLayout *self,
|
||||
gdouble initial_width,
|
||||
gdouble initial_height)
|
||||
{
|
||||
EekKeyboard *keyboard = g_object_new (EEK_TYPE_KEYBOARD, "layout", self, NULL);
|
||||
keyboard->manager = manager;
|
||||
|
||||
EekBounds bounds = {
|
||||
.x = 0.0,
|
||||
.y = 0.0,
|
||||
.width = initial_width,
|
||||
.height = initial_height
|
||||
};
|
||||
eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
|
||||
|
||||
/* resolve modifiers dynamically assigned at run time */
|
||||
EekXkbLayoutPrivate *priv = eek_xkb_layout_get_instance_private (
|
||||
EEK_XKB_LAYOUT(self));
|
||||
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_instance_private (
|
||||
EEK_XKB_LAYOUT (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);
|
||||
EekXkbLayoutPrivate *priv = eek_xkb_layout_get_instance_private (layout);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_DISPLAY:
|
||||
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);
|
||||
EekXkbLayoutPrivate *priv = eek_xkb_layout_get_instance_private (layout);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_DISPLAY:
|
||||
g_value_set_pointer (value, 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;
|
||||
|
||||
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)
|
||||
{
|
||||
/* void */
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_names_from_server (EekXkbLayout *layout,
|
||||
GError **error)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = eek_xkb_layout_get_instance_private (layout);
|
||||
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)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = eek_xkb_layout_get_instance_private (layout);
|
||||
|
||||
if (g_strcmp0 (names->keycodes, priv->names.keycodes)) {
|
||||
g_free (priv->names.keycodes);
|
||||
priv->names.keycodes = g_strdup (names->keycodes);
|
||||
}
|
||||
|
||||
if (g_strcmp0 (names->geometry, priv->names.geometry)) {
|
||||
g_free (priv->names.geometry);
|
||||
priv->names.geometry = g_strdup (names->geometry);
|
||||
}
|
||||
|
||||
if (g_strcmp0 (names->symbols, priv->names.symbols)) {
|
||||
g_free (priv->names.symbols);
|
||||
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 = eek_xkb_layout_get_instance_private (layout);
|
||||
|
||||
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 = eek_xkb_layout_get_instance_private (layout);
|
||||
|
||||
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 = eek_xkb_layout_get_instance_private (layout);
|
||||
|
||||
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;
|
||||
}
|
||||
55
eek/eek-xkb-layout.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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/XKBlib.h>
|
||||
#include "eek-layout.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EEK_TYPE_XKB_LAYOUT (eek_xkb_layout_get_type())
|
||||
G_DECLARE_DERIVABLE_TYPE (EekXkbLayout, eek_xkb_layout, EEK, XKB_LAYOUT, EekLayout)
|
||||
|
||||
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 */
|
||||
26
eek/eek-xkb.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#ifndef EEK_XKB_H
|
||||
#define EEK_XKB_H 1
|
||||
|
||||
#include "eek.h"
|
||||
#include "eek-xkb-layout.h"
|
||||
|
||||
#endif /* EEK_XKB_H */
|
||||
30
eek/eek-xkl-0.90.pc.in
Normal file
@ -0,0 +1,30 @@
|
||||
# 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
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: libeek-xkl
|
||||
Description: A Library to Create Keyboard-like UI (Libxklavier Support)
|
||||
URL: http://fedorahosted.org/eekboard/
|
||||
Version: @VERSION@
|
||||
Requires: eek-@EEK_API_VERSION@ libxklavier
|
||||
Libs: -L${libdir} -leek-xkl
|
||||
Cflags: -I${includedir}/eek-@EEK_API_VERSION@
|
||||
662
eek/eek-xkl-layout.c
Normal file
@ -0,0 +1,662 @@
|
||||
/*
|
||||
* 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);
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_MODEL,
|
||||
PROP_LAYOUTS,
|
||||
PROP_VARIANTS,
|
||||
PROP_OPTIONS,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
typedef struct _EekXklLayoutPrivate
|
||||
{
|
||||
XklEngine *engine;
|
||||
XklConfigRec *config;
|
||||
} EekXklLayoutPrivate;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (EekXklLayout, eek_xkl_layout, EEK_TYPE_XKB_LAYOUT,
|
||||
0, /* GTypeFlags */
|
||||
G_ADD_PRIVATE (EekXklLayout)
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
|
||||
initable_iface_init))
|
||||
|
||||
/* 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_instance_private (
|
||||
EEK_XKL_LAYOUT (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;
|
||||
|
||||
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)
|
||||
{
|
||||
/* void */
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_instance_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_instance_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_instance_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_instance_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_instance_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_instance_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_instance_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_instance_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_instance_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 = eek_xkl_layout_get_instance_private (layout);
|
||||
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);
|
||||
EekXklLayoutPrivate *priv = eek_xkl_layout_get_instance_private (layout);
|
||||
Display *display;
|
||||
|
||||
if (!parent_initable_iface->init (initable, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
priv->config = xkl_config_rec_new ();
|
||||
|
||||
g_object_get (G_OBJECT (initable),
|
||||
"display", &display,
|
||||
NULL);
|
||||
|
||||
priv->engine = xkl_engine_get_instance (display);
|
||||
|
||||
if (!xkl_config_rec_get_from_server (priv->config,
|
||||
priv->engine)) {
|
||||
g_set_error (error,
|
||||
EEK_ERROR,
|
||||
EEK_ERROR_LAYOUT_ERROR,
|
||||
"can't load libxklavier configuration");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
set_xkb_component_names (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;
|
||||
}
|
||||
|
||||
81
eek/eek-xkl-layout.h
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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())
|
||||
G_DECLARE_DERIVABLE_TYPE (EekXklLayout, eek_xkl_layout, EEK, XKL_LAYOUT, EekLayout)
|
||||
|
||||
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 */
|
||||
26
eek/eek-xkl.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#ifndef EEK_XKL_H
|
||||
#define EEK_XKL_H 1
|
||||
|
||||
#include "eek.h"
|
||||
#include "eek-xkl-layout.h"
|
||||
|
||||
#endif /* EEK_XKL_H */
|
||||
@ -1,7 +1,7 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
@ -25,7 +25,6 @@
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <gio/gio.h> /* GResource */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -36,8 +35,6 @@
|
||||
#include "eek-keysym.h"
|
||||
#include "eek-text.h"
|
||||
|
||||
#include "squeekboard-resources.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ID,
|
||||
@ -362,6 +359,8 @@ geometry_start_element_callback (GMarkupParseContext *pcontext,
|
||||
|
||||
if (g_strcmp0 (data->element_stack->data, "geometry") == 0)
|
||||
eek_element_set_bounds (EEK_ELEMENT(data->keyboard), &bounds);
|
||||
else if (g_strcmp0 (data->element_stack->data, "section") == 0)
|
||||
eek_element_set_bounds (EEK_ELEMENT(data->section), &bounds);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -452,7 +451,7 @@ geometry_start_element_callback (GMarkupParseContext *pcontext,
|
||||
"corner-radius");
|
||||
if (attribute != NULL)
|
||||
data->corner_radius = g_strtod (attribute, NULL);
|
||||
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1059,10 +1058,10 @@ initable_init (GInitable *initable,
|
||||
gchar *path;
|
||||
EekXmlKeyboardDesc *desc;
|
||||
|
||||
priv->keyboards_dir = g_strdup ((gchar *) g_getenv ("EEKBOARD_KEYBOARDSDIR"));
|
||||
|
||||
priv->keyboards_dir = (gchar *) g_getenv ("EEKBOARD_KEYBOARDSDIR");
|
||||
if (priv->keyboards_dir == NULL)
|
||||
priv->keyboards_dir = g_strdup ("resource:///sm/puri/squeekboard/keyboards/");
|
||||
priv->keyboards_dir = KEYBOARDSDIR;
|
||||
priv->keyboards_dir = g_strdup (priv->keyboards_dir);
|
||||
|
||||
path = g_build_filename (priv->keyboards_dir, "keyboards.xml", NULL);
|
||||
keyboards = parse_keyboards (path, error);
|
||||
@ -1113,7 +1112,7 @@ eek_xml_list_keyboards (void)
|
||||
|
||||
keyboards_dir = g_getenv ("EEKBOARD_KEYBOARDSDIR");
|
||||
if (keyboards_dir == NULL)
|
||||
keyboards_dir = g_strdup ("resource:///sm/puri/squeekboard/keyboards/");
|
||||
keyboards_dir = KEYBOARDSDIR;
|
||||
path = g_build_filename (keyboards_dir, "keyboards.xml", NULL);
|
||||
keyboards = parse_keyboards (path, NULL);
|
||||
g_free (path);
|
||||
@ -1182,9 +1181,7 @@ parse_geometry (const gchar *path, EekKeyboard *keyboard, GError **error)
|
||||
GFileInputStream *input;
|
||||
gboolean retval;
|
||||
|
||||
file = g_str_has_prefix (path, "resource://")
|
||||
? g_file_new_for_uri (path)
|
||||
: g_file_new_for_path (path);
|
||||
file = g_file_new_for_path (path);
|
||||
|
||||
input = g_file_read (file, NULL, error);
|
||||
g_object_unref (file);
|
||||
@ -1310,9 +1307,7 @@ parse_symbols (const gchar *path, EekKeyboard *keyboard, GError **error)
|
||||
GFileInputStream *input;
|
||||
gboolean retval;
|
||||
|
||||
file = g_str_has_prefix (path, "resource://")
|
||||
? g_file_new_for_uri (path)
|
||||
: g_file_new_for_path (path);
|
||||
file = g_file_new_for_path (path);
|
||||
|
||||
input = g_file_read (file, NULL, error);
|
||||
g_object_unref (file);
|
||||
@ -1345,9 +1340,7 @@ parse_prerequisites (const gchar *path, GError **error)
|
||||
GList *prerequisites;
|
||||
gboolean retval;
|
||||
|
||||
file = g_str_has_prefix (path, "resource://")
|
||||
? g_file_new_for_uri (path)
|
||||
: g_file_new_for_path (path);
|
||||
file = g_file_new_for_path (path);
|
||||
|
||||
input = g_file_read (file, NULL, error);
|
||||
g_object_unref (file);
|
||||
@ -1382,9 +1375,7 @@ parse_keyboards (const gchar *path, GError **error)
|
||||
GList *keyboards;
|
||||
gboolean retval;
|
||||
|
||||
file = g_str_has_prefix (path, "resource://")
|
||||
? g_file_new_for_uri (path)
|
||||
: g_file_new_for_path (path);
|
||||
file = g_file_new_for_path (path);
|
||||
|
||||
input = g_file_read (file, NULL, error);
|
||||
g_object_unref (file);
|
||||
@ -1461,7 +1452,7 @@ static void scale_keyboard (EekKeyboard *keyboard,
|
||||
for (i = 0; i < n_outlines; i++) {
|
||||
EekOutline *outline = eek_keyboard_get_outline (keyboard, i);
|
||||
gint j;
|
||||
|
||||
|
||||
for (j = 0; j < outline->num_points; j++) {
|
||||
outline->points[j].x *= scale;
|
||||
outline->points[j].y *= scale;
|
||||
|
||||
136
eekboard/Makefile.am
Normal file
@ -0,0 +1,136 @@
|
||||
# Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
|
||||
# Copyright (C) 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
|
||||
|
||||
NULL =
|
||||
|
||||
lib_LTLIBRARIES = libeekboard.la
|
||||
|
||||
libeekboard_headers = \
|
||||
$(srcdir)/eekboard-service.h \
|
||||
$(srcdir)/eekboard-context-service.h \
|
||||
$(srcdir)/eekboard-client.h \
|
||||
$(srcdir)/eekboard-context.h \
|
||||
$(srcdir)/eekboard-xklutil.h \
|
||||
$(NULL)
|
||||
|
||||
libeekboard_private_headers = \
|
||||
$(builddir)/eekboard-marshalers.h \
|
||||
$(NULL)
|
||||
|
||||
libeekboard_sources = \
|
||||
$(srcdir)/eekboard-service.c \
|
||||
$(srcdir)/eekboard-context-service.c \
|
||||
$(srcdir)/eekboard-client.c \
|
||||
$(srcdir)/eekboard-context.c \
|
||||
$(srcdir)/eekboard-xklutil.c \
|
||||
$(NULL)
|
||||
|
||||
libeekboard_marshalers_sources = \
|
||||
$(builddir)/eekboard-marshalers.c \
|
||||
$(builddir)/eekboard-marshalers.h \
|
||||
$(NULL)
|
||||
|
||||
BUILT_SOURCES = \
|
||||
$(libeekboard_marshalers_sources) \
|
||||
$(NULL)
|
||||
|
||||
libeekboard_la_SOURCES = \
|
||||
$(libeekboard_sources) \
|
||||
$(builddir)/eekboard-marshalers.c \
|
||||
$(NULL)
|
||||
|
||||
libeekboard_la_CFLAGS = \
|
||||
-DEEKBOARD_COMPILATION=1 \
|
||||
-DKEYBOARDDIR=\"$(pkgdatadir)/keyboards\" \
|
||||
-I$(top_srcdir) \
|
||||
$(GIO2_CFLAGS) \
|
||||
$(LIBXKLAVIER_CFLAGS) \
|
||||
$(NULL)
|
||||
libeekboard_la_LIBADD = \
|
||||
$(top_builddir)/eek/libeek.la \
|
||||
$(top_builddir)/eek/libeek-xkl.la \
|
||||
$(GIO2_LIBS) \
|
||||
$(LIBXKLAVIER_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
eekboarddir = $(includedir)/eekboard-$(EEK_API_VERSION)/eekboard
|
||||
eekboard_HEADERS = $(libeekboard_headers)
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = \
|
||||
eekboard-$(EEK_API_VERSION).pc \
|
||||
$(NULL)
|
||||
DISTCLEANFILES = \
|
||||
$(BUILT_SOURCES) \
|
||||
$(pkgconfig_DATA) \
|
||||
$(NULL)
|
||||
|
||||
CLEANFILES =
|
||||
|
||||
EXTRA_DIST = eekboard-marshalers.list
|
||||
|
||||
# gen marshal
|
||||
eekboard-marshalers.h: eekboard-marshalers.list
|
||||
$(AM_V_GEN) $(GLIB_GENMARSHAL) \
|
||||
--prefix=_eekboard_marshal \
|
||||
$(srcdir)/eekboard-marshalers.list --header --internal \
|
||||
> $@.tmp && \
|
||||
mv $@.tmp $@
|
||||
|
||||
eekboard-marshalers.c: eekboard-marshalers.list eekboard-marshalers.h
|
||||
$(AM_V_GEN) (echo "#include \"eekboard-marshalers.h\""; \
|
||||
$(GLIB_GENMARSHAL) \
|
||||
--prefix=_eekboard_marshal \
|
||||
$(srcdir)/eekboard-marshalers.list --body --internal) \
|
||||
> $@.tmp && \
|
||||
mv $@.tmp $@
|
||||
|
||||
-include $(INTROSPECTION_MAKEFILE)
|
||||
INTROSPECTION_GIRS =
|
||||
INTROSPECTION_SCANNER_ARGS = \
|
||||
--add-include-path=$(builddir) \
|
||||
--add-include-path=$(top_builddir)/eek \
|
||||
$(NULL)
|
||||
INTROSPECTION_COMPILER_ARGS = \
|
||||
--includedir=$(builddir) \
|
||||
--includedir=$(top_builddir)/eek \
|
||||
$(NULL)
|
||||
|
||||
if HAVE_INTROSPECTION
|
||||
Eekboard@EEK_LIBRARY_SUFFIX@.gir: libeekboard.la
|
||||
Eekboard@EEK_LIBRARY_SUFFIX_U@_gir_SCANNERFLAGS = \
|
||||
--identifier-prefix=Eekboard \
|
||||
--symbol-prefix=eekboard \
|
||||
$(NULL)
|
||||
Eekboard@EEK_LIBRARY_SUFFIX_U@_gir_INCLUDES = Eek@EEK_LIBRARY_SUFFIX@
|
||||
Eekboard@EEK_LIBRARY_SUFFIX_U@_gir_CFLAGS = $(libeekboard_la_CFLAGS)
|
||||
Eekboard@EEK_LIBRARY_SUFFIX_U@_gir_LIBS = libeekboard.la
|
||||
Eekboard@EEK_LIBRARY_SUFFIX_U@_gir_FILES = $(libeekboard_sources) $(libeekboard_headers)
|
||||
|
||||
INTROSPECTION_GIRS += Eekboard@EEK_LIBRARY_SUFFIX@.gir
|
||||
|
||||
girdir = $(datadir)/gir-1.0
|
||||
gir_DATA = $(INTROSPECTION_GIRS)
|
||||
|
||||
typelibdir = $(libdir)/girepository-1.0
|
||||
typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
|
||||
|
||||
CLEANFILES += $(gir_DATA) $(typelib_DATA)
|
||||
endif
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
404
eekboard/eekboard-client.c
Normal file
@ -0,0 +1,404 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:eekboard-client
|
||||
* @short_description: client interface of eekboard service
|
||||
*
|
||||
* The #EekboardClient class provides a client side access to eekboard-server.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "eekboard/eekboard-client.h"
|
||||
|
||||
enum {
|
||||
DESTROYED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
typedef struct _EekboardClientPrivate
|
||||
{
|
||||
GHashTable *context_hash;
|
||||
} EekboardClientPrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (EekboardClient, eekboard_client, G_TYPE_DBUS_PROXY)
|
||||
|
||||
static void send_destroy_context (EekboardClient *client,
|
||||
EekboardContext *context,
|
||||
GCancellable *cancellable);
|
||||
|
||||
static void
|
||||
eekboard_client_real_destroyed (EekboardClient *self)
|
||||
{
|
||||
EekboardClientPrivate *priv = eekboard_client_get_instance_private (self);
|
||||
|
||||
// g_debug ("eekboard_client_real_destroyed");
|
||||
g_hash_table_remove_all (priv->context_hash);
|
||||
}
|
||||
|
||||
static void
|
||||
eekboard_client_dispose (GObject *object)
|
||||
{
|
||||
EekboardClient *client = EEKBOARD_CLIENT(object);
|
||||
EekboardClientPrivate *priv = eekboard_client_get_instance_private (client);
|
||||
|
||||
if (priv->context_hash) {
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
||||
g_hash_table_iter_init (&iter, priv->context_hash);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
||||
send_destroy_context (client, (EekboardContext *)value, NULL);
|
||||
g_hash_table_iter_remove (&iter);
|
||||
}
|
||||
g_hash_table_destroy (priv->context_hash);
|
||||
priv->context_hash = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (eekboard_client_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eekboard_client_class_init (EekboardClientClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
klass->destroyed = eekboard_client_real_destroyed;
|
||||
|
||||
gobject_class->dispose = eekboard_client_dispose;
|
||||
|
||||
/**
|
||||
* EekboardClient::destroyed:
|
||||
* @eekboard: an #EekboardClient
|
||||
*
|
||||
* The ::destroyed signal is emitted each time the name of remote
|
||||
* end is vanished.
|
||||
*/
|
||||
signals[DESTROYED] =
|
||||
g_signal_new (I_("destroyed"),
|
||||
G_TYPE_FROM_CLASS(gobject_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET(EekboardClientClass, destroyed),
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE,
|
||||
0);
|
||||
}
|
||||
|
||||
static void
|
||||
eekboard_client_init (EekboardClient *self)
|
||||
{
|
||||
EekboardClientPrivate *priv = eekboard_client_get_instance_private (self);
|
||||
|
||||
priv->context_hash =
|
||||
g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
(GDestroyNotify)g_free,
|
||||
(GDestroyNotify)g_object_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
eekboard_name_vanished_callback (GDBusConnection *connection,
|
||||
const gchar *name,
|
||||
gpointer user_data)
|
||||
{
|
||||
EekboardClient *client = user_data;
|
||||
g_signal_emit_by_name (client, "destroyed", NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* eekboard_client_new:
|
||||
* @connection: a #GDBusConnection
|
||||
* @cancellable: a #GCancellable
|
||||
*
|
||||
* Create a client.
|
||||
*/
|
||||
EekboardClient *
|
||||
eekboard_client_new (GDBusConnection *connection,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
GInitable *initable;
|
||||
GError *error;
|
||||
|
||||
g_assert (G_IS_DBUS_CONNECTION(connection));
|
||||
|
||||
error = NULL;
|
||||
initable =
|
||||
g_initable_new (EEKBOARD_TYPE_CLIENT,
|
||||
cancellable,
|
||||
&error,
|
||||
"g-connection", connection,
|
||||
"g-name", "org.fedorahosted.Eekboard",
|
||||
"g-interface-name", "org.fedorahosted.Eekboard",
|
||||
"g-object-path", "/org/fedorahosted/Eekboard",
|
||||
NULL);
|
||||
if (initable != NULL) {
|
||||
EekboardClient *client = EEKBOARD_CLIENT (initable);
|
||||
gchar *name_owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY(client));
|
||||
if (name_owner == NULL) {
|
||||
g_object_unref (client);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* the vanished callback is called when the server is disconnected */
|
||||
g_bus_watch_name_on_connection (connection,
|
||||
name_owner,
|
||||
G_BUS_NAME_WATCHER_FLAGS_NONE,
|
||||
NULL,
|
||||
eekboard_name_vanished_callback,
|
||||
client,
|
||||
NULL);
|
||||
g_free (name_owner);
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
g_warning ("can't create client: %s", error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
on_context_destroyed (EekboardContext *context,
|
||||
gpointer user_data)
|
||||
{
|
||||
EekboardClient *client = user_data;
|
||||
EekboardClientPrivate *priv = eekboard_client_get_instance_private (client);
|
||||
|
||||
g_hash_table_remove (priv->context_hash,
|
||||
g_dbus_proxy_get_object_path (G_DBUS_PROXY(context)));
|
||||
}
|
||||
|
||||
/**
|
||||
* eekboard_client_create_context:
|
||||
* @eekboard: an #EekboardClient
|
||||
* @client_name: name of the client
|
||||
* @cancellable: a #GCancellable
|
||||
*
|
||||
* Create a new input context.
|
||||
*
|
||||
* Return value: (transfer full): a newly created #EekboardContext.
|
||||
*/
|
||||
EekboardContext *
|
||||
eekboard_client_create_context (EekboardClient *client,
|
||||
const gchar *client_name,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
GVariant *variant;
|
||||
const gchar *object_path;
|
||||
EekboardContext *context;
|
||||
GError *error;
|
||||
GDBusConnection *connection;
|
||||
|
||||
g_assert (EEKBOARD_IS_CLIENT(client));
|
||||
g_assert (client_name);
|
||||
|
||||
error = NULL;
|
||||
variant = g_dbus_proxy_call_sync (G_DBUS_PROXY(client),
|
||||
"CreateContext",
|
||||
g_variant_new ("(s)", client_name),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
cancellable,
|
||||
&error);
|
||||
if (!variant) {
|
||||
g_warning ("failed to call CreateContext: %s", error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_variant_get (variant, "(&s)", &object_path);
|
||||
connection = g_dbus_proxy_get_connection (G_DBUS_PROXY(client));
|
||||
context = eekboard_context_new (connection, object_path, cancellable);
|
||||
if (!context) {
|
||||
g_variant_unref (variant);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EekboardClientPrivate *priv = eekboard_client_get_instance_private (client);
|
||||
|
||||
g_hash_table_insert (priv->context_hash,
|
||||
g_strdup (object_path),
|
||||
g_object_ref (context));
|
||||
g_signal_connect (context, "destroyed",
|
||||
G_CALLBACK(on_context_destroyed), client);
|
||||
return context;
|
||||
}
|
||||
|
||||
static void
|
||||
eekboard_async_ready_callback (GObject *source_object,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GVariant *result;
|
||||
|
||||
result = g_dbus_proxy_call_finish (G_DBUS_PROXY(source_object),
|
||||
res,
|
||||
&error);
|
||||
if (result)
|
||||
g_variant_unref (result);
|
||||
else {
|
||||
g_warning ("error in D-Bus proxy call: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* eekboard_client_push_context:
|
||||
* @eekboard: an #EekboardClient
|
||||
* @context: an #EekboardContext
|
||||
* @cancellable: a #GCancellable
|
||||
*
|
||||
* Enable the input context @context and disable the others.
|
||||
*/
|
||||
void
|
||||
eekboard_client_push_context (EekboardClient *client,
|
||||
EekboardContext *context,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
const gchar *object_path;
|
||||
|
||||
g_return_if_fail (EEKBOARD_IS_CLIENT(client));
|
||||
g_return_if_fail (EEKBOARD_IS_CONTEXT(context));
|
||||
|
||||
EekboardClientPrivate *priv = eekboard_client_get_instance_private (client);
|
||||
|
||||
object_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY(context));
|
||||
|
||||
context = g_hash_table_lookup (priv->context_hash,
|
||||
object_path);
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
eekboard_context_set_enabled (context, TRUE);
|
||||
g_dbus_proxy_call (G_DBUS_PROXY(client),
|
||||
"PushContext",
|
||||
g_variant_new ("(s)", object_path),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
cancellable,
|
||||
eekboard_async_ready_callback,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* eekboard_client_pop_context:
|
||||
* @eekboard: an #EekboardClient
|
||||
* @cancellable: a #GCancellable
|
||||
*
|
||||
* Disable the current input context and enable the previous one.
|
||||
*/
|
||||
void
|
||||
eekboard_client_pop_context (EekboardClient *client,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
g_return_if_fail (EEKBOARD_IS_CLIENT(client));
|
||||
|
||||
g_dbus_proxy_call (G_DBUS_PROXY(client),
|
||||
"PopContext",
|
||||
NULL,
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
cancellable,
|
||||
eekboard_async_ready_callback,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
eekboard_client_show_keyboard (EekboardClient *client,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
g_return_if_fail (EEKBOARD_IS_CLIENT(client));
|
||||
|
||||
g_dbus_proxy_call (G_DBUS_PROXY(client),
|
||||
"ShowKeyboard",
|
||||
NULL,
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
cancellable,
|
||||
eekboard_async_ready_callback,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
eekboard_client_hide_keyboard (EekboardClient *client,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
g_return_if_fail (EEKBOARD_IS_CLIENT(client));
|
||||
|
||||
g_dbus_proxy_call (G_DBUS_PROXY(client),
|
||||
"HideKeyboard",
|
||||
NULL,
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
cancellable,
|
||||
eekboard_async_ready_callback,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
send_destroy_context (EekboardClient *client,
|
||||
EekboardContext *context,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
const gchar *object_path;
|
||||
|
||||
object_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY(context));
|
||||
|
||||
g_dbus_proxy_call (G_DBUS_PROXY(client),
|
||||
"DestroyContext",
|
||||
g_variant_new ("(s)", object_path),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
cancellable,
|
||||
eekboard_async_ready_callback,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* eekboard_client_destroy_context:
|
||||
* @eekboard: an #EekboardClient
|
||||
* @context: an #EekboardContext
|
||||
* @cancellable: a #GCancellable
|
||||
*
|
||||
* Remove @context from @eekboard.
|
||||
*/
|
||||
void
|
||||
eekboard_client_destroy_context (EekboardClient *client,
|
||||
EekboardContext *context,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
const gchar *object_path;
|
||||
|
||||
g_return_if_fail (EEKBOARD_IS_CLIENT(client));
|
||||
g_return_if_fail (EEKBOARD_IS_CONTEXT(context));
|
||||
|
||||
EekboardClientPrivate *priv = eekboard_client_get_instance_private (client);
|
||||
|
||||
object_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY(context));
|
||||
g_hash_table_remove (priv->context_hash, object_path);
|
||||
|
||||
send_destroy_context (client, context, cancellable);
|
||||
}
|
||||
64
eekboard/eekboard-client.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef EEKBOARD_CLIENT_H
|
||||
#define EEKBOARD_CLIENT_H 1
|
||||
|
||||
#define __EEKBOARD_CLIENT_H_INSIDE__ 1
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include "eekboard/eekboard-context.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EEKBOARD_TYPE_CLIENT (eekboard_client_get_type())
|
||||
G_DECLARE_DERIVABLE_TYPE (EekboardClient, eekboard_client, EEKBOARD, CLIENT, GDBusProxy)
|
||||
|
||||
struct _EekboardClientClass {
|
||||
/*< private >*/
|
||||
GDBusProxyClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (* destroyed) (EekboardClient *self);
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
gpointer pdummy[23];
|
||||
};
|
||||
|
||||
GType eekboard_client_get_type (void) G_GNUC_CONST;
|
||||
|
||||
EekboardClient *eekboard_client_new (GDBusConnection *connection,
|
||||
GCancellable *cancellable);
|
||||
EekboardContext *eekboard_client_create_context (EekboardClient *eekboard,
|
||||
const gchar *client_name,
|
||||
GCancellable *cancellable);
|
||||
void eekboard_client_push_context (EekboardClient *eekboard,
|
||||
EekboardContext *context,
|
||||
GCancellable *cancellable);
|
||||
void eekboard_client_pop_context (EekboardClient *eekboard,
|
||||
GCancellable *cancellable);
|
||||
void eekboard_client_show_keyboard (EekboardClient *eekboard,
|
||||
GCancellable *cancellable);
|
||||
void eekboard_client_hide_keyboard (EekboardClient *eekboard,
|
||||
GCancellable *cancellable);
|
||||
void eekboard_client_destroy_context (EekboardClient *eekboard,
|
||||
EekboardContext *context,
|
||||
GCancellable *cancellable);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEKBOARD_CLIENT_H */
|
||||
@ -1,7 +1,7 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
@ -82,9 +82,9 @@ struct _EekboardContextServicePrivate {
|
||||
GSettings *settings;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (EekboardContextService, eekboard_context_service, G_TYPE_OBJECT);
|
||||
G_DEFINE_TYPE (EekboardContextService, eekboard_context_service, G_TYPE_OBJECT);
|
||||
|
||||
/*static Display *display = NULL; */
|
||||
static Display *display = NULL;
|
||||
|
||||
static EekKeyboard *
|
||||
eekboard_context_service_real_create_keyboard (EekboardContextService *self,
|
||||
@ -150,14 +150,13 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
|
||||
rules.layout = strdup(keyboard_type);
|
||||
struct xkb_keymap *keymap = xkb_keymap_new_from_names(context, &rules,
|
||||
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||
xkb_context_unref(context);
|
||||
if (!keymap) {
|
||||
g_error("Bad keymap");
|
||||
}
|
||||
keyboard->keymap = keymap;
|
||||
char *keymap_str = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1);
|
||||
keyboard->keymap_len = strlen(keymap_str) + 1;
|
||||
g_autofree char *path = strdup("/eek_keymap-XXXXXX");
|
||||
char *path = strdup("/eek_keymap-XXXXXX");
|
||||
char *r = &path[strlen(path) - 6];
|
||||
getrandom(r, 6, GRND_NONBLOCK);
|
||||
for (uint i = 0; i < 6; i++) {
|
||||
@ -285,7 +284,6 @@ settings_get_layout(GSettings *settings, char **type, char **layout)
|
||||
}
|
||||
}
|
||||
g_variant_iter_free(iter);
|
||||
g_variant_unref(inputs);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -358,6 +356,9 @@ eekboard_context_service_class_init (EekboardContextServiceClass *klass)
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
|
||||
g_type_class_add_private (gobject_class,
|
||||
sizeof (EekboardContextServicePrivate));
|
||||
|
||||
klass->create_keyboard = eekboard_context_service_real_create_keyboard;
|
||||
klass->show_keyboard = eekboard_context_service_real_show_keyboard;
|
||||
klass->hide_keyboard = eekboard_context_service_real_hide_keyboard;
|
||||
@ -482,6 +483,51 @@ eekboard_context_service_init (EekboardContextService *self)
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean on_repeat_timeout (EekboardContextService *context);
|
||||
|
||||
static gboolean
|
||||
on_repeat_timeout (EekboardContextService *context)
|
||||
{
|
||||
guint delay = 500; // ms
|
||||
|
||||
// hardcoding; needs to connect to yet another settings path because
|
||||
// org.gnome.desktop.input-sources doesn't control repeating
|
||||
//g_settings_get (context->priv->settings, "repeat-interval", "u", &delay);
|
||||
|
||||
context->priv->repeat_timeout_id =
|
||||
g_timeout_add (delay,
|
||||
(GSourceFunc)on_repeat_timeout,
|
||||
context);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_repeat_timeout_init (EekboardContextService *context)
|
||||
{
|
||||
/* FIXME: clear modifiers for further key repeat; better not
|
||||
depend on modifier behavior is LATCH */
|
||||
eek_keyboard_set_modifiers (context->priv->keyboard, 0);
|
||||
|
||||
/* reschedule repeat timeout only when "repeat" option is set */
|
||||
/* TODO: org.gnome.desktop.input-sources doesn't have repeat info.
|
||||
* In addition, repeat is only useful when the keyboard is not in text
|
||||
* input mode */
|
||||
/*
|
||||
if (g_settings_get_boolean (context->priv->settings, "repeat")) {
|
||||
guint delay;
|
||||
|
||||
g_settings_get (context->priv->settings, "repeat-interval", "u", &delay);
|
||||
context->priv->repeat_timeout_id =
|
||||
g_timeout_add (delay,
|
||||
(GSourceFunc)on_repeat_timeout,
|
||||
context);
|
||||
} else */
|
||||
context->priv->repeat_timeout_id = 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* eekboard_context_service_enable:
|
||||
* @context: an #EekboardContextService
|
||||
@ -523,9 +569,7 @@ eekboard_context_service_show_keyboard (EekboardContextService *context)
|
||||
{
|
||||
g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE(context));
|
||||
|
||||
if (!context->priv->visible) {
|
||||
EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context)->show_keyboard (context);
|
||||
}
|
||||
EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context)->show_keyboard (context);
|
||||
}
|
||||
|
||||
void
|
||||
@ -533,9 +577,7 @@ eekboard_context_service_hide_keyboard (EekboardContextService *context)
|
||||
{
|
||||
g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE(context));
|
||||
|
||||
if (context->priv->visible) {
|
||||
EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context)->hide_keyboard (context);
|
||||
}
|
||||
EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context)->hide_keyboard (context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -135,11 +135,6 @@ eekboard_service_dispose (GObject *object)
|
||||
priv->introspection_data = NULL;
|
||||
}
|
||||
|
||||
if (priv->context) {
|
||||
g_signal_handlers_disconnect_by_data (priv->context, service);
|
||||
priv->context = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (eekboard_service_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@ -171,22 +166,6 @@ handle_set_visible(SmPuriOSK0 *object, GDBusMethodInvocation *invocation,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void on_visible(EekboardService *service,
|
||||
GParamSpec *pspec,
|
||||
EekboardContextService *context)
|
||||
{
|
||||
gboolean visible;
|
||||
EekboardServicePrivate *priv;
|
||||
|
||||
g_return_if_fail (EEKBOARD_IS_SERVICE (service));
|
||||
g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE (context));
|
||||
|
||||
priv = eekboard_service_get_instance_private (service);
|
||||
g_object_get (context, "visible", &visible, NULL);
|
||||
|
||||
sm_puri_osk0_set_visible(priv->dbus_interface, visible);
|
||||
}
|
||||
|
||||
static void
|
||||
eekboard_service_constructed (GObject *object)
|
||||
{
|
||||
@ -194,6 +173,7 @@ eekboard_service_constructed (GObject *object)
|
||||
EekboardServicePrivate *priv = eekboard_service_get_instance_private (service);
|
||||
|
||||
priv->dbus_interface = sm_puri_osk0_skeleton_new();
|
||||
sm_puri_osk0_set_visible(priv->dbus_interface, FALSE); // TODO: use actual value
|
||||
g_signal_connect(priv->dbus_interface, "handle-set-visible",
|
||||
G_CALLBACK(handle_set_visible), service);
|
||||
|
||||
@ -299,12 +279,5 @@ eekboard_service_set_context(EekboardService *service,
|
||||
{
|
||||
EekboardServicePrivate *priv = eekboard_service_get_instance_private (service);
|
||||
|
||||
g_return_if_fail (!priv->context);
|
||||
|
||||
priv->context = context;
|
||||
|
||||
g_signal_connect_swapped (priv->context,
|
||||
"notify::visible",
|
||||
G_CALLBACK(on_visible),
|
||||
service);
|
||||
}
|
||||
|
||||
168
eekboard/eekboard-xklutil.c
Normal file
@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 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
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "eekboard/eekboard-xklutil.h"
|
||||
|
||||
XklConfigRec *
|
||||
eekboard_xkl_config_rec_from_string (const gchar *layouts)
|
||||
{
|
||||
XklConfigRec *rec;
|
||||
gchar **strv, **l, **v;
|
||||
gint i;
|
||||
|
||||
strv = g_strsplit (layouts, "/", -1);
|
||||
g_return_val_if_fail (g_strv_length (strv) == 3, NULL);
|
||||
|
||||
l = g_strsplit (strv[1], ";", -1);
|
||||
v = g_strdupv (l);
|
||||
for (i = 0; l[i]; i++) {
|
||||
gchar *layout = l[i], *variant = v[i],
|
||||
*variant_start, *variant_end;
|
||||
|
||||
variant_start = strchr (layout, '(');
|
||||
variant_end = strrchr (layout, ')');
|
||||
if (variant_start && variant_end) {
|
||||
*variant_start++ = '\0';
|
||||
g_strlcpy (variant, variant_start,
|
||||
variant_end - variant_start + 1);
|
||||
} else
|
||||
*variant = '\0';
|
||||
}
|
||||
|
||||
rec = xkl_config_rec_new ();
|
||||
rec->model = g_strdup (strv[0]);
|
||||
rec->layouts = l;
|
||||
rec->variants = v;
|
||||
rec->options = g_strsplit (strv[2], ";", -1);
|
||||
g_strfreev (strv);
|
||||
|
||||
return rec;
|
||||
}
|
||||
|
||||
gchar *
|
||||
eekboard_xkl_config_rec_to_string (XklConfigRec *rec)
|
||||
{
|
||||
gchar **strv, **sp, **lp, **vp, *p;
|
||||
gint n_layouts;
|
||||
GString *str;
|
||||
|
||||
n_layouts = g_strv_length (rec->layouts);
|
||||
strv = g_malloc0_n (n_layouts + 2, sizeof (gchar *));
|
||||
for (sp = strv, lp = rec->layouts, vp = rec->variants; *lp; sp++, lp++) {
|
||||
if (*vp != NULL && **vp != '\0')
|
||||
*sp = g_strdup_printf ("%s(%s)", *lp, *vp++);
|
||||
else
|
||||
*sp = g_strdup_printf ("%s", *lp);
|
||||
}
|
||||
|
||||
/* MODEL/L0(V0);L1(V1);...;Ln(Vn)/O0;O1;...;On */
|
||||
str = g_string_new (rec->model);
|
||||
|
||||
g_string_append_c (str, '/');
|
||||
p = g_strjoinv (";", strv);
|
||||
g_strfreev (strv);
|
||||
g_string_append (str, p);
|
||||
g_free (p);
|
||||
|
||||
g_string_append_c (str, '/');
|
||||
p = g_strjoinv (";", rec->options);
|
||||
g_string_append (str, p);
|
||||
g_free (p);
|
||||
|
||||
return g_string_free (str,FALSE);
|
||||
}
|
||||
|
||||
static XklConfigItem *
|
||||
xkl_config_item_copy (const XklConfigItem *item)
|
||||
{
|
||||
XklConfigItem *_item = xkl_config_item_new ();
|
||||
memcpy (_item->name,
|
||||
item->name,
|
||||
sizeof (item->name));
|
||||
memcpy (_item->short_description,
|
||||
item->short_description,
|
||||
sizeof (item->short_description));
|
||||
memcpy (_item->description,
|
||||
item->description,
|
||||
sizeof (item->description));
|
||||
return _item;
|
||||
}
|
||||
|
||||
static void
|
||||
prepend_item (XklConfigRegistry *registry,
|
||||
const XklConfigItem *item,
|
||||
gpointer data)
|
||||
{
|
||||
GSList **list = data;
|
||||
XklConfigItem *_item = xkl_config_item_copy (item);
|
||||
*list = g_slist_prepend (*list, _item);
|
||||
}
|
||||
|
||||
static gint
|
||||
compare_item_by_name (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
const XklConfigItem *ia = a, *ib = b;
|
||||
return g_strcmp0 (ia->name, ib->name);
|
||||
}
|
||||
|
||||
GSList *
|
||||
eekboard_xkl_list_models (XklConfigRegistry *registry)
|
||||
{
|
||||
GSList *list = NULL;
|
||||
xkl_config_registry_foreach_model (registry, prepend_item, &list);
|
||||
return g_slist_sort (list, compare_item_by_name);
|
||||
}
|
||||
|
||||
GSList *
|
||||
eekboard_xkl_list_layouts (XklConfigRegistry *registry)
|
||||
{
|
||||
GSList *list = NULL;
|
||||
xkl_config_registry_foreach_layout (registry, prepend_item, &list);
|
||||
return g_slist_sort (list, compare_item_by_name);
|
||||
}
|
||||
|
||||
GSList *
|
||||
eekboard_xkl_list_option_groups (XklConfigRegistry *registry)
|
||||
{
|
||||
GSList *list = NULL;
|
||||
xkl_config_registry_foreach_option_group (registry, prepend_item, &list);
|
||||
return g_slist_sort (list, compare_item_by_name);
|
||||
}
|
||||
|
||||
GSList *
|
||||
eekboard_xkl_list_layout_variants (XklConfigRegistry *registry,
|
||||
const gchar *layout)
|
||||
{
|
||||
GSList *list = NULL;
|
||||
xkl_config_registry_foreach_layout_variant (registry,
|
||||
layout,
|
||||
prepend_item,
|
||||
&list);
|
||||
return g_slist_sort (list, compare_item_by_name);
|
||||
}
|
||||
|
||||
GSList *
|
||||
eekboard_xkl_list_options (XklConfigRegistry *registry,
|
||||
const gchar *group)
|
||||
{
|
||||
GSList *list = NULL;
|
||||
xkl_config_registry_foreach_option (registry, group, prepend_item, &list);
|
||||
return g_slist_sort (list, compare_item_by_name);
|
||||
}
|
||||
39
eekboard/eekboard-xklutil.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 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
|
||||
*/
|
||||
#ifndef EEKBOARD_XKLUTIL_H
|
||||
#define EEKBOARD_XKLUTIL_H 1
|
||||
|
||||
#include <libxklavier/xklavier.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
XklConfigRec *eekboard_xkl_config_rec_from_string (const gchar *layouts);
|
||||
gchar *eekboard_xkl_config_rec_to_string (XklConfigRec *rec);
|
||||
|
||||
GSList *eekboard_xkl_list_models (XklConfigRegistry *registry);
|
||||
GSList *eekboard_xkl_list_layouts (XklConfigRegistry *registry);
|
||||
GSList *eekboard_xkl_list_option_groups (XklConfigRegistry *registry);
|
||||
GSList *eekboard_xkl_list_layout_variants (XklConfigRegistry *registry,
|
||||
const gchar *layout);
|
||||
GSList *eekboard_xkl_list_options (XklConfigRegistry *registry,
|
||||
const gchar *group);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEKBOARD_XKLUTIL_H */
|
||||
@ -78,12 +78,11 @@ replace_keycode (SeatEmitter *emitter,
|
||||
guint keycode,
|
||||
guint *keysym)
|
||||
{
|
||||
/* GdkDisplay *display = gdk_display_get_default ();
|
||||
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
//Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
||||
guint old_keysym;
|
||||
int keysyms_per_keycode;
|
||||
KeySym *syms;
|
||||
*/
|
||||
return TRUE; // FIXME: no xkb allocated at the moment, pretending all is fine
|
||||
g_return_val_if_fail (emitter->xkb->min_key_code <= keycode &&
|
||||
keycode <= emitter->xkb->max_key_code,
|
||||
|
||||
3
examples/Makefile.am
Normal file
@ -0,0 +1,3 @@
|
||||
SUBDIRS = simple-client
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
3
examples/simple-client/Makefile.am
Normal file
@ -0,0 +1,3 @@
|
||||
EXTRA_DIST = simple-client
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
218
git.mk
Normal file
@ -0,0 +1,218 @@
|
||||
# git.mk
|
||||
#
|
||||
# Copyright 2009, Red Hat, Inc.
|
||||
# Copyright 2010,2011 Behdad Esfahbod
|
||||
# Written by Behdad Esfahbod
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification,
|
||||
# is permitted in any medium without royalty provided the copyright
|
||||
# notice and this notice are preserved.
|
||||
#
|
||||
# The canonical source for this file is https://github.com/behdad/git.mk.
|
||||
#
|
||||
# To use in your project, import this file in your git repo's toplevel,
|
||||
# then do "make -f git.mk". This modifies all Makefile.am files in
|
||||
# your project to -include git.mk. Remember to add that line to new
|
||||
# Makefile.am files you create in your project, or just rerun the
|
||||
# "make -f git.mk".
|
||||
#
|
||||
# This enables automatic .gitignore generation. If you need to ignore
|
||||
# more files, add them to the GITIGNOREFILES variable in your Makefile.am.
|
||||
# But think twice before doing that. If a file has to be in .gitignore,
|
||||
# chances are very high that it's a generated file and should be in one
|
||||
# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES.
|
||||
#
|
||||
# The only case that you need to manually add a file to GITIGNOREFILES is
|
||||
# when remove files in one of mostlyclean-local, clean-local, distclean-local,
|
||||
# or maintainer-clean-local make targets.
|
||||
#
|
||||
# Note that for files like editor backup, etc, there are better places to
|
||||
# ignore them. See "man gitignore".
|
||||
#
|
||||
# If "make maintainer-clean" removes the files but they are not recognized
|
||||
# by this script (that is, if "git status" shows untracked files still), send
|
||||
# me the output of "git status" as well as your Makefile.am and Makefile for
|
||||
# the directories involved and I'll diagnose.
|
||||
#
|
||||
# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
|
||||
# Makefile.am.sample in the git.mk git repo.
|
||||
#
|
||||
# Don't EXTRA_DIST this file. It is supposed to only live in git clones,
|
||||
# not tarballs. It serves no useful purpose in tarballs and clutters the
|
||||
# build dir.
|
||||
#
|
||||
# This file knows how to handle autoconf, automake, libtool, gtk-doc,
|
||||
# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu.
|
||||
#
|
||||
#
|
||||
# KNOWN ISSUES:
|
||||
#
|
||||
# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the
|
||||
# submodule doesn't find us. If you have configure.{in,ac} files in
|
||||
# subdirs, add a proxy git.mk file in those dirs that simply does:
|
||||
# "include $(top_srcdir)/../git.mk". Add more ..'s to your taste.
|
||||
# And add those files to git. See vte/gnome-pty-helper/git.mk for
|
||||
# example.
|
||||
#
|
||||
|
||||
git-all: git-mk-install
|
||||
|
||||
git-mk-install:
|
||||
@echo Installing git makefile
|
||||
@any_failed=; \
|
||||
find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \
|
||||
if grep 'include .*/git.mk' $$x >/dev/null; then \
|
||||
echo $$x already includes git.mk; \
|
||||
else \
|
||||
failed=; \
|
||||
echo "Updating $$x"; \
|
||||
{ cat $$x; \
|
||||
echo ''; \
|
||||
echo '-include $$(top_srcdir)/git.mk'; \
|
||||
} > $$x.tmp || failed=1; \
|
||||
if test x$$failed = x; then \
|
||||
mv $$x.tmp $$x || failed=1; \
|
||||
fi; \
|
||||
if test x$$failed = x; then : else \
|
||||
echo Failed updating $$x; >&2 \
|
||||
any_failed=1; \
|
||||
fi; \
|
||||
fi; done; test -z "$$any_failed"
|
||||
|
||||
.PHONY: git-all git-mk-install
|
||||
|
||||
|
||||
### .gitignore generation
|
||||
|
||||
$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
|
||||
$(AM_V_GEN) \
|
||||
{ \
|
||||
if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \
|
||||
for x in \
|
||||
$(DOC_MODULE)-decl-list.txt \
|
||||
$(DOC_MODULE)-decl.txt \
|
||||
tmpl/$(DOC_MODULE)-unused.sgml \
|
||||
"tmpl/*.bak" \
|
||||
xml html \
|
||||
; do echo /$$x; done; \
|
||||
fi; \
|
||||
if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
|
||||
for lc in $(DOC_LINGUAS); do \
|
||||
for x in \
|
||||
$(if $(DOC_MODULE),$(DOC_MODULE).xml) \
|
||||
$(DOC_PAGES) \
|
||||
$(DOC_INCLUDES) \
|
||||
; do echo /$$lc/$$x; done; \
|
||||
done; \
|
||||
for x in \
|
||||
$(_DOC_OMF_ALL) \
|
||||
$(_DOC_DSK_ALL) \
|
||||
$(_DOC_HTML_ALL) \
|
||||
$(_DOC_MOFILES) \
|
||||
$(DOC_H_FILE) \
|
||||
"*/.xml2po.mo" \
|
||||
"*/*.omf.out" \
|
||||
; do echo /$$x; done; \
|
||||
fi; \
|
||||
if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \
|
||||
for lc in $(HELP_LINGUAS); do \
|
||||
for x in \
|
||||
$(HELP_FILES) \
|
||||
"$$lc.stamp" \
|
||||
"$$lc.mo" \
|
||||
; do echo /$$lc/$$x; done; \
|
||||
done; \
|
||||
fi; \
|
||||
if test "x$(gsettings_SCHEMAS)" = x; then :; else \
|
||||
for x in \
|
||||
$(gsettings_SCHEMAS:.xml=.valid) \
|
||||
$(gsettings__enum_file) \
|
||||
; do echo /$$x; done; \
|
||||
fi; \
|
||||
if test -f $(srcdir)/po/Makefile.in.in; then \
|
||||
for x in \
|
||||
po/Makefile.in.in \
|
||||
po/Makefile.in \
|
||||
po/Makefile \
|
||||
po/POTFILES \
|
||||
po/stamp-it \
|
||||
po/.intltool-merge-cache \
|
||||
"po/*.gmo" \
|
||||
"po/*.mo" \
|
||||
po/$(GETTEXT_PACKAGE).pot \
|
||||
intltool-extract.in \
|
||||
intltool-merge.in \
|
||||
intltool-update.in \
|
||||
; do echo /$$x; done; \
|
||||
fi; \
|
||||
if test -f $(srcdir)/configure; then \
|
||||
for x in \
|
||||
autom4te.cache \
|
||||
configure \
|
||||
config.h \
|
||||
stamp-h1 \
|
||||
libtool \
|
||||
config.lt \
|
||||
; do echo /$$x; done; \
|
||||
fi; \
|
||||
if test "x$(DEJATOOL)" = x; then :; else \
|
||||
for x in \
|
||||
$(DEJATOOL) \
|
||||
; do echo /$$x.sum; echo /$$x.log; done; \
|
||||
echo /site.exp; \
|
||||
fi; \
|
||||
for x in \
|
||||
.gitignore \
|
||||
$(GITIGNOREFILES) \
|
||||
$(CLEANFILES) \
|
||||
$(PROGRAMS) \
|
||||
$(check_PROGRAMS) \
|
||||
$(EXTRA_PROGRAMS) \
|
||||
$(LTLIBRARIES) \
|
||||
so_locations \
|
||||
.libs _libs \
|
||||
$(MOSTLYCLEANFILES) \
|
||||
"*.$(OBJEXT)" \
|
||||
"*.lo" \
|
||||
$(DISTCLEANFILES) \
|
||||
$(am__CONFIG_DISTCLEAN_FILES) \
|
||||
$(CONFIG_CLEAN_FILES) \
|
||||
TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
|
||||
"*.tab.c" \
|
||||
$(MAINTAINERCLEANFILES) \
|
||||
$(BUILT_SOURCES) \
|
||||
$(DEPDIR) \
|
||||
Makefile \
|
||||
Makefile.in \
|
||||
"*.orig" \
|
||||
"*.rej" \
|
||||
"*.bak" \
|
||||
"*~" \
|
||||
".*.sw[nop]" \
|
||||
".dirstamp" \
|
||||
; do echo /$$x; done; \
|
||||
} | \
|
||||
sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
|
||||
sed 's@/[.]/@/@g' | \
|
||||
LC_ALL=C sort | uniq > $@.tmp && \
|
||||
mv $@.tmp $@;
|
||||
|
||||
all: $(srcdir)/.gitignore gitignore-recurse-maybe
|
||||
gitignore-recurse-maybe:
|
||||
@if test "x$(SUBDIRS)" = "x$(DIST_SUBDIRS)"; then :; else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) gitignore-recurse; \
|
||||
fi;
|
||||
gitignore-recurse:
|
||||
@for subdir in $(DIST_SUBDIRS); do \
|
||||
case " $(SUBDIRS) " in \
|
||||
*" $$subdir "*) :;; \
|
||||
*) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir");; \
|
||||
esac; \
|
||||
done
|
||||
gitignore: $(srcdir)/.gitignore gitignore-recurse
|
||||
|
||||
maintainer-clean: gitignore-clean
|
||||
gitignore-clean:
|
||||
-rm -f $(srcdir)/.gitignore
|
||||
|
||||
.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe
|
||||
20
meson.build
@ -3,14 +3,12 @@ project(
|
||||
'c', 'rust',
|
||||
version: '1.0.10',
|
||||
license: 'GPLv3',
|
||||
meson_version: '>=0.49.0',
|
||||
meson_version: '>=0.43.0',
|
||||
default_options: [ 'warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11' ],
|
||||
)
|
||||
|
||||
i18n = import('i18n')
|
||||
|
||||
conf_data = configuration_data()
|
||||
|
||||
if get_option('buildtype').startswith('debug')
|
||||
add_project_arguments('-DDEBUG=1', language : 'c')
|
||||
endif
|
||||
@ -28,22 +26,6 @@ else
|
||||
endif
|
||||
dbusdir = join_paths(depdatadir, 'dbus-1/interfaces')
|
||||
|
||||
gsound_dep = dependency('gsound', required : false)
|
||||
if gsound_dep.found()
|
||||
conf_data.set10('HAVE_GSOUND', true)
|
||||
endif
|
||||
|
||||
summary = [
|
||||
'',
|
||||
'------------------',
|
||||
'squeekboard @0@'.format(meson.project_version()),
|
||||
'',
|
||||
' gsound: @0@'.format(conf_data.get('HAVE_GSOUND', false)),
|
||||
'------------------',
|
||||
''
|
||||
]
|
||||
message('\n'.join(summary))
|
||||
|
||||
subdir('data')
|
||||
subdir('protocols')
|
||||
subdir('eek')
|
||||
|
||||
96
src/Makefile.am
Normal file
@ -0,0 +1,96 @@
|
||||
# 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
|
||||
|
||||
bin_PROGRAMS = \
|
||||
eekboard \
|
||||
$(NULL)
|
||||
|
||||
libexec_PROGRAMS = \
|
||||
eekboard-setup \
|
||||
$(NULL)
|
||||
|
||||
eekboard_CFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(GIO2_CFLAGS) \
|
||||
$(GTK_CFLAGS) \
|
||||
$(XKB_CFLAGS) \
|
||||
$(LIBXKLAVIER_CFLAGS) \
|
||||
-DLIBEXECDIR=\"$(libexecdir)\" \
|
||||
$(NULL)
|
||||
|
||||
eekboard_LDADD = \
|
||||
$(top_builddir)/eekboard/libeekboard.la \
|
||||
$(top_builddir)/eek/libeek.la \
|
||||
$(top_builddir)/eek/libeek-xkl.la \
|
||||
$(GIO2_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
$(XKB_LIBS) \
|
||||
$(LIBXKLAVIER_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
if ENABLE_XTEST
|
||||
eekboard_CFLAGS += $(XTEST_CFLAGS)
|
||||
eekboard_LDADD += $(XTEST_LIBS)
|
||||
endif
|
||||
|
||||
if ENABLE_ATSPI
|
||||
eekboard_CFLAGS += $(ATSPI2_CFLAGS)
|
||||
eekboard_LDADD += $(ATSPI2_LIBS)
|
||||
endif
|
||||
|
||||
eekboard_headers = \
|
||||
client.h \
|
||||
$(NULL)
|
||||
|
||||
eekboard_SOURCES = \
|
||||
client.c \
|
||||
client-main.c \
|
||||
$(NULL)
|
||||
|
||||
eekboard_setup_CFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(GIO2_CFLAGS) \
|
||||
$(GTK_CFLAGS) \
|
||||
$(XKB_CFLAGS) \
|
||||
$(LIBXKLAVIER_CFLAGS) \
|
||||
-DPKGDATADIR=\"$(pkgdatadir)\" \
|
||||
$(NULL)
|
||||
|
||||
eekboard_setup_headers = \
|
||||
preferences-dialog.h \
|
||||
$(NULL)
|
||||
|
||||
eekboard_setup_SOURCES = \
|
||||
preferences-dialog.c \
|
||||
setup-main.c \
|
||||
$(NULL)
|
||||
|
||||
eekboard_setup_LDADD = \
|
||||
$(top_builddir)/eek/libeek.la \
|
||||
$(GIO2_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
dist_pkgdata_DATA = preferences-dialog.ui
|
||||
|
||||
noinst_HEADERS = \
|
||||
$(eekboard_headers) \
|
||||
$(eekboard_setup_headers) \
|
||||
$(NULL)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
320
src/client-main.c
Normal file
@ -0,0 +1,320 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_ATSPI
|
||||
#include <dbus/dbus.h>
|
||||
#include <atspi/atspi.h>
|
||||
#endif /* HAVE_ATSPI */
|
||||
#ifdef HAVE_IBUS
|
||||
#include <ibus.h>
|
||||
#endif /* HAVE_IBUS */
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include "eekboard/eekboard-client.h"
|
||||
#include "client.h"
|
||||
|
||||
static gboolean opt_system = FALSE;
|
||||
static gboolean opt_session = FALSE;
|
||||
static gchar *opt_address = NULL;
|
||||
|
||||
static gboolean opt_focus = FALSE;
|
||||
#ifdef HAVE_ATSPI
|
||||
static gboolean opt_keystroke = FALSE;
|
||||
#endif /* HAVE_ATSPI */
|
||||
|
||||
static gchar *opt_keyboards = NULL;
|
||||
|
||||
static gboolean opt_fullscreen = FALSE;
|
||||
|
||||
static const GOptionEntry options[] = {
|
||||
{"system", 'y', 0, G_OPTION_ARG_NONE, &opt_system,
|
||||
N_("Connect to the system bus")},
|
||||
{"session", 'e', 0, G_OPTION_ARG_NONE, &opt_session,
|
||||
N_("Connect to the session bus")},
|
||||
{"address", 'a', 0, G_OPTION_ARG_STRING, &opt_address,
|
||||
N_("Connect to the given D-Bus address")},
|
||||
#if ENABLE_FOCUS_LISTENER
|
||||
{"listen-focus", 'f', 0, G_OPTION_ARG_NONE, &opt_focus,
|
||||
N_("Listen focus change events")},
|
||||
#endif /* ENABLE_FOCUS_LISTENER */
|
||||
#ifdef HAVE_ATSPI
|
||||
{"listen-keystroke", 's', 0, G_OPTION_ARG_NONE, &opt_keystroke,
|
||||
N_("Listen keystroke events with AT-SPI")},
|
||||
#endif /* HAVE_ATSPI */
|
||||
{"keyboards", 'k', 0, G_OPTION_ARG_STRING, &opt_keyboards,
|
||||
N_("Specify keyboards (comma separated)")},
|
||||
{"fullscreen", 'F', 0, G_OPTION_ARG_NONE, &opt_fullscreen,
|
||||
N_("Create window in fullscreen mode")},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
static void
|
||||
on_context_destroyed (EekboardContext *context,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
static void
|
||||
on_destroyed (EekboardClient *eekboard,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
enum FocusListenerType {
|
||||
FOCUS_NONE,
|
||||
FOCUS_ATSPI,
|
||||
FOCUS_IBUS
|
||||
};
|
||||
|
||||
static gboolean
|
||||
set_keyboards (SeatEmitter *client,
|
||||
const gchar * const *keyboards)
|
||||
{
|
||||
if (g_strv_length ((gchar **)keyboards) == 0) {
|
||||
if (!client_enable_xkl (client)) {
|
||||
g_printerr ("Can't register xklavier event listeners\n");
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if (!client_set_keyboards (client, keyboards)) {
|
||||
gchar *str = g_strjoinv (", ", (gchar **)keyboards);
|
||||
g_printerr ("Can't set keyboards \"%s\"\n", str);
|
||||
g_free (str);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
SeatEmitter *client = NULL;
|
||||
EekboardClient *eekboard;
|
||||
EekboardContext *context;
|
||||
GBusType bus_type;
|
||||
GDBusConnection *connection;
|
||||
GError *error;
|
||||
GOptionContext *option_context;
|
||||
gint focus;
|
||||
GSettings *settings = NULL;
|
||||
gchar **keyboards = NULL;
|
||||
gint retval = 0;
|
||||
|
||||
if (!gtk_init_check (&argc, &argv)) {
|
||||
g_printerr ("Can't init GTK\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
eek_init ();
|
||||
|
||||
option_context = g_option_context_new ("eekboard-desktop-client");
|
||||
g_option_context_add_main_entries (option_context, options, NULL);
|
||||
g_option_context_parse (option_context, &argc, &argv, NULL);
|
||||
g_option_context_free (option_context);
|
||||
|
||||
if (opt_system)
|
||||
bus_type = G_BUS_TYPE_SYSTEM;
|
||||
else if (opt_address)
|
||||
bus_type = G_BUS_TYPE_NONE;
|
||||
else
|
||||
bus_type = G_BUS_TYPE_SESSION;
|
||||
|
||||
switch (bus_type) {
|
||||
case G_BUS_TYPE_SYSTEM:
|
||||
error = NULL;
|
||||
connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
|
||||
if (connection == NULL) {
|
||||
g_printerr ("Can't connect to the system bus: %s\n",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
exit (1);
|
||||
}
|
||||
break;
|
||||
case G_BUS_TYPE_SESSION:
|
||||
error = NULL;
|
||||
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
|
||||
if (connection == NULL) {
|
||||
g_printerr ("Can't connect to the session bus: %s\n",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
exit (1);
|
||||
}
|
||||
break;
|
||||
case G_BUS_TYPE_NONE:
|
||||
error = NULL;
|
||||
connection = g_dbus_connection_new_for_address_sync (opt_address,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
&error);
|
||||
if (connection == NULL) {
|
||||
g_printerr ("Can't connect to the bus at %s: %s\n",
|
||||
opt_address,
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
exit (1);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
client = client_new (connection);
|
||||
g_object_unref (connection);
|
||||
|
||||
if (client == NULL) {
|
||||
g_printerr ("Can't create a client\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
settings = g_settings_new ("org.fedorahosted.eekboard");
|
||||
focus = FOCUS_NONE;
|
||||
if (opt_focus) {
|
||||
gchar *focus_listener = g_settings_get_string (settings,
|
||||
"focus-listener");
|
||||
const struct {
|
||||
const gchar *name;
|
||||
enum FocusListenerType type;
|
||||
} focus_listeners[] = {
|
||||
#ifdef HAVE_ATSPI
|
||||
{ "atspi", FOCUS_ATSPI },
|
||||
#endif
|
||||
#ifdef HAVE_IBUS
|
||||
{ "ibus", FOCUS_IBUS },
|
||||
#endif
|
||||
{ NULL }
|
||||
};
|
||||
gint i;
|
||||
|
||||
focus = FOCUS_NONE;
|
||||
for (i = 0; focus_listeners[i].name; i++) {
|
||||
if (g_strcmp0 (focus_listener, focus_listeners[i].name) == 0)
|
||||
focus = focus_listeners[i].type;
|
||||
}
|
||||
if (focus == FOCUS_NONE) {
|
||||
g_printerr ("Unknown focus listener \"%s\". "
|
||||
"Try \"atspi\" or \"ibus\"\n", focus_listener);
|
||||
retval = 1;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_ATSPI
|
||||
if (focus == FOCUS_ATSPI || opt_keystroke) {
|
||||
GSettings *desktop_settings =
|
||||
g_settings_new ("org.gnome.desktop.interface");
|
||||
gboolean accessibility_enabled =
|
||||
g_settings_get_boolean (desktop_settings, "toolkit-accessibility");
|
||||
g_object_unref (desktop_settings);
|
||||
|
||||
if (accessibility_enabled) {
|
||||
if (atspi_init () != 0) {
|
||||
g_printerr ("Can't init AT-SPI 2\n");
|
||||
retval = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (focus == FOCUS_ATSPI &&
|
||||
!client_enable_atspi_focus (client)) {
|
||||
g_printerr ("Can't register AT-SPI focus change event listeners\n");
|
||||
retval = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (opt_keystroke &&
|
||||
!client_enable_atspi_keystroke (client)) {
|
||||
g_printerr ("Can't register AT-SPI keystroke event listeners\n");
|
||||
retval = 1;
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
g_printerr ("Desktop accessibility support is disabled\n");
|
||||
retval = 1;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_ATSPI */
|
||||
|
||||
#ifdef HAVE_IBUS
|
||||
if (focus == FOCUS_IBUS) {
|
||||
ibus_init ();
|
||||
|
||||
if (!client_enable_ibus_focus (client)) {
|
||||
g_printerr ("Can't register IBus focus change event listeners\n");
|
||||
retval = 1;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_IBUS */
|
||||
|
||||
//#ifdef HAVE_XTEST
|
||||
if (!client_enable_xtest (client)) {
|
||||
g_printerr ("Can't init xtest\n");
|
||||
g_object_unref (client);
|
||||
exit (1);
|
||||
}
|
||||
//#endif /* HAVE_XTEST */
|
||||
|
||||
if (!opt_focus) {
|
||||
g_object_get (client, "context", &context, NULL);
|
||||
g_signal_connect (context, "destroyed",
|
||||
G_CALLBACK(on_context_destroyed), NULL);
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
if (opt_fullscreen ||
|
||||
g_settings_get_boolean (settings, "start-fullscreen")) {
|
||||
g_object_get (client, "context", &context, NULL);
|
||||
eekboard_context_set_fullscreen (context, TRUE, NULL);
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
g_object_get (client, "eekboard", &eekboard, NULL);
|
||||
g_signal_connect (eekboard, "destroyed",
|
||||
G_CALLBACK(on_destroyed), NULL);
|
||||
g_object_unref (eekboard);
|
||||
|
||||
if (opt_keyboards != NULL) {
|
||||
keyboards = g_strsplit (opt_keyboards, ",", -1);
|
||||
|
||||
if (!set_keyboards (client, (const gchar * const *)keyboards)) {
|
||||
g_strfreev (keyboards);
|
||||
retval = 1;
|
||||
goto out;
|
||||
}
|
||||
g_strfreev (keyboards);
|
||||
}
|
||||
|
||||
gtk_main ();
|
||||
|
||||
out:
|
||||
if (client)
|
||||
g_object_unref (client);
|
||||
if (settings)
|
||||
g_object_unref (settings);
|
||||
|
||||
return retval;
|
||||
}
|
||||
1166
src/client.c
Normal file
55
src/client.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CLIENT_H
|
||||
#define CLIENT_H 1
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define TYPE_CLIENT (client_get_type())
|
||||
#define CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLIENT, Client))
|
||||
#define CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLIENT, ClientClass))
|
||||
#define IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CLIENT))
|
||||
#define IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CLIENT))
|
||||
#define CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CLIENT, ClientClass))
|
||||
|
||||
typedef struct _Client SeatEmitter;
|
||||
|
||||
SeatEmitter *client_new (GDBusConnection *connection);
|
||||
|
||||
gboolean client_set_keyboards (SeatEmitter *client,
|
||||
const gchar * const *keyboard);
|
||||
|
||||
gboolean client_enable_xkl (SeatEmitter *client);
|
||||
void client_disable_xkl (SeatEmitter *client);
|
||||
|
||||
gboolean client_enable_atspi_focus (SeatEmitter *client);
|
||||
void client_disable_atspi_focus (SeatEmitter *client);
|
||||
|
||||
gboolean client_enable_atspi_keystroke (SeatEmitter *client);
|
||||
void client_disable_atspi_keystroke (SeatEmitter *client);
|
||||
|
||||
gboolean client_enable_xtest (SeatEmitter *client);
|
||||
void client_disable_xtest (SeatEmitter *client);
|
||||
|
||||
gboolean client_enable_ibus_focus (SeatEmitter *client);
|
||||
void client_disable_ibus_focus (SeatEmitter *client);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* CLIENT_H */
|
||||
@ -1,6 +0,0 @@
|
||||
/*
|
||||
* Autogenerated by the Meson build system.
|
||||
* Do not edit, your changes will be lost.
|
||||
*/
|
||||
|
||||
#mesondefine HAVE_GSOUND
|
||||
@ -5,8 +5,8 @@
|
||||
#include "eekboard/eekboard-context-service.h"
|
||||
|
||||
|
||||
void imservice_handle_text_change_cause(void *data, struct zwp_input_method_v2 *input_method, uint32_t cause) {}
|
||||
void imservice_handle_content_type(void *data, struct zwp_input_method_v2 *input_method, uint32_t hint, uint32_t purpose) {}
|
||||
void imservice_handle_text_change_cause(void *data, struct zwp_input_method_v2 *input_method) {}
|
||||
void imservice_handle_content_type(void *data, struct zwp_input_method_v2 *input_method) {}
|
||||
void imservice_handle_unavailable(void *data, struct zwp_input_method_v2 *input_method) {}
|
||||
|
||||
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
gnome = import('gnome')
|
||||
dbus_src = gnome.gdbus_codegen(
|
||||
'sm.puri.OSK0',
|
||||
join_paths(meson.source_root() / 'data' / 'dbus', 'sm.puri.OSK0.xml')
|
||||
join_paths(dbusdir, 'sm.puri.OSK0.xml')
|
||||
)
|
||||
|
||||
config_h = configure_file(input: 'config.h.in', output: 'config.h',configuration: conf_data)
|
||||
|
||||
sources = [
|
||||
config_h,
|
||||
'imservice.c',
|
||||
'server-context-service.c',
|
||||
'server-main.c',
|
||||
@ -43,8 +40,7 @@ sources = [
|
||||
'../eekboard/eekboard-context-service.c',
|
||||
'../eekboard/eekboard-context.c',
|
||||
'../eekboard/eekboard-service.c',
|
||||
# '../eekboard/eekboard-xklutil.c',
|
||||
squeekboard_resources,
|
||||
# '../eekboard/eekboard-xklutil.c',
|
||||
wl_proto_sources,
|
||||
]
|
||||
|
||||
@ -63,7 +59,6 @@ deps = [
|
||||
cc.find_library('dl'),
|
||||
cc.find_library('pthread'),
|
||||
# dependency('libxklavier'), # FIXME remove
|
||||
gsound_dep,
|
||||
]
|
||||
|
||||
# Replacement for eekboard-server
|
||||
|
||||
415
src/preferences-dialog.c
Normal file
@ -0,0 +1,415 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "preferences-dialog.h"
|
||||
#include <eek/eek.h>
|
||||
|
||||
struct _PreferencesDialog {
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *repeat_toggle;
|
||||
GtkWidget *repeat_delay_scale;
|
||||
GtkWidget *repeat_speed_scale;
|
||||
GtkWidget *auto_hide_toggle;
|
||||
GtkWidget *auto_hide_delay_scale;
|
||||
GtkWidget *selected_keyboards_treeview;
|
||||
GtkWidget *up_button;
|
||||
GtkWidget *down_button;
|
||||
GtkWidget *add_button;
|
||||
GtkWidget *remove_button;
|
||||
|
||||
GtkWidget *new_keyboard_dialog;
|
||||
GtkWidget *available_keyboards_treeview;
|
||||
|
||||
GList *available_keyboards;
|
||||
GSettings *settings;
|
||||
};
|
||||
|
||||
static gboolean
|
||||
get_rate (GValue *value,
|
||||
GVariant *variant,
|
||||
gpointer user_data)
|
||||
{
|
||||
int rate;
|
||||
gdouble fraction;
|
||||
|
||||
rate = g_variant_get_uint32 (variant);
|
||||
fraction = 1.0 / ((gdouble) rate / 1000.0);
|
||||
g_value_set_double (value, fraction);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
set_rate (const GValue *value,
|
||||
const GVariantType *expected_type,
|
||||
gpointer user_data)
|
||||
{
|
||||
gdouble rate;
|
||||
int msecs;
|
||||
|
||||
rate = g_value_get_double (value);
|
||||
msecs = (1 / rate) * 1000;
|
||||
return g_variant_new_uint32 (msecs);
|
||||
}
|
||||
|
||||
static void
|
||||
add_keyboard_to_treeview (GtkTreeView *treeview,
|
||||
const gchar *id,
|
||||
const gchar *longname)
|
||||
{
|
||||
GtkTreeModel *model = gtk_tree_view_get_model (treeview);
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (gtk_tree_model_get_iter_first (model, &iter)) {
|
||||
do {
|
||||
gchar *_id;
|
||||
gtk_tree_model_get (model, &iter, 0, &_id, -1);
|
||||
if (g_strcmp0 (id, _id) == 0) {
|
||||
g_free (_id);
|
||||
return;
|
||||
}
|
||||
g_free (_id);
|
||||
} while (gtk_tree_model_iter_next (model, &iter));
|
||||
}
|
||||
|
||||
gtk_list_store_append (GTK_LIST_STORE(model),
|
||||
&iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE(model),
|
||||
&iter,
|
||||
0, id,
|
||||
1, longname,
|
||||
-1);
|
||||
}
|
||||
|
||||
static void
|
||||
add_keyboard (GtkWidget *button, PreferencesDialog *dialog)
|
||||
{
|
||||
gint retval = gtk_dialog_run (GTK_DIALOG(dialog->new_keyboard_dialog));
|
||||
if (retval == GTK_RESPONSE_OK) {
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeModel *model;
|
||||
GList *rows, *p;
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(dialog->available_keyboards_treeview));
|
||||
rows = gtk_tree_selection_get_selected_rows (selection, &model);
|
||||
for (p = rows; p; p = p->next) {
|
||||
GtkTreeIter iter;
|
||||
if (gtk_tree_model_get_iter (model, &iter, p->data)) {
|
||||
gchar *id, *longname;
|
||||
gtk_tree_model_get (model, &iter, 0, &id, 1, &longname, -1);
|
||||
add_keyboard_to_treeview (GTK_TREE_VIEW(dialog->selected_keyboards_treeview),
|
||||
id,
|
||||
longname);
|
||||
g_free (id);
|
||||
g_free (longname);
|
||||
}
|
||||
}
|
||||
}
|
||||
gtk_widget_hide (dialog->new_keyboard_dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_keyboard (GtkWidget *button, PreferencesDialog *dialog)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeModel *model;
|
||||
GList *rows, *p;
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(dialog->selected_keyboards_treeview));
|
||||
rows = gtk_tree_selection_get_selected_rows (selection, &model);
|
||||
for (p = rows; p; p = p->next) {
|
||||
GtkTreeIter iter;
|
||||
if (gtk_tree_model_get_iter (model, &iter, p->data))
|
||||
gtk_list_store_remove (GTK_LIST_STORE(model), &iter);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
up_keyboard (GtkWidget *button, PreferencesDialog *dialog)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(dialog->selected_keyboards_treeview));
|
||||
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
|
||||
GtkTreeIter prev = iter;
|
||||
if (gtk_tree_model_iter_previous (model, &prev))
|
||||
gtk_list_store_swap (GTK_LIST_STORE(model), &iter, &prev);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
down_keyboard (GtkWidget *button, PreferencesDialog *dialog)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(dialog->selected_keyboards_treeview));
|
||||
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
|
||||
GtkTreeIter next = iter;
|
||||
if (gtk_tree_model_iter_next (model, &next))
|
||||
gtk_list_store_swap (GTK_LIST_STORE(model), &iter, &next);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
selection_changed_cb (GtkTreeSelection *selection, PreferencesDialog *dialog)
|
||||
{
|
||||
gint count = gtk_tree_selection_count_selected_rows (selection);
|
||||
if (count > 0) {
|
||||
gtk_widget_set_sensitive (dialog->remove_button, TRUE);
|
||||
gtk_widget_set_sensitive (dialog->up_button, TRUE);
|
||||
gtk_widget_set_sensitive (dialog->down_button, TRUE);
|
||||
} else {
|
||||
gtk_widget_set_sensitive (dialog->remove_button, FALSE);
|
||||
gtk_widget_set_sensitive (dialog->up_button, FALSE);
|
||||
gtk_widget_set_sensitive (dialog->down_button, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
compare_keyboard_id (const EekXmlKeyboardDesc *desc, const char *id)
|
||||
{
|
||||
return g_strcmp0 (desc->id, id);
|
||||
}
|
||||
|
||||
static void
|
||||
populate_selected_keyboards (PreferencesDialog *dialog)
|
||||
{
|
||||
gchar **strv, **p;
|
||||
|
||||
strv = g_settings_get_strv (dialog->settings, "keyboards");
|
||||
for (p = strv; *p != NULL; p++) {
|
||||
GList *head = g_list_find_custom (dialog->available_keyboards,
|
||||
*p,
|
||||
(GCompareFunc) compare_keyboard_id);
|
||||
if (head == NULL) {
|
||||
g_warning ("unknown keyboard %s", *p);
|
||||
} else {
|
||||
EekXmlKeyboardDesc *desc = head->data;
|
||||
add_keyboard_to_treeview (GTK_TREE_VIEW(dialog->selected_keyboards_treeview),
|
||||
desc->id,
|
||||
desc->longname);
|
||||
}
|
||||
}
|
||||
g_strfreev (strv);
|
||||
}
|
||||
|
||||
static void
|
||||
populate_available_keyboards (PreferencesDialog *dialog)
|
||||
{
|
||||
GList *p;
|
||||
|
||||
for (p = dialog->available_keyboards; p; p = p->next) {
|
||||
EekXmlKeyboardDesc *desc = p->data;
|
||||
add_keyboard_to_treeview (GTK_TREE_VIEW(dialog->available_keyboards_treeview),
|
||||
desc->id,
|
||||
desc->longname);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
save_keyboards (PreferencesDialog *dialog)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
GList *list = NULL, *head;
|
||||
gchar **strv, **p;
|
||||
|
||||
model = gtk_tree_view_get_model (GTK_TREE_VIEW(dialog->selected_keyboards_treeview));
|
||||
if (gtk_tree_model_get_iter_first (model, &iter)) {
|
||||
do {
|
||||
gchar *id;
|
||||
gtk_tree_model_get (model, &iter, 0, &id, -1);
|
||||
list = g_list_prepend (list, id);
|
||||
} while (gtk_tree_model_iter_next (model, &iter));
|
||||
}
|
||||
list = g_list_reverse (list);
|
||||
|
||||
strv = g_new0 (gchar *, g_list_length (list) + 1);
|
||||
for (head = list, p = strv; head; head = head->next, p++) {
|
||||
*p = head->data;
|
||||
}
|
||||
g_settings_set_strv (dialog->settings,
|
||||
"keyboards",
|
||||
(const gchar * const *)strv);
|
||||
g_strfreev (strv);
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
PreferencesDialog *
|
||||
preferences_dialog_new (void)
|
||||
{
|
||||
PreferencesDialog *dialog;
|
||||
gchar *ui_path;
|
||||
GtkBuilder *builder;
|
||||
GObject *object;
|
||||
GError *error;
|
||||
GtkListStore *store;
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkTreeSelection *selection;
|
||||
|
||||
dialog = g_slice_new0 (PreferencesDialog);
|
||||
dialog->settings = g_settings_new ("org.fedorahosted.eekboard");
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_translation_domain (builder, "eekboard");
|
||||
ui_path = g_build_filename (PKGDATADIR,
|
||||
"preferences-dialog.ui",
|
||||
NULL);
|
||||
error = NULL;
|
||||
if (gtk_builder_add_from_file (builder, ui_path, &error) == 0) {
|
||||
g_warning ("can't load %s: %s", ui_path, error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_free (ui_path);
|
||||
|
||||
object = gtk_builder_get_object (builder, "dialog");
|
||||
dialog->dialog = GTK_WIDGET(object);
|
||||
|
||||
object = gtk_builder_get_object (builder, "repeat_toggle");
|
||||
dialog->repeat_toggle = GTK_WIDGET(object);
|
||||
|
||||
g_settings_bind (dialog->settings, "repeat",
|
||||
dialog->repeat_toggle, "active",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
object = gtk_builder_get_object (builder, "repeat_delay_scale");
|
||||
dialog->repeat_delay_scale = GTK_WIDGET(object);
|
||||
|
||||
g_settings_bind (dialog->settings, "repeat-delay",
|
||||
gtk_range_get_adjustment (GTK_RANGE (dialog->repeat_delay_scale)), "value",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
object = gtk_builder_get_object (builder, "repeat_speed_scale");
|
||||
dialog->repeat_speed_scale = GTK_WIDGET(object);
|
||||
|
||||
g_settings_bind_with_mapping (dialog->settings, "repeat-interval",
|
||||
gtk_range_get_adjustment (GTK_RANGE (gtk_builder_get_object (builder, "repeat_speed_scale"))), "value",
|
||||
G_SETTINGS_BIND_DEFAULT,
|
||||
get_rate, set_rate, NULL, NULL);
|
||||
|
||||
object = gtk_builder_get_object (builder, "auto_hide_toggle");
|
||||
dialog->auto_hide_toggle = GTK_WIDGET(object);
|
||||
|
||||
g_settings_bind (dialog->settings, "auto-hide",
|
||||
dialog->auto_hide_toggle, "active",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
object = gtk_builder_get_object (builder, "auto_hide_delay_scale");
|
||||
dialog->auto_hide_delay_scale = GTK_WIDGET(object);
|
||||
|
||||
g_settings_bind (dialog->settings, "auto-hide-delay",
|
||||
gtk_range_get_adjustment (GTK_RANGE (dialog->auto_hide_delay_scale)), "value",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
object = gtk_builder_get_object (builder,
|
||||
"selected_keyboards_treeview");
|
||||
dialog->selected_keyboards_treeview = GTK_WIDGET(object);
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (object));
|
||||
g_signal_connect (G_OBJECT(selection), "changed",
|
||||
G_CALLBACK(selection_changed_cb), dialog);
|
||||
|
||||
renderer = GTK_CELL_RENDERER(gtk_cell_renderer_text_new ());
|
||||
column = gtk_tree_view_column_new_with_attributes ("Keyboard",
|
||||
renderer,
|
||||
"text",
|
||||
1,
|
||||
NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (object), column);
|
||||
|
||||
object = gtk_builder_get_object (builder, "up_button");
|
||||
dialog->up_button = GTK_WIDGET(object);
|
||||
g_signal_connect (object, "clicked",
|
||||
G_CALLBACK(up_keyboard), dialog);
|
||||
|
||||
object = gtk_builder_get_object (builder, "down_button");
|
||||
dialog->down_button = GTK_WIDGET(object);
|
||||
g_signal_connect (object, "clicked",
|
||||
G_CALLBACK(down_keyboard), dialog);
|
||||
|
||||
object = gtk_builder_get_object (builder, "add_button");
|
||||
dialog->add_button = GTK_WIDGET(object);
|
||||
g_signal_connect (object, "clicked",
|
||||
G_CALLBACK(add_keyboard), dialog);
|
||||
|
||||
object = gtk_builder_get_object (builder, "remove_button");
|
||||
dialog->remove_button = GTK_WIDGET(object);
|
||||
g_signal_connect (object, "clicked",
|
||||
G_CALLBACK(remove_keyboard), dialog);
|
||||
|
||||
object = gtk_builder_get_object (builder, "new_keyboard_dialog");
|
||||
dialog->new_keyboard_dialog = GTK_WIDGET(object);
|
||||
|
||||
object = gtk_builder_get_object (builder,
|
||||
"available_keyboards_treeview");
|
||||
dialog->available_keyboards_treeview = GTK_WIDGET(object);
|
||||
|
||||
renderer = GTK_CELL_RENDERER(gtk_cell_renderer_text_new ());
|
||||
column = gtk_tree_view_column_new_with_attributes ("Keyboard",
|
||||
renderer,
|
||||
"text",
|
||||
1,
|
||||
NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (object), column);
|
||||
|
||||
object = gtk_builder_get_object (builder,
|
||||
"available_keyboards_liststore");
|
||||
store = GTK_LIST_STORE(object);
|
||||
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(store),
|
||||
1,
|
||||
GTK_SORT_ASCENDING);
|
||||
|
||||
dialog->available_keyboards = eek_xml_list_keyboards ();
|
||||
|
||||
populate_selected_keyboards (dialog);
|
||||
populate_available_keyboards (dialog);
|
||||
|
||||
g_object_unref (builder);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
void
|
||||
preferences_dialog_run (PreferencesDialog *dialog)
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW(dialog->dialog));
|
||||
gtk_dialog_run (GTK_DIALOG(dialog->dialog));
|
||||
save_keyboards (dialog);
|
||||
}
|
||||
|
||||
void
|
||||
preferences_dialog_free (PreferencesDialog *dialog)
|
||||
{
|
||||
gtk_widget_destroy (dialog->dialog);
|
||||
// gtk_widget_destroy (dialog->new_keyboard_dialog);
|
||||
|
||||
g_object_unref (dialog->settings);
|
||||
g_list_free_full (dialog->available_keyboards,
|
||||
(GDestroyNotify) eek_xml_keyboard_desc_free);
|
||||
|
||||
g_slice_free (PreferencesDialog, dialog);
|
||||
}
|
||||
32
src/preferences-dialog.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef PREFERENCES_DIALOG_H
|
||||
#define PREFERENCES_DIALOG_H 1
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _PreferencesDialog PreferencesDialog;
|
||||
|
||||
PreferencesDialog *preferences_dialog_new (void);
|
||||
void preferences_dialog_run (PreferencesDialog *dialog);
|
||||
void preferences_dialog_free (PreferencesDialog *dialog);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* PREFERENCES_DIALOG_H */
|
||||
729
src/preferences-dialog.ui
Normal file
@ -0,0 +1,729 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkAction" id="action1">
|
||||
<property name="stock_id">gtk-close</property>
|
||||
</object>
|
||||
<object class="GtkAction" id="action2">
|
||||
<property name="stock_id">gtk-cancel</property>
|
||||
</object>
|
||||
<object class="GtkAction" id="action3">
|
||||
<property name="label" translatable="yes">Select</property>
|
||||
<property name="stock_id">gtk-ok</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="auto_hide_delay_adjustment">
|
||||
<property name="lower">100</property>
|
||||
<property name="upper">2000</property>
|
||||
<property name="value">500</property>
|
||||
<property name="step_increment">10</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkListStore" id="available_keyboards_liststore">
|
||||
<columns>
|
||||
<!-- column-name id -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name gchararray1 -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkDialog" id="dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Keyboard</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="related_action">action1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="keyboard_notebook">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="border_width">10</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="general_page">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="spacing">18</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox22">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label300">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Repeat Keys</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox19">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label43">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label"> </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox100">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="repeat_toggle">
|
||||
<property name="label" translatable="yes">Key presses _repeat when key is held down</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTable" id="repeat_table">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">4</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="repeat_speed_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Speed:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">repeat_speed_scale</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_SHRINK</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="delay_short_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="xpad">10</property>
|
||||
<property name="label" translatable="yes">Short</property>
|
||||
<attributes>
|
||||
<attribute name="style" value="italic"/>
|
||||
<attribute name="scale" value="0.82999999999999996"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="x_options">GTK_SHRINK</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="repeat_slow_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="xpad">10</property>
|
||||
<property name="label" translatable="yes">Slow</property>
|
||||
<attributes>
|
||||
<attribute name="style" value="italic"/>
|
||||
<attribute name="scale" value="0.82999999999999996"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_SHRINK</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHScale" id="repeat_delay_scale">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="adjustment">repeat_delay_adjustment</property>
|
||||
<property name="draw_value">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHScale" id="repeat_speed_scale">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="adjustment">repeat_speed_adjustment</property>
|
||||
<property name="draw_value">False</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="repeat_speed_scale-atkobject">
|
||||
<property name="AtkObject::accessible-description" translatable="yes">Repeat keys speed</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="delay_long_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Long</property>
|
||||
<attributes>
|
||||
<attribute name="style" value="italic"/>
|
||||
<attribute name="scale" value="0.82999999999999996"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="x_options">GTK_SHRINK</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="repeat_fast_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Fast</property>
|
||||
<attributes>
|
||||
<attribute name="style" value="italic"/>
|
||||
<attribute name="scale" value="0.82999999999999996"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_SHRINK</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="repeat_delay_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Delay:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">repeat_delay_scale</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_SHRINK</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox230">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Focus following</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox20">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label44">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label"> </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="appearances_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="auto_hide_toggle">
|
||||
<property name="label" translatable="yes">Auto hide window when focus is out</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTable" id="table1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="n_columns">4</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="auto_hide_delay_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Delay:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">auto_hide_delay_scale</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_SHRINK</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="auto_hide_delay_short_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="xpad">10</property>
|
||||
<property name="label" translatable="yes">Short</property>
|
||||
<attributes>
|
||||
<attribute name="style" value="italic"/>
|
||||
<attribute name="scale" value="0.82999999999999996"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="x_options">GTK_SHRINK</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHScale" id="auto_hide_delay_scale">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="adjustment">auto_hide_delay_adjustment</property>
|
||||
<property name="draw_value">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="auto_hide_delay_long_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Long</property>
|
||||
<attributes>
|
||||
<attribute name="style" value="italic"/>
|
||||
<attribute name="scale" value="0.82999999999999996"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="x_options">GTK_SHRINK</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Typing</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="keyboards_page">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="spacing">18</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="selected_keyboards_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">selected_keyboards_liststore</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="headers_clickable">False</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection2"/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButtonBox" id="buttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">2</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="up_button">
|
||||
<property name="label">gtk-go-up</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="down_button">
|
||||
<property name="label">gtk-go-down</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="add_button">
|
||||
<property name="label">gtk-add</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="remove_button">
|
||||
<property name="label">gtk-remove</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Keyboards</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="0">button1</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
<object class="GtkDialog" id="new_keyboard_dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="default_height">430</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="transient_for">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox2">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area2">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="related_action">action2</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="related_action">action3</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="available_keyboards_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">available_keyboards_liststore</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="headers_clickable">False</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection3"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="0">button2</action-widget>
|
||||
<action-widget response="-5">button3</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="repeat_delay_adjustment">
|
||||
<property name="lower">100</property>
|
||||
<property name="upper">2000</property>
|
||||
<property name="value">500</property>
|
||||
<property name="step_increment">10</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="repeat_speed_adjustment">
|
||||
<property name="lower">0.5</property>
|
||||
<property name="upper">50</property>
|
||||
<property name="value">33.299999999999997</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">1</property>
|
||||
</object>
|
||||
<object class="GtkListStore" id="selected_keyboards_liststore">
|
||||
<columns>
|
||||
<!-- column-name id -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name gchararray1 -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
</interface>
|
||||
@ -1,7 +1,7 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
@ -65,10 +65,10 @@ static void set_dock (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
static void
|
||||
on_monitors_changed (GdkScreen *screen,
|
||||
ServerContextService *context)
|
||||
|
||||
on_monitors_changed (GdkScreen *screen,
|
||||
gpointer user_data)
|
||||
{
|
||||
ServerContextService *context = user_data;
|
||||
if (context->window)
|
||||
set_geometry (context);
|
||||
}
|
||||
@ -87,16 +87,18 @@ on_destroy (GtkWidget *widget, gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
on_notify_keyboard (GObject *object,
|
||||
GParamSpec *spec,
|
||||
ServerContextService *context)
|
||||
on_notify_keyboard (GObject *object,
|
||||
GParamSpec *spec,
|
||||
gpointer user_data)
|
||||
{
|
||||
ServerContextService *context = user_data;
|
||||
const EekKeyboard *keyboard;
|
||||
|
||||
keyboard = eekboard_context_service_get_keyboard (EEKBOARD_CONTEXT_SERVICE(context));
|
||||
|
||||
if (!keyboard)
|
||||
if (!keyboard) {
|
||||
g_error("Programmer error: keyboard layout was unset!");
|
||||
}
|
||||
|
||||
// The keymap will get set even if the window is hidden.
|
||||
// It's not perfect,
|
||||
@ -107,7 +109,8 @@ on_notify_keyboard (GObject *object,
|
||||
if (context->window) {
|
||||
if (keyboard == NULL) {
|
||||
gtk_widget_hide (context->window);
|
||||
g_clear_pointer (&context->widget, gtk_widget_destroy);
|
||||
gtk_widget_destroy (context->widget);
|
||||
context->widget = NULL;
|
||||
} else {
|
||||
gboolean was_visible = gtk_widget_get_visible (context->window);
|
||||
/* avoid to send KeyboardVisibilityChanged */
|
||||
@ -122,21 +125,21 @@ on_notify_keyboard (GObject *object,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
on_notify_fullscreen (GObject *object,
|
||||
GParamSpec *spec,
|
||||
ServerContextService *context)
|
||||
on_notify_fullscreen (GObject *object,
|
||||
GParamSpec *spec,
|
||||
gpointer user_data)
|
||||
{
|
||||
ServerContextService *context = user_data;
|
||||
if (context->window)
|
||||
set_geometry (context);
|
||||
}
|
||||
|
||||
static void
|
||||
on_notify_visible (GObject *object,
|
||||
GParamSpec *spec,
|
||||
ServerContextService *context)
|
||||
on_notify_visible (GObject *object, GParamSpec *spec, gpointer user_data)
|
||||
{
|
||||
ServerContextService *context = user_data;
|
||||
gboolean visible;
|
||||
|
||||
g_object_get (object, "visible", &visible, NULL);
|
||||
@ -152,7 +155,7 @@ set_dock (GtkWidget *widget, GtkAllocation *allocation)
|
||||
|
||||
/* set window type to dock */
|
||||
gdk_window_set_type_hint (window, GDK_WINDOW_TYPE_HINT_DOCK);
|
||||
|
||||
|
||||
vals[0] = 0;
|
||||
vals[1] = 0;
|
||||
vals[2] = 0;
|
||||
@ -195,9 +198,10 @@ on_size_allocate_set_dock (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
on_realize_set_non_maximizable (GtkWidget *widget,
|
||||
ServerContextService *context)
|
||||
on_realize_set_non_maximizable (GtkWidget *widget,
|
||||
gpointer user_data)
|
||||
{
|
||||
ServerContextService *context = user_data;
|
||||
|
||||
g_assert (context && context->window == widget);
|
||||
|
||||
@ -212,16 +216,20 @@ on_realize_set_non_maximizable (GtkWidget *widget,
|
||||
static void
|
||||
set_geometry (ServerContextService *context)
|
||||
{
|
||||
GdkScreen *screen = gdk_screen_get_default ();
|
||||
GdkWindow *root = gdk_screen_get_root_window (screen);
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
GdkMonitor *monitor = gdk_display_get_monitor_at_window (display, root);
|
||||
EekKeyboard *keyboard = eekboard_context_service_get_keyboard (EEKBOARD_CONTEXT_SERVICE(context));
|
||||
|
||||
GdkScreen *screen;
|
||||
GdkDisplay *display;
|
||||
GdkWindow *root;
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle rect;
|
||||
const EekKeyboard *keyboard;
|
||||
EekBounds bounds;
|
||||
|
||||
screen = gdk_screen_get_default ();
|
||||
root = gdk_screen_get_root_window (screen);
|
||||
display = gdk_display_get_default();
|
||||
monitor = gdk_display_get_monitor_at_window (display, root);
|
||||
gdk_monitor_get_geometry (monitor, &rect);
|
||||
keyboard = eekboard_context_service_get_keyboard (EEKBOARD_CONTEXT_SERVICE(context));
|
||||
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (context->window,
|
||||
@ -232,14 +240,14 @@ set_geometry (ServerContextService *context)
|
||||
context);
|
||||
|
||||
if (eekboard_context_service_get_fullscreen (EEKBOARD_CONTEXT_SERVICE(context))) {
|
||||
gint width = rect.width;
|
||||
gint width = rect.width;
|
||||
gint height = rect.height;
|
||||
|
||||
if (width > height) {
|
||||
width *= context->size_constraint_landscape[0];
|
||||
width *= context->size_constraint_landscape[0];
|
||||
height *= context->size_constraint_landscape[1];
|
||||
} else {
|
||||
width *= context->size_constraint_portrait[0];
|
||||
width *= context->size_constraint_portrait[0];
|
||||
height *= context->size_constraint_portrait[1];
|
||||
}
|
||||
|
||||
@ -275,36 +283,31 @@ set_geometry (ServerContextService *context)
|
||||
}
|
||||
}
|
||||
|
||||
#define KEYBOARD_HEIGHT 210
|
||||
static void
|
||||
make_window (ServerContextService *context)
|
||||
{
|
||||
if (context->window)
|
||||
make_window (ServerContextService *context) {
|
||||
if (context->window) {
|
||||
g_error("Window already present");
|
||||
|
||||
context->window = g_object_new (
|
||||
return;
|
||||
}
|
||||
context->window = GTK_WIDGET(g_object_new (
|
||||
PHOSH_TYPE_LAYER_SURFACE,
|
||||
"layer-shell", squeek_wayland->layer_shell,
|
||||
"wl-output", g_ptr_array_index(squeek_wayland->outputs, 0), // TODO: select output as needed,
|
||||
"height", KEYBOARD_HEIGHT,
|
||||
"height", 200,
|
||||
"anchor", ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM
|
||||
| ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT
|
||||
| ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT,
|
||||
"layer", ZWLR_LAYER_SHELL_V1_LAYER_TOP,
|
||||
"kbd-interactivity", FALSE,
|
||||
"exclusive-zone", KEYBOARD_HEIGHT,
|
||||
"exclusive-zone", 200,
|
||||
//"namespace", "phosh home",
|
||||
NULL
|
||||
);
|
||||
|
||||
));
|
||||
g_signal_connect (context->window, "destroy",
|
||||
G_CALLBACK(on_destroy),
|
||||
context);
|
||||
|
||||
G_CALLBACK(on_destroy), context);
|
||||
context->notify_visible_handler =
|
||||
g_signal_connect (context->window, "notify::visible",
|
||||
G_CALLBACK(on_notify_visible),
|
||||
context);
|
||||
G_CALLBACK(on_notify_visible), context);
|
||||
|
||||
// The properties below are just to make hacking easier.
|
||||
// The way we use layer-shell overrides some,
|
||||
@ -320,8 +323,7 @@ make_window (ServerContextService *context)
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_window (ServerContextService *context)
|
||||
{
|
||||
destroy_window (ServerContextService *context) {
|
||||
context->window = NULL;
|
||||
}
|
||||
|
||||
@ -329,23 +331,25 @@ static void
|
||||
update_widget (ServerContextService *context)
|
||||
{
|
||||
EekKeyboard *keyboard;
|
||||
EekBounds bounds;
|
||||
gchar *theme_path;
|
||||
EekTheme *theme;
|
||||
|
||||
|
||||
if (context->widget) {
|
||||
gtk_widget_destroy (context->widget);
|
||||
context->widget = NULL;
|
||||
}
|
||||
|
||||
theme = eek_theme_new ("resource:///sm/puri/squeekboard/style.css",
|
||||
NULL,
|
||||
NULL);
|
||||
theme_path = g_build_filename (THEMESDIR, "default.css", NULL);
|
||||
|
||||
theme = eek_theme_new (theme_path, NULL, NULL);
|
||||
g_free (theme_path);
|
||||
|
||||
keyboard = eekboard_context_service_get_keyboard (EEKBOARD_CONTEXT_SERVICE(context));
|
||||
|
||||
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
|
||||
context->widget = eek_gtk_keyboard_new (keyboard);
|
||||
|
||||
eek_gtk_keyboard_set_theme (EEK_GTK_KEYBOARD(context->widget), theme);
|
||||
g_clear_object (&theme);
|
||||
g_object_unref (theme);
|
||||
|
||||
gtk_widget_set_has_tooltip (context->widget, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER(context->window), context->widget);
|
||||
@ -370,8 +374,7 @@ server_context_service_real_hide_keyboard (EekboardContextService *_context)
|
||||
ServerContextService *context = SERVER_CONTEXT_SERVICE(_context);
|
||||
|
||||
gtk_widget_hide (context->window);
|
||||
g_clear_pointer (&context->widget, gtk_widget_destroy);
|
||||
|
||||
gtk_container_remove(GTK_CONTAINER(context->window), context->widget);
|
||||
destroy_window (context);
|
||||
|
||||
EEKBOARD_CONTEXT_SERVICE_CLASS (server_context_service_parent_class)->
|
||||
@ -393,7 +396,8 @@ server_context_service_real_disabled (EekboardContextService *_context)
|
||||
ServerContextService *context = SERVER_CONTEXT_SERVICE(_context);
|
||||
|
||||
if (context->window) {
|
||||
context->was_visible = gtk_widget_get_visible (context->window);
|
||||
context->was_visible =
|
||||
gtk_widget_get_visible (context->window);
|
||||
gtk_widget_hide (context->window);
|
||||
}
|
||||
}
|
||||
@ -437,8 +441,10 @@ server_context_service_dispose (GObject *object)
|
||||
{
|
||||
ServerContextService *context = SERVER_CONTEXT_SERVICE(object);
|
||||
|
||||
g_clear_pointer (&context->window, gtk_widget_destroy);
|
||||
context->widget = NULL;
|
||||
if (context->window) {
|
||||
gtk_widget_destroy (context->window);
|
||||
context->window = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (server_context_service_parent_class)->dispose (object);
|
||||
}
|
||||
@ -483,8 +489,9 @@ server_context_service_class_init (ServerContextServiceClass *klass)
|
||||
static void
|
||||
server_context_service_init (ServerContextService *context)
|
||||
{
|
||||
GdkScreen *screen = gdk_screen_get_default ();
|
||||
GdkScreen *screen;
|
||||
|
||||
screen = gdk_screen_get_default ();
|
||||
g_signal_connect (screen,
|
||||
"monitors-changed",
|
||||
G_CALLBACK(on_monitors_changed),
|
||||
@ -493,7 +500,6 @@ server_context_service_init (ServerContextService *context)
|
||||
"notify::keyboard",
|
||||
G_CALLBACK(on_notify_keyboard),
|
||||
context);
|
||||
|
||||
g_signal_connect (context,
|
||||
"notify::fullscreen",
|
||||
G_CALLBACK(on_notify_fullscreen),
|
||||
@ -503,5 +509,6 @@ server_context_service_init (ServerContextService *context)
|
||||
EekboardContextService *
|
||||
server_context_service_new ()
|
||||
{
|
||||
return EEKBOARD_CONTEXT_SERVICE(g_object_new (SERVER_TYPE_CONTEXT_SERVICE, NULL));
|
||||
return EEKBOARD_CONTEXT_SERVICE(g_object_new (SERVER_TYPE_CONTEXT_SERVICE,
|
||||
NULL));
|
||||
}
|
||||
|
||||
41
src/setup-main.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2012 Red Hat, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "preferences-dialog.h"
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
PreferencesDialog *dialog;
|
||||
|
||||
if (!gtk_init_check (&argc, &argv)) {
|
||||
g_printerr ("Can't init GTK\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
dialog = preferences_dialog_new ();
|
||||
preferences_dialog_run (dialog);
|
||||
preferences_dialog_free (dialog);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
32
tests/Makefile.am
Normal file
@ -0,0 +1,32 @@
|
||||
# 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
|
||||
|
||||
INCLUDES = -I$(top_srcdir) $(GIO2_CFLAGS) $(GTK_CFLAGS) $(LIBXKLAVIER_CFLAGS)
|
||||
|
||||
TESTS_ENVIRONMENT = EEKBOARD_KEYBOARDSDIR=$(top_srcdir)/data/keyboards
|
||||
|
||||
TESTS = eek-simple-test eek-xml-test
|
||||
noinst_PROGRAMS = $(TESTS)
|
||||
|
||||
eek_simple_test_SOURCES = eek-simple-test.c
|
||||
eek_simple_test_LDADD = $(top_builddir)/eek/libeek.la $(GIO2_LIBS)
|
||||
|
||||
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)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||