Compare commits
	
		
			18 Commits
		
	
	
		
			eekboard-1
			...
			eekInVM
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 2c302320f6 | |||
| 5230171d47 | |||
| 436740b64a | |||
| e212262f29 | |||
| c71167d893 | |||
| 2d4e4c7a13 | |||
| 695f8df5b8 | |||
| 2e822cb6a6 | |||
| f2a90935a3 | |||
| cee741eca0 | |||
| b5b59e77d6 | |||
| cce883808e | |||
| 8faae7ef08 | |||
| 4538ef38a1 | |||
| ee12d02402 | |||
| 7050fa41a0 | |||
| 4a346211b8 | |||
| 4df2ecc8ae | 
							
								
								
									
										84
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										84
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,84 +0,0 @@
 | 
			
		||||
*.la
 | 
			
		||||
*.lo
 | 
			
		||||
*.loT
 | 
			
		||||
*.o
 | 
			
		||||
*.so
 | 
			
		||||
*~
 | 
			
		||||
*.pyc
 | 
			
		||||
Makefile
 | 
			
		||||
Makefile.in
 | 
			
		||||
.deps
 | 
			
		||||
.libs
 | 
			
		||||
INSTALL
 | 
			
		||||
aclocal.m4
 | 
			
		||||
autom4te.cache
 | 
			
		||||
compile
 | 
			
		||||
config.guess
 | 
			
		||||
config.h
 | 
			
		||||
config.h.in
 | 
			
		||||
config.log
 | 
			
		||||
config.rpath
 | 
			
		||||
config.status
 | 
			
		||||
config.sub
 | 
			
		||||
configure
 | 
			
		||||
depcomp
 | 
			
		||||
install-sh
 | 
			
		||||
libtool
 | 
			
		||||
ltmain.sh
 | 
			
		||||
missing
 | 
			
		||||
stamp-h1
 | 
			
		||||
libkeyactor*.tar.*
 | 
			
		||||
mkinstalldirs
 | 
			
		||||
m4/*.m4
 | 
			
		||||
gtk-doc.make
 | 
			
		||||
eek/eek-special-keysym-entries.h
 | 
			
		||||
eek/eek-unicode-keysym-entries.h
 | 
			
		||||
eek/eek-xkeysym-keysym-entries.h
 | 
			
		||||
eek/eek-enumtypes.[ch]
 | 
			
		||||
eek/eek-marshalers.[ch]
 | 
			
		||||
eek/*.pc
 | 
			
		||||
eek/*.gir
 | 
			
		||||
eek/*.typelib
 | 
			
		||||
eekboard/*.pc
 | 
			
		||||
eekboard/*.gir
 | 
			
		||||
eekboard/*.typelib
 | 
			
		||||
eekboard/eekboard-marshalers.[ch]
 | 
			
		||||
tests/eek-simple-test
 | 
			
		||||
tests/eek-xkb-test
 | 
			
		||||
tests/eek-xml-test
 | 
			
		||||
src/eekboard
 | 
			
		||||
src/eekboard-server
 | 
			
		||||
docs/reference/eek/*.stamp
 | 
			
		||||
docs/reference/eek/*.txt
 | 
			
		||||
docs/reference/eek/eek.types
 | 
			
		||||
!/docs/reference/eek/eek-sections.txt
 | 
			
		||||
docs/reference/eek/xml
 | 
			
		||||
docs/reference/eek/html
 | 
			
		||||
docs/reference/eek/eek.signals
 | 
			
		||||
docs/reference/eek/eek.args
 | 
			
		||||
docs/reference/eek/eek.hierarchy
 | 
			
		||||
docs/reference/eek/eek.interfaces
 | 
			
		||||
docs/reference/eek/eek.prerequisites
 | 
			
		||||
docs/reference/eekboard/*.stamp
 | 
			
		||||
docs/reference/eekboard/*.txt
 | 
			
		||||
!/docs/reference/eekboard/eekboard-sections.txt
 | 
			
		||||
docs/reference/eekboard/xml
 | 
			
		||||
docs/reference/eekboard/html
 | 
			
		||||
docs/reference/eekboard/eekboard.signals
 | 
			
		||||
docs/reference/eekboard/eekboard.args
 | 
			
		||||
docs/reference/eekboard/eekboard.hierarchy
 | 
			
		||||
docs/reference/eekboard/eekboard.interfaces
 | 
			
		||||
docs/reference/eekboard/eekboard.prerequisites
 | 
			
		||||
po/*.gmo
 | 
			
		||||
po/Makefile.in.in
 | 
			
		||||
po/POTFILES
 | 
			
		||||
po/stamp-it
 | 
			
		||||
po/.intltool-merge-cache
 | 
			
		||||
bindings/vala/*.vapi
 | 
			
		||||
py-compile
 | 
			
		||||
data/org.fedorahosted.eekboard.gschema.xml
 | 
			
		||||
data/org.fedorahosted.eekboard.gschema.valid
 | 
			
		||||
data/eekboard-server.service
 | 
			
		||||
data/*.desktop
 | 
			
		||||
examples/eekxml/eekxml
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								Makefile.am
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								Makefile.am
									
									
									
									
									
								
							@ -19,3 +19,21 @@
 | 
			
		||||
ACLOCAL_AMFLAGS = -I m4
 | 
			
		||||
SUBDIRS = eek eekboard src tests bindings docs po data examples
 | 
			
		||||
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
@ -17,3 +17,5 @@
 | 
			
		||||
# 02110-1301 USA
 | 
			
		||||
 | 
			
		||||
SUBDIRS = vala
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -16,6 +16,8 @@
 | 
			
		||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
			
		||||
# 02110-1301 USA
 | 
			
		||||
 | 
			
		||||
NULL =
 | 
			
		||||
 | 
			
		||||
if ENABLE_VALA
 | 
			
		||||
vapidir = $(datadir)/vala/vapi
 | 
			
		||||
dist_vapi_DATA =				\
 | 
			
		||||
@ -23,14 +25,16 @@ dist_vapi_DATA =				\
 | 
			
		||||
	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		\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
maintainer-clean-local:
 | 
			
		||||
@ -39,45 +43,50 @@ maintainer-clean-local:
 | 
			
		||||
eek_vapi_deps =						\
 | 
			
		||||
	$(srcdir)/Eek-$(EEK_API_VERSION).metadata	\
 | 
			
		||||
	|						\
 | 
			
		||||
	$(top_srcdir)/eek/Eek-$(EEK_API_VERSION).gir	\
 | 
			
		||||
	$(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_srcdir)/eek/Eek-$(EEK_API_VERSION).gir
 | 
			
		||||
	$(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_srcdir)/eek/EekGtk-$(EEK_API_VERSION).gir	\
 | 
			
		||||
	$(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 gtk+-3.0					\
 | 
			
		||||
		--metadatadir=$(srcdir)				\
 | 
			
		||||
		$(top_srcdir)/eek/EekGtk-$(EEK_API_VERSION).gir
 | 
			
		||||
	$(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_srcdir)/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)			\
 | 
			
		||||
		--metadatadir=$(srcdir)				\
 | 
			
		||||
		$(top_srcdir)/eek/EekXkl-$(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
 | 
			
		||||
 | 
			
		||||
@ -1 +1,2 @@
 | 
			
		||||
eek-0.90
 | 
			
		||||
x11
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ AC_PREREQ(2.63)
 | 
			
		||||
dnl AC_CONFIG_SRCDIR([configure.ac])
 | 
			
		||||
AC_CONFIG_MACRO_DIR([m4])
 | 
			
		||||
 | 
			
		||||
AC_INIT([eekboard], [1.0.7], [ueno@unixuser.org])
 | 
			
		||||
AC_INIT([eekboard], [1.0.8], [ueno@unixuser.org])
 | 
			
		||||
 | 
			
		||||
dnl Init automake
 | 
			
		||||
AM_INIT_AUTOMAKE
 | 
			
		||||
@ -225,7 +225,6 @@ 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([
 | 
			
		||||
 | 
			
		||||
@ -32,3 +32,4 @@ CLEANFILES += $(autostart_DATA)
 | 
			
		||||
EXTRA_DIST += $(autostart_in_files)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -14,3 +14,4 @@ install-data-hook:
 | 
			
		||||
		echo "***   $(gtk_update_icon_cache)";	\
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -14,3 +14,4 @@ install-data-hook:
 | 
			
		||||
		echo "***   $(gtk_update_icon_cache)";	\
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -14,3 +14,4 @@ install-data-hook:
 | 
			
		||||
		echo "***   $(gtk_update_icon_cache)";	\
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -14,3 +14,4 @@ install-data-hook:
 | 
			
		||||
		echo "***   $(gtk_update_icon_cache)";	\
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -14,3 +14,4 @@ install-data-hook:
 | 
			
		||||
		echo "***   $(gtk_update_icon_cache)";	\
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -1 +1,3 @@
 | 
			
		||||
SUBDIRS = 16x16 22x22 24x24 32x32 48x48 scalable
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -12,3 +12,4 @@ install-data-hook:
 | 
			
		||||
		echo "***   $(gtk_update_icon_cache)";	\
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -36,3 +36,5 @@ inscript_symbols =				\
 | 
			
		||||
	symbols/ta-inscript.xml			\
 | 
			
		||||
	symbols/te-inscript.xml			\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -248,10 +248,10 @@
 | 
			
		||||
    <keysym keyval="65506">Shift_R</keysym>
 | 
			
		||||
  </key>
 | 
			
		||||
  <key keycode="149" name="I149">
 | 
			
		||||
    <symbol label="⌨" icon="input-keyboard-symbolic">cycle-keyboard</symbol>
 | 
			
		||||
    <symbol label="⌨" icon="input-keyboard-symbolic" tooltip="Change keyboard">cycle-keyboard</symbol>
 | 
			
		||||
  </key>
 | 
			
		||||
  <key keycode="150" name="I150">
 | 
			
		||||
    <symbol label="☺" icon="preferences-system-symbolic">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,2 +1,4 @@
 | 
			
		||||
themedir = $(pkgdatadir)/themes
 | 
			
		||||
dist_theme_DATA = default.css
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -17,3 +17,5 @@
 | 
			
		||||
# 02110-1301 USA
 | 
			
		||||
 | 
			
		||||
SUBDIRS = reference
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -17,3 +17,5 @@
 | 
			
		||||
# 02110-1301 USA
 | 
			
		||||
 | 
			
		||||
SUBDIRS = eek eekboard
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -105,7 +105,6 @@ expand_content_files=eek-overview.xml
 | 
			
		||||
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)
 | 
			
		||||
@ -129,3 +128,5 @@ if ENABLE_GTK_DOC
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/gtk-doc.mk
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -118,3 +118,5 @@ if ENABLE_GTK_DOC
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/gtk-doc.mk
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										172
									
								
								eek/Makefile.am
									
									
									
									
									
								
							
							
						
						
									
										172
									
								
								eek/Makefile.am
									
									
									
									
									
								
							@ -16,10 +16,12 @@
 | 
			
		||||
# 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			\
 | 
			
		||||
@ -37,17 +39,17 @@ libeek_public_headers =				\
 | 
			
		||||
	$(srcdir)/eek-xml-layout.h		\
 | 
			
		||||
	$(srcdir)/eek-serializable.h		\
 | 
			
		||||
	$(srcdir)/eek-theme.h			\
 | 
			
		||||
	$(srcdir)/eek.h
 | 
			
		||||
	$(srcdir)/eek.h				\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
libeek_private_headers =			\
 | 
			
		||||
	$(srcdir)/eek-renderer.h		\
 | 
			
		||||
	$(srcdir)/eek-special-keysym-entries.h	\
 | 
			
		||||
	$(srcdir)/eek-unicode-keysym-entries.h	\
 | 
			
		||||
	$(srcdir)/eek-xkeysym-keysym-entries.h	\
 | 
			
		||||
	$(srcdir)/eek-marshalers.h		\
 | 
			
		||||
	$(libeek_keysym_headers)		\
 | 
			
		||||
	$(builddir)/eek-marshalers.h		\
 | 
			
		||||
	$(srcdir)/eek-theme-context.h		\
 | 
			
		||||
	$(srcdir)/eek-theme-private.h		\
 | 
			
		||||
	$(srcdir)/eek-theme-node.h
 | 
			
		||||
	$(srcdir)/eek-theme-node.h		\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
libeek_sources =				\
 | 
			
		||||
	$(srcdir)/eek.c				\
 | 
			
		||||
@ -69,30 +71,36 @@ libeek_sources =				\
 | 
			
		||||
	$(srcdir)/eek-keyboard-drawing.c	\
 | 
			
		||||
	$(srcdir)/eek-theme.c			\
 | 
			
		||||
	$(srcdir)/eek-theme-context.c		\
 | 
			
		||||
	$(srcdir)/eek-theme-node.c
 | 
			
		||||
	$(srcdir)/eek-theme-node.c		\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
libeek_keysym_sources =				\
 | 
			
		||||
	$(srcdir)/eek-special-keysym-entries.h	\
 | 
			
		||||
	$(srcdir)/eek-unicode-keysym-entries.h	\
 | 
			
		||||
	$(srcdir)/eek-xkeysym-keysym-entries.h
 | 
			
		||||
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 =			\
 | 
			
		||||
	$(srcdir)/eek-enumtypes.c		\
 | 
			
		||||
	$(srcdir)/eek-enumtypes.h
 | 
			
		||||
	$(builddir)/eek-enumtypes.c		\
 | 
			
		||||
	$(builddir)/eek-enumtypes.h		\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
libeek_marshalers_sources =			\
 | 
			
		||||
	$(srcdir)/eek-marshalers.c		\
 | 
			
		||||
	$(srcdir)/eek-marshalers.h
 | 
			
		||||
	$(builddir)/eek-marshalers.c		\
 | 
			
		||||
	$(builddir)/eek-marshalers.h		\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
BUILT_SOURCES =					\
 | 
			
		||||
	$(libeek_keysym_sources)		\
 | 
			
		||||
	$(libeek_keysym_headers)		\
 | 
			
		||||
	$(libeek_enumtypes_sources)		\
 | 
			
		||||
	$(libeek_marshalers_sources)
 | 
			
		||||
	$(libeek_marshalers_sources)		\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
libeek_la_SOURCES =				\
 | 
			
		||||
	$(libeek_sources)			\
 | 
			
		||||
	$(srcdir)/eek-enumtypes.c		\
 | 
			
		||||
	$(srcdir)/eek-marshalers.c
 | 
			
		||||
	$(builddir)/eek-enumtypes.c		\
 | 
			
		||||
	$(builddir)/eek-marshalers.c		\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
libeek_la_CFLAGS =					\
 | 
			
		||||
	-DEEK_COMPILATION=1				\
 | 
			
		||||
@ -111,84 +119,98 @@ libeek_la_LIBADD =				\
 | 
			
		||||
 | 
			
		||||
libeek_gtk_public_headers =			\
 | 
			
		||||
	$(srcdir)/eek-gtk-keyboard.h		\
 | 
			
		||||
	$(srcdir)/eek-gtk.h
 | 
			
		||||
	$(srcdir)/eek-gtk.h			\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
libeek_gtk_private_headers =			\
 | 
			
		||||
	$(srcdir)/eek-gtk-renderer.h
 | 
			
		||||
	$(srcdir)/eek-gtk-renderer.h		\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
libeek_gtk_sources =				\
 | 
			
		||||
	$(srcdir)/eek-gtk-keyboard.c		\
 | 
			
		||||
	$(srcdir)/eek-gtk-renderer.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
 | 
			
		||||
 | 
			
		||||
libeek_xkl_sources =				\
 | 
			
		||||
	$(srcdir)/eek-xkb-layout.c		\
 | 
			
		||||
	$(srcdir)/eek-xkl-layout.c
 | 
			
		||||
 | 
			
		||||
libeek_xkl_la_SOURCES = $(libeek_xkl_sources)
 | 
			
		||||
libeek_xkl_la_CFLAGS = -DEEK_COMPILATION=1 $(LIBXKLAVIER_CFLAGS)
 | 
			
		||||
libeek_xkl_la_LIBADD = libeek.la $(LIBXKLAVIER_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)		\
 | 
			
		||||
	$(srcdir)/eek-enumtypes.h		\
 | 
			
		||||
	$(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) ./gen-keysym-entries.py special_keysym_entries \
 | 
			
		||||
	$(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) ./gen-keysym-entries.py unicode_keysym_entries \
 | 
			
		||||
	$(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) ./gen-keysym-entries.py xkeysym_keysym_entries \
 | 
			
		||||
	$(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 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 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 && \
 | 
			
		||||
	$(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 && \
 | 
			
		||||
	$(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)
 | 
			
		||||
	$(pkgconfig_DATA)			\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
EXTRA_DIST =					\
 | 
			
		||||
	gen-keysym-entries.py			\
 | 
			
		||||
@ -197,7 +219,8 @@ EXTRA_DIST =					\
 | 
			
		||||
	xkeysym-keysym-entries.txt		\
 | 
			
		||||
	eek-enumtypes.h.template		\
 | 
			
		||||
	eek-enumtypes.c.template		\
 | 
			
		||||
	eek-marshalers.list
 | 
			
		||||
	eek-marshalers.list			\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
-include $(INTROSPECTION_MAKEFILE)
 | 
			
		||||
INTROSPECTION_GIRS =
 | 
			
		||||
@ -207,29 +230,56 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
 | 
			
		||||
if HAVE_INTROSPECTION
 | 
			
		||||
 | 
			
		||||
Eek@EEK_LIBRARY_SUFFIX@.gir: libeek.la
 | 
			
		||||
Eek@EEK_LIBRARY_SUFFIX_U@_gir_SCANNERFLAGS = --strip-prefix=Eek --pkg=glib-2.0 --pkg-export=eek-$(EEK_API_VERSION)
 | 
			
		||||
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) $(srcdir)/eek-enumtypes.h
 | 
			
		||||
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 = --pkg-export=eek-gtk-$(EEK_API_VERSION)
 | 
			
		||||
EekGtk@EEK_LIBRARY_SUFFIX_U@_gir_INCLUDES = GObject-2.0 Gtk-@GTK_API_VERSION@ Eek@EEK_LIBRARY_SUFFIX@
 | 
			
		||||
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)
 | 
			
		||||
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_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)
 | 
			
		||||
# 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)
 | 
			
		||||
@ -239,3 +289,5 @@ typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
 | 
			
		||||
 | 
			
		||||
CLEANFILES += $(gir_DATA) $(typelib_DATA)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -311,7 +311,7 @@ eek_element_set_name (EekElement  *element,
 | 
			
		||||
 * Get the name of @element.
 | 
			
		||||
 * Returns: the name of @element or NULL when the name is not set
 | 
			
		||||
 */
 | 
			
		||||
G_CONST_RETURN gchar *
 | 
			
		||||
const gchar *
 | 
			
		||||
eek_element_get_name (EekElement  *element)
 | 
			
		||||
{
 | 
			
		||||
    g_return_val_if_fail (EEK_IS_ELEMENT(element), NULL);
 | 
			
		||||
 | 
			
		||||
@ -58,45 +58,45 @@ struct _EekElementClass
 | 
			
		||||
                                                    gint         level);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
GType                 eek_element_get_type              (void) G_GNUC_CONST;
 | 
			
		||||
GType        eek_element_get_type              (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
void                  eek_element_set_parent            (EekElement  *element,
 | 
			
		||||
                                                         EekElement  *parent);
 | 
			
		||||
EekElement           *eek_element_get_parent            (EekElement  *element);
 | 
			
		||||
void                  eek_element_set_name              (EekElement  *element,
 | 
			
		||||
                                                         const gchar *name);
 | 
			
		||||
void         eek_element_set_parent            (EekElement  *element,
 | 
			
		||||
                                                EekElement  *parent);
 | 
			
		||||
EekElement  *eek_element_get_parent            (EekElement  *element);
 | 
			
		||||
void         eek_element_set_name              (EekElement  *element,
 | 
			
		||||
                                                const gchar *name);
 | 
			
		||||
 | 
			
		||||
G_CONST_RETURN gchar *eek_element_get_name              (EekElement  *element);
 | 
			
		||||
const gchar *eek_element_get_name              (EekElement  *element);
 | 
			
		||||
 | 
			
		||||
void                  eek_element_set_bounds            (EekElement  *element,
 | 
			
		||||
                                                         EekBounds   *bounds);
 | 
			
		||||
void         eek_element_set_bounds            (EekElement  *element,
 | 
			
		||||
                                                EekBounds   *bounds);
 | 
			
		||||
 | 
			
		||||
void                  eek_element_get_bounds            (EekElement  *element,
 | 
			
		||||
                                                         EekBounds   *bounds);
 | 
			
		||||
void         eek_element_get_bounds            (EekElement  *element,
 | 
			
		||||
                                                EekBounds   *bounds);
 | 
			
		||||
 | 
			
		||||
void                  eek_element_set_position          (EekElement  *element,
 | 
			
		||||
                                                         gdouble      x,
 | 
			
		||||
                                                         gdouble      y);
 | 
			
		||||
void                  eek_element_set_size              (EekElement  *element,
 | 
			
		||||
                                                         gdouble      width,
 | 
			
		||||
                                                         gdouble      height);
 | 
			
		||||
void         eek_element_set_position          (EekElement  *element,
 | 
			
		||||
                                                gdouble      x,
 | 
			
		||||
                                                gdouble      y);
 | 
			
		||||
void         eek_element_set_size              (EekElement  *element,
 | 
			
		||||
                                                gdouble      width,
 | 
			
		||||
                                                gdouble      height);
 | 
			
		||||
 | 
			
		||||
void                  eek_element_get_absolute_position (EekElement  *element,
 | 
			
		||||
                                                         gdouble     *x,
 | 
			
		||||
                                                         gdouble     *y);
 | 
			
		||||
void         eek_element_get_absolute_position (EekElement  *element,
 | 
			
		||||
                                                gdouble     *x,
 | 
			
		||||
                                                gdouble     *y);
 | 
			
		||||
 | 
			
		||||
void                  eek_element_set_symbol_index      (EekElement  *element,
 | 
			
		||||
                                                         gint         group,
 | 
			
		||||
                                                         gint         level);
 | 
			
		||||
void                  eek_element_get_symbol_index      (EekElement  *element,
 | 
			
		||||
                                                         gint        *group,
 | 
			
		||||
                                                         gint        *level);
 | 
			
		||||
void                  eek_element_set_group             (EekElement  *element,
 | 
			
		||||
                                                         gint         group);
 | 
			
		||||
void                  eek_element_set_level             (EekElement  *element,
 | 
			
		||||
                                                         gint         level);
 | 
			
		||||
gint                  eek_element_get_group             (EekElement  *element);
 | 
			
		||||
gint                  eek_element_get_level             (EekElement  *element);
 | 
			
		||||
void         eek_element_set_symbol_index      (EekElement  *element,
 | 
			
		||||
                                                gint         group,
 | 
			
		||||
                                                gint         level);
 | 
			
		||||
void         eek_element_get_symbol_index      (EekElement  *element,
 | 
			
		||||
                                                gint        *group,
 | 
			
		||||
                                                gint        *level);
 | 
			
		||||
void         eek_element_set_group             (EekElement  *element,
 | 
			
		||||
                                                gint         group);
 | 
			
		||||
void         eek_element_set_level             (EekElement  *element,
 | 
			
		||||
                                                gint         level);
 | 
			
		||||
gint         eek_element_get_group             (EekElement  *element);
 | 
			
		||||
gint         eek_element_get_level             (EekElement  *element);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
#endif  /* EEK_ELEMENT_H */
 | 
			
		||||
 | 
			
		||||
@ -232,6 +232,9 @@ eek_gtk_keyboard_real_motion_notify_event (GtkWidget      *self,
 | 
			
		||||
    EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self);
 | 
			
		||||
    EekKey *key;
 | 
			
		||||
 | 
			
		||||
    if (event->state == 0)
 | 
			
		||||
        return FALSE;
 | 
			
		||||
 | 
			
		||||
    key = eek_renderer_find_key_by_position (priv->renderer,
 | 
			
		||||
                                             (gdouble)event->x,
 | 
			
		||||
                                             (gdouble)event->y);
 | 
			
		||||
@ -275,6 +278,30 @@ eek_gtk_keyboard_real_unmap (GtkWidget *self)
 | 
			
		||||
    GTK_WIDGET_CLASS (eek_gtk_keyboard_parent_class)->unmap (self);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
eek_gtk_keyboard_real_query_tooltip (GtkWidget  *widget,
 | 
			
		||||
                                     gint        x,
 | 
			
		||||
                                     gint        y,
 | 
			
		||||
                                     gboolean    keyboard_tooltip,
 | 
			
		||||
                                     GtkTooltip *tooltip)
 | 
			
		||||
{
 | 
			
		||||
    EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(widget);
 | 
			
		||||
    EekKey *key;
 | 
			
		||||
 | 
			
		||||
    key = eek_renderer_find_key_by_position (priv->renderer,
 | 
			
		||||
                                             (gdouble)x,
 | 
			
		||||
                                             (gdouble)y);
 | 
			
		||||
    if (key) {
 | 
			
		||||
        EekSymbol *symbol = eek_key_get_symbol (key);
 | 
			
		||||
        const gchar *text = eek_symbol_get_tooltip (symbol);
 | 
			
		||||
        if (text) {
 | 
			
		||||
            gtk_tooltip_set_text (tooltip, text);
 | 
			
		||||
            return TRUE;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eek_gtk_keyboard_set_keyboard (EekGtkKeyboard *self,
 | 
			
		||||
                               EekKeyboard    *keyboard)
 | 
			
		||||
@ -397,6 +424,8 @@ eek_gtk_keyboard_class_init (EekGtkKeyboardClass *klass)
 | 
			
		||||
        eek_gtk_keyboard_real_button_release_event;
 | 
			
		||||
    widget_class->motion_notify_event =
 | 
			
		||||
        eek_gtk_keyboard_real_motion_notify_event;
 | 
			
		||||
    widget_class->query_tooltip =
 | 
			
		||||
        eek_gtk_keyboard_real_query_tooltip;
 | 
			
		||||
 | 
			
		||||
    gobject_class->set_property = eek_gtk_keyboard_set_property;
 | 
			
		||||
    gobject_class->dispose = eek_gtk_keyboard_dispose;
 | 
			
		||||
 | 
			
		||||
@ -40,8 +40,8 @@ point_line_distance (gdouble ax, gdouble ay, gdouble nx, gdouble ny)
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
normal_form (gdouble ax, gdouble ay,
 | 
			
		||||
	     gdouble bx, gdouble by,
 | 
			
		||||
	     gdouble * nx, gdouble * ny, gdouble * d)
 | 
			
		||||
             gdouble bx, gdouble by,
 | 
			
		||||
             gdouble * nx, gdouble * ny, gdouble * d)
 | 
			
		||||
{
 | 
			
		||||
    gdouble l;
 | 
			
		||||
 | 
			
		||||
@ -57,8 +57,8 @@ normal_form (gdouble ax, gdouble ay,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
inverse (gdouble a, gdouble b, gdouble c, gdouble d,
 | 
			
		||||
	 gdouble * e, gdouble * f, gdouble * g, gdouble * h)
 | 
			
		||||
inverse (gdouble a,   gdouble b,   gdouble c,   gdouble d,
 | 
			
		||||
         gdouble * e, gdouble * f, gdouble * g, gdouble * h)
 | 
			
		||||
{
 | 
			
		||||
    gdouble det;
 | 
			
		||||
 | 
			
		||||
@ -72,7 +72,7 @@ inverse (gdouble a, gdouble b, gdouble c, gdouble d,
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
multiply (gdouble a, gdouble b, gdouble c, gdouble d,
 | 
			
		||||
	  gdouble e, gdouble f, gdouble * x, gdouble * y)
 | 
			
		||||
          gdouble e, gdouble f, gdouble * x, gdouble * y)
 | 
			
		||||
{
 | 
			
		||||
    *x = a * e + b * f;
 | 
			
		||||
    *y = c * e + d * f;
 | 
			
		||||
@ -80,7 +80,7 @@ multiply (gdouble a, gdouble b, gdouble c, gdouble d,
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
intersect (gdouble n1x, gdouble n1y, gdouble d1,
 | 
			
		||||
	   gdouble n2x, gdouble n2y, gdouble d2, gdouble * x, gdouble * y)
 | 
			
		||||
           gdouble n2x, gdouble n2y, gdouble d2, gdouble * x, gdouble * y)
 | 
			
		||||
{
 | 
			
		||||
    gdouble e, f, g, h;
 | 
			
		||||
 | 
			
		||||
@ -94,8 +94,8 @@ intersect (gdouble n1x, gdouble n1y, gdouble d1,
 | 
			
		||||
 */
 | 
			
		||||
static void
 | 
			
		||||
rounded_corner (cairo_t * cr,
 | 
			
		||||
		gdouble bx, gdouble by,
 | 
			
		||||
		gdouble cx, gdouble cy, gdouble radius)
 | 
			
		||||
                gdouble bx, gdouble by,
 | 
			
		||||
                gdouble cx, gdouble cy, gdouble radius)
 | 
			
		||||
{
 | 
			
		||||
    gdouble ax, ay;
 | 
			
		||||
    gdouble n1x, n1y, d1;
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,7 @@
 | 
			
		||||
#ifndef EEK_KEYSYM_H
 | 
			
		||||
#define EEK_KEYSYM_H 1
 | 
			
		||||
 | 
			
		||||
#include <X11/XKBlib.h>
 | 
			
		||||
//#include <X11/XKBlib.h>   //luci
 | 
			
		||||
#include "eek-symbol.h"
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
@ -40,6 +40,7 @@ enum {
 | 
			
		||||
    PROP_CATEGORY,
 | 
			
		||||
    PROP_MODIFIER_MASK,
 | 
			
		||||
    PROP_ICON_NAME,
 | 
			
		||||
    PROP_TOOLTIP,
 | 
			
		||||
    PROP_LAST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -49,6 +50,7 @@ struct _EekSymbolPrivate {
 | 
			
		||||
    EekSymbolCategory category;
 | 
			
		||||
    EekModifierType modifier_mask;
 | 
			
		||||
    gchar *icon_name;
 | 
			
		||||
    gchar *tooltip;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void eek_serializable_iface_init (EekSerializableIface *iface);
 | 
			
		||||
@ -71,6 +73,7 @@ eek_symbol_real_serialize (EekSerializable *self,
 | 
			
		||||
    g_variant_builder_add (builder, "u", priv->category);
 | 
			
		||||
    g_variant_builder_add (builder, "u", priv->modifier_mask);
 | 
			
		||||
    g_variant_builder_add (builder, "s", NOTNULL(priv->icon_name));
 | 
			
		||||
    g_variant_builder_add (builder, "s", NOTNULL(priv->tooltip));
 | 
			
		||||
#undef NOTNULL
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -86,6 +89,7 @@ eek_symbol_real_deserialize (EekSerializable *self,
 | 
			
		||||
    g_variant_get_child (variant, index++, "u", &priv->category);
 | 
			
		||||
    g_variant_get_child (variant, index++, "u", &priv->modifier_mask);
 | 
			
		||||
    g_variant_get_child (variant, index++, "s", &priv->icon_name);
 | 
			
		||||
    g_variant_get_child (variant, index++, "s", &priv->tooltip);
 | 
			
		||||
 | 
			
		||||
    return index;
 | 
			
		||||
}
 | 
			
		||||
@ -121,6 +125,10 @@ eek_symbol_set_property (GObject      *object,
 | 
			
		||||
        eek_symbol_set_icon_name (EEK_SYMBOL(object),
 | 
			
		||||
                                  g_value_get_string (value));
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_TOOLTIP:
 | 
			
		||||
        eek_symbol_set_tooltip (EEK_SYMBOL(object),
 | 
			
		||||
                                g_value_get_string (value));
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
        break;
 | 
			
		||||
@ -151,6 +159,10 @@ eek_symbol_get_property (GObject    *object,
 | 
			
		||||
        g_value_set_string (value,
 | 
			
		||||
                            eek_symbol_get_icon_name (EEK_SYMBOL(object)));
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_TOOLTIP:
 | 
			
		||||
        g_value_set_string (value,
 | 
			
		||||
                            eek_symbol_get_tooltip (EEK_SYMBOL(object)));
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
        break;
 | 
			
		||||
@ -165,6 +177,7 @@ eek_symbol_finalize (GObject *object)
 | 
			
		||||
    g_free (priv->name);
 | 
			
		||||
    g_free (priv->label);
 | 
			
		||||
    g_free (priv->icon_name);
 | 
			
		||||
    g_free (priv->tooltip);
 | 
			
		||||
    G_OBJECT_CLASS (eek_symbol_parent_class)->finalize (object);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -216,6 +229,13 @@ eek_symbol_class_init (EekSymbolClass *klass)
 | 
			
		||||
                                 NULL,
 | 
			
		||||
                                 G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
 | 
			
		||||
    g_object_class_install_property (gobject_class, PROP_ICON_NAME, pspec);
 | 
			
		||||
 | 
			
		||||
    pspec = g_param_spec_string ("tooltip",
 | 
			
		||||
                                 "Tooltip",
 | 
			
		||||
                                 "Tooltip text",
 | 
			
		||||
                                 NULL,
 | 
			
		||||
                                 G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
 | 
			
		||||
    g_object_class_install_property (gobject_class, PROP_TOOLTIP, pspec);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@ -265,7 +285,7 @@ eek_symbol_set_name (EekSymbol   *symbol,
 | 
			
		||||
 *
 | 
			
		||||
 * Get the name of @symbol.
 | 
			
		||||
 */
 | 
			
		||||
G_CONST_RETURN gchar *
 | 
			
		||||
const gchar *
 | 
			
		||||
eek_symbol_get_name (EekSymbol *symbol)
 | 
			
		||||
{
 | 
			
		||||
    EekSymbolPrivate *priv;
 | 
			
		||||
@ -304,7 +324,7 @@ eek_symbol_set_label (EekSymbol   *symbol,
 | 
			
		||||
 *
 | 
			
		||||
 * Get the label text of @symbol.
 | 
			
		||||
 */
 | 
			
		||||
G_CONST_RETURN gchar *
 | 
			
		||||
const gchar *
 | 
			
		||||
eek_symbol_get_label (EekSymbol *symbol)
 | 
			
		||||
{
 | 
			
		||||
    EekSymbolPrivate *priv;
 | 
			
		||||
@ -428,7 +448,7 @@ eek_symbol_set_icon_name (EekSymbol   *symbol,
 | 
			
		||||
 *
 | 
			
		||||
 * Get the icon name of @symbol.
 | 
			
		||||
 */
 | 
			
		||||
G_CONST_RETURN gchar *
 | 
			
		||||
const gchar *
 | 
			
		||||
eek_symbol_get_icon_name (EekSymbol *symbol)
 | 
			
		||||
{
 | 
			
		||||
    EekSymbolPrivate *priv;
 | 
			
		||||
@ -441,6 +461,45 @@ eek_symbol_get_icon_name (EekSymbol *symbol)
 | 
			
		||||
    return priv->icon_name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_symbol_set_tooltip:
 | 
			
		||||
 * @symbol: an #EekSymbol
 | 
			
		||||
 * @tooltip: icon name of @symbol
 | 
			
		||||
 *
 | 
			
		||||
 * Set the tooltip text of @symbol to @tooltip.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
eek_symbol_set_tooltip (EekSymbol   *symbol,
 | 
			
		||||
                        const gchar *tooltip)
 | 
			
		||||
{
 | 
			
		||||
    EekSymbolPrivate *priv;
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (EEK_IS_SYMBOL(symbol));
 | 
			
		||||
 | 
			
		||||
    priv = EEK_SYMBOL_GET_PRIVATE(symbol);
 | 
			
		||||
    g_free (priv->tooltip);
 | 
			
		||||
    priv->tooltip = g_strdup (tooltip);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_symbol_get_tooltip:
 | 
			
		||||
 * @symbol: an #EekSymbol
 | 
			
		||||
 *
 | 
			
		||||
 * Get the tooltip text of @symbol.
 | 
			
		||||
 */
 | 
			
		||||
const gchar *
 | 
			
		||||
eek_symbol_get_tooltip (EekSymbol *symbol)
 | 
			
		||||
{
 | 
			
		||||
    EekSymbolPrivate *priv;
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (EEK_IS_SYMBOL(symbol), NULL);
 | 
			
		||||
 | 
			
		||||
    priv = EEK_SYMBOL_GET_PRIVATE(symbol);
 | 
			
		||||
    if (priv->tooltip == NULL || *priv->tooltip == '\0')
 | 
			
		||||
        return NULL;
 | 
			
		||||
    return priv->tooltip;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct {
 | 
			
		||||
    EekSymbolCategory category;
 | 
			
		||||
    gchar *name;
 | 
			
		||||
@ -456,7 +515,7 @@ static const struct {
 | 
			
		||||
    { EEK_SYMBOL_CATEGORY_UNKNOWN, NULL }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
G_CONST_RETURN gchar *
 | 
			
		||||
const gchar *
 | 
			
		||||
eek_symbol_category_get_name (EekSymbolCategory category)
 | 
			
		||||
{
 | 
			
		||||
    gint i;
 | 
			
		||||
 | 
			
		||||
@ -89,32 +89,31 @@ struct _EekSymbolClass {
 | 
			
		||||
    GObjectClass parent_class;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
GType                 eek_symbol_get_type      (void) G_GNUC_CONST;
 | 
			
		||||
GType             eek_symbol_get_type           (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
EekSymbol            *eek_symbol_new           (const gchar      *name);
 | 
			
		||||
void                  eek_symbol_set_name      (EekSymbol        *symbol,
 | 
			
		||||
                                                const gchar      *name);
 | 
			
		||||
G_CONST_RETURN gchar *eek_symbol_get_name      (EekSymbol        *symbol);
 | 
			
		||||
void                  eek_symbol_set_label     (EekSymbol        *symbol,
 | 
			
		||||
                                                const gchar      *label);
 | 
			
		||||
G_CONST_RETURN gchar *eek_symbol_get_label     (EekSymbol        *symbol);
 | 
			
		||||
void                  eek_symbol_set_category  (EekSymbol        *symbol,
 | 
			
		||||
                                                EekSymbolCategory category);
 | 
			
		||||
EekSymbolCategory     eek_symbol_get_category  (EekSymbol        *symbol);
 | 
			
		||||
EekModifierType       eek_symbol_get_modifier_mask
 | 
			
		||||
                                               (EekSymbol        *symbol);
 | 
			
		||||
void                  eek_symbol_set_modifier_mask
 | 
			
		||||
                                               (EekSymbol        *symbol,
 | 
			
		||||
                                                EekModifierType   mask);
 | 
			
		||||
gboolean              eek_symbol_is_modifier   (EekSymbol        *symbol);
 | 
			
		||||
void                  eek_symbol_set_icon_name (EekSymbol        *symbol,
 | 
			
		||||
                                                const gchar      *icon_name);
 | 
			
		||||
G_CONST_RETURN gchar *eek_symbol_get_icon_name (EekSymbol        *symbol);
 | 
			
		||||
EekSymbol        *eek_symbol_new                (const gchar      *name);
 | 
			
		||||
void              eek_symbol_set_name           (EekSymbol        *symbol,
 | 
			
		||||
                                                 const gchar      *name);
 | 
			
		||||
const gchar      *eek_symbol_get_name           (EekSymbol        *symbol);
 | 
			
		||||
void              eek_symbol_set_label          (EekSymbol        *symbol,
 | 
			
		||||
                                                 const gchar      *label);
 | 
			
		||||
const gchar      *eek_symbol_get_label          (EekSymbol        *symbol);
 | 
			
		||||
void              eek_symbol_set_category       (EekSymbol        *symbol,
 | 
			
		||||
                                                 EekSymbolCategory category);
 | 
			
		||||
EekSymbolCategory eek_symbol_get_category       (EekSymbol        *symbol);
 | 
			
		||||
EekModifierType   eek_symbol_get_modifier_mask  (EekSymbol        *symbol);
 | 
			
		||||
void              eek_symbol_set_modifier_mask  (EekSymbol        *symbol,
 | 
			
		||||
                                                 EekModifierType   mask);
 | 
			
		||||
gboolean          eek_symbol_is_modifier        (EekSymbol        *symbol);
 | 
			
		||||
void              eek_symbol_set_icon_name      (EekSymbol        *symbol,
 | 
			
		||||
                                                 const gchar      *icon_name);
 | 
			
		||||
const gchar      *eek_symbol_get_icon_name      (EekSymbol        *symbol);
 | 
			
		||||
void              eek_symbol_set_tooltip        (EekSymbol        *symbol,
 | 
			
		||||
                                                 const gchar      *tooltip);
 | 
			
		||||
const gchar *     eek_symbol_get_tooltip        (EekSymbol        *symbol);
 | 
			
		||||
 | 
			
		||||
G_CONST_RETURN gchar *eek_symbol_category_get_name
 | 
			
		||||
                                               (EekSymbolCategory category);
 | 
			
		||||
EekSymbolCategory     eek_symbol_category_from_name
 | 
			
		||||
                                               (const gchar      *name);
 | 
			
		||||
const gchar      *eek_symbol_category_get_name  (EekSymbolCategory category);
 | 
			
		||||
EekSymbolCategory eek_symbol_category_from_name (const gchar      *name);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -100,13 +100,13 @@ typedef enum {
 | 
			
		||||
typedef enum
 | 
			
		||||
{
 | 
			
		||||
  EEK_SHIFT_MASK    = 1 << 0,
 | 
			
		||||
  EEK_LOCK_MASK	    = 1 << 1,
 | 
			
		||||
  EEK_LOCK_MASK     = 1 << 1,
 | 
			
		||||
  EEK_CONTROL_MASK  = 1 << 2,
 | 
			
		||||
  EEK_MOD1_MASK	    = 1 << 3,
 | 
			
		||||
  EEK_MOD2_MASK	    = 1 << 4,
 | 
			
		||||
  EEK_MOD3_MASK	    = 1 << 5,
 | 
			
		||||
  EEK_MOD4_MASK	    = 1 << 6,
 | 
			
		||||
  EEK_MOD5_MASK	    = 1 << 7,
 | 
			
		||||
  EEK_MOD1_MASK     = 1 << 3,
 | 
			
		||||
  EEK_MOD2_MASK     = 1 << 4,
 | 
			
		||||
  EEK_MOD3_MASK     = 1 << 5,
 | 
			
		||||
  EEK_MOD4_MASK     = 1 << 6,
 | 
			
		||||
  EEK_MOD5_MASK     = 1 << 7,
 | 
			
		||||
  EEK_BUTTON1_MASK  = 1 << 8,
 | 
			
		||||
  EEK_BUTTON2_MASK  = 1 << 9,
 | 
			
		||||
  EEK_BUTTON3_MASK  = 1 << 10,
 | 
			
		||||
 | 
			
		||||
@ -16,15 +16,15 @@
 | 
			
		||||
# 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@
 | 
			
		||||
# 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@
 | 
			
		||||
							
								
								
									
										679
									
								
								eek/eek-wkb-layout.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										679
									
								
								eek/eek-wkb-layout.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,679 @@
 | 
			
		||||
/* 
 | 
			
		||||
 * Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org>
 | 
			
		||||
 * Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
 | 
			
		||||
 * Copyright (C) 2010-2011 Red Hat, Inc.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public License
 | 
			
		||||
 * as published by the Free Software Foundation; either version 2 of
 | 
			
		||||
 * the License, or (at your option) any later version.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is distributed in the hope that it will be useful, but
 | 
			
		||||
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 * 
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
			
		||||
 * 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SECTION:eek-xkb-layout
 | 
			
		||||
 * @short_description: Layout engine using XKB configuration
 | 
			
		||||
 *
 | 
			
		||||
 * The #EekXkbLayout inherits #EekLayout class and arranges keyboard
 | 
			
		||||
 * elements using XKB.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
// #ifdef HAVE_CONFIG_H
 | 
			
		||||
// #include "config.h"
 | 
			
		||||
// #endif  /* HAVE_CONFIG_H */
 | 
			
		||||
// 
 | 
			
		||||
// #include <X11/keysym.h>
 | 
			
		||||
// #include <X11/XKBlib.h>
 | 
			
		||||
// #include <X11/extensions/XKBgeom.h>
 | 
			
		||||
// #include <string.h>
 | 
			
		||||
// #include <stdarg.h>
 | 
			
		||||
// #include <gio/gio.h>
 | 
			
		||||
// 
 | 
			
		||||
// #include "eek-xkb-layout.h"
 | 
			
		||||
// #include "eek-keyboard.h"
 | 
			
		||||
// #include "eek-section.h"
 | 
			
		||||
// #include "eek-key.h"
 | 
			
		||||
// #include "eek-keysym.h"
 | 
			
		||||
// 
 | 
			
		||||
// #define XKB_COMPONENT_MASK (XkbGBN_GeometryMask |       \
 | 
			
		||||
//                             XkbGBN_KeyNamesMask |       \
 | 
			
		||||
//                             XkbGBN_OtherNamesMask |     \
 | 
			
		||||
//                             XkbGBN_SymbolsMask |        \
 | 
			
		||||
//                             XkbGBN_IndicatorMapMask)
 | 
			
		||||
// 
 | 
			
		||||
// static void initable_iface_init (GInitableIface *initable_iface);
 | 
			
		||||
// 
 | 
			
		||||
// G_DEFINE_TYPE_WITH_CODE (EekXkbLayout, eek_xkb_layout, EEK_TYPE_LAYOUT,
 | 
			
		||||
//                          G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
 | 
			
		||||
//                                                 initable_iface_init));
 | 
			
		||||
// 
 | 
			
		||||
// #define EEK_XKB_LAYOUT_GET_PRIVATE(obj)                                  \
 | 
			
		||||
//     (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutPrivate))
 | 
			
		||||
// 
 | 
			
		||||
// enum {
 | 
			
		||||
//     PROP_0,
 | 
			
		||||
//     PROP_DISPLAY,
 | 
			
		||||
//     PROP_LAST
 | 
			
		||||
// };
 | 
			
		||||
// 
 | 
			
		||||
// struct _EekXkbLayoutPrivate
 | 
			
		||||
// {
 | 
			
		||||
//     /* Configuration names that should synch'ed to the symbolic names
 | 
			
		||||
//        in priv->xkb->names.  Since we use GLib's memory allocator,
 | 
			
		||||
//        don't store any address returned from the X server here. */
 | 
			
		||||
//     XkbComponentNamesRec names;
 | 
			
		||||
// 
 | 
			
		||||
//     Display *display;
 | 
			
		||||
// 
 | 
			
		||||
//     /* Actual XKB configuration of DISPLAY. */
 | 
			
		||||
//     XkbDescRec *xkb;
 | 
			
		||||
// 
 | 
			
		||||
//     /* Hash table to cache orefs by shape address. */
 | 
			
		||||
//     GHashTable *shape_oref_hash;
 | 
			
		||||
// 
 | 
			
		||||
//     gint scale_numerator;
 | 
			
		||||
//     gint scale_denominator;
 | 
			
		||||
// };
 | 
			
		||||
// 
 | 
			
		||||
// static guint    find_keycode             (EekXkbLayout *layout,
 | 
			
		||||
//                                           gchar        *key_name);
 | 
			
		||||
// 
 | 
			
		||||
// static gboolean get_keyboard_from_server (EekXkbLayout *layout,
 | 
			
		||||
//                                           GError      **error);
 | 
			
		||||
// 
 | 
			
		||||
// static gboolean get_names_from_server    (EekXkbLayout *layout,
 | 
			
		||||
//                                           GError      **error);
 | 
			
		||||
// 
 | 
			
		||||
// static void     setup_scaling            (EekXkbLayout *layout,
 | 
			
		||||
//                                           gdouble       width,
 | 
			
		||||
//                                           gdouble       height);
 | 
			
		||||
// 
 | 
			
		||||
// G_INLINE_FUNC gint
 | 
			
		||||
// xkb_to_pixmap_coord (EekXkbLayout *layout,
 | 
			
		||||
//                      gint          n)
 | 
			
		||||
// {
 | 
			
		||||
//     EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
//     return n * priv->scale_numerator / priv->scale_denominator;
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// G_INLINE_FUNC gdouble
 | 
			
		||||
// xkb_to_pixmap_double (EekXkbLayout *layout,
 | 
			
		||||
//                      gdouble       d)
 | 
			
		||||
// {
 | 
			
		||||
//     EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
//     return d * priv->scale_numerator / priv->scale_denominator;
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static void
 | 
			
		||||
// create_key (EekXkbLayout *layout,
 | 
			
		||||
//             EekKeyboard  *keyboard,
 | 
			
		||||
//             EekSection   *section,
 | 
			
		||||
//             gint          column,
 | 
			
		||||
//             gint          row,
 | 
			
		||||
//             gdouble       x,
 | 
			
		||||
//             gdouble       y,
 | 
			
		||||
//             XkbKeyRec    *xkbkey)
 | 
			
		||||
// {
 | 
			
		||||
//     XkbGeometryRec *xkbgeometry;
 | 
			
		||||
//     XkbBoundsRec *xkbbounds;
 | 
			
		||||
//     XkbShapeRec *xkbshape;
 | 
			
		||||
//     XkbOutlineRec *xkboutline;
 | 
			
		||||
//     EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
//     EekKey *key;
 | 
			
		||||
//     EekBounds bounds;
 | 
			
		||||
//     EekSymbolMatrix *matrix = NULL;
 | 
			
		||||
//     gchar name[XkbKeyNameLength + 1];
 | 
			
		||||
//     KeyCode keycode;
 | 
			
		||||
//     gint num_groups, num_levels;
 | 
			
		||||
//     guint oref;
 | 
			
		||||
//     gpointer v;
 | 
			
		||||
// 
 | 
			
		||||
//     xkbgeometry = priv->xkb->geom;
 | 
			
		||||
//     xkbshape = &xkbgeometry->shapes[xkbkey->shape_ndx];
 | 
			
		||||
//     if (g_hash_table_lookup_extended (priv->shape_oref_hash, xkbshape,
 | 
			
		||||
//                                       NULL, &v)) {
 | 
			
		||||
//         oref = GPOINTER_TO_UINT(v);
 | 
			
		||||
//     } else {
 | 
			
		||||
//         EekOutline *outline;
 | 
			
		||||
// 
 | 
			
		||||
//         xkboutline = xkbshape->primary == NULL ? &xkbshape->outlines[0] :
 | 
			
		||||
//             xkbshape->primary;
 | 
			
		||||
// 
 | 
			
		||||
//         outline = g_slice_new (EekOutline);
 | 
			
		||||
//         outline->corner_radius = xkb_to_pixmap_coord(layout,
 | 
			
		||||
//                                                      xkboutline->corner_radius);
 | 
			
		||||
// 
 | 
			
		||||
//         if (xkboutline->num_points <= 2) { /* rectangular */
 | 
			
		||||
//             gdouble x1, y1, x2, y2;
 | 
			
		||||
// 
 | 
			
		||||
//             outline->num_points = 4;
 | 
			
		||||
//             outline->points = g_slice_alloc0 (sizeof (EekPoint) *
 | 
			
		||||
//                                               outline->num_points);
 | 
			
		||||
//             if (xkboutline->num_points == 1) {
 | 
			
		||||
//                 x1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.x1);
 | 
			
		||||
//                 y1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.y1);
 | 
			
		||||
//                 x2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
 | 
			
		||||
//                 y2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
 | 
			
		||||
//             } else {
 | 
			
		||||
//                 x1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
 | 
			
		||||
//                 y1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
 | 
			
		||||
//                 x2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].x);
 | 
			
		||||
//                 y2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].y);
 | 
			
		||||
//             }
 | 
			
		||||
//             outline->points[0].x = outline->points[3].x = x1;
 | 
			
		||||
//             outline->points[0].y = outline->points[1].y = y1;
 | 
			
		||||
//             outline->points[1].x = outline->points[2].x = x2;
 | 
			
		||||
//             outline->points[2].y = outline->points[3].y = y2;
 | 
			
		||||
//         } else {                /* polygon */
 | 
			
		||||
//             gint i;
 | 
			
		||||
// 
 | 
			
		||||
//             outline->num_points = xkboutline->num_points;
 | 
			
		||||
//             outline->points = g_new0 (EekPoint, outline->num_points);
 | 
			
		||||
//             for (i = 0; i < xkboutline->num_points; i++) {
 | 
			
		||||
//                 outline->points[i].x =
 | 
			
		||||
//                     xkb_to_pixmap_coord(layout, xkboutline->points[i].x);
 | 
			
		||||
//                 outline->points[i].y =
 | 
			
		||||
//                     xkb_to_pixmap_coord(layout, xkboutline->points[i].y);
 | 
			
		||||
//             }
 | 
			
		||||
//         }
 | 
			
		||||
//         oref = eek_keyboard_add_outline (keyboard, outline);
 | 
			
		||||
//         eek_outline_free (outline);
 | 
			
		||||
//         g_hash_table_insert (priv->shape_oref_hash, xkbshape,
 | 
			
		||||
//                              GUINT_TO_POINTER(oref));
 | 
			
		||||
//     }
 | 
			
		||||
// 
 | 
			
		||||
//     memset (name, 0, sizeof name);
 | 
			
		||||
//     memcpy (name, xkbkey->name.name, sizeof name - 1);
 | 
			
		||||
// 
 | 
			
		||||
//     xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
 | 
			
		||||
//     bounds.x = xkb_to_pixmap_coord(layout, xkbbounds->x1 + x);
 | 
			
		||||
//     bounds.y = xkb_to_pixmap_coord(layout, xkbbounds->y1 + y);
 | 
			
		||||
//     bounds.width = xkb_to_pixmap_coord(layout, xkbbounds->x2 - xkbbounds->x1);
 | 
			
		||||
//     bounds.height = xkb_to_pixmap_coord(layout, xkbbounds->y2 - xkbbounds->y1);
 | 
			
		||||
// 
 | 
			
		||||
//     keycode = find_keycode (layout, name);
 | 
			
		||||
//     if (keycode == EEK_INVALID_KEYCODE) {
 | 
			
		||||
//         num_groups = num_levels = 0;
 | 
			
		||||
//         matrix = eek_symbol_matrix_new (0, 0);
 | 
			
		||||
//     } else {
 | 
			
		||||
//         KeySym keysym;
 | 
			
		||||
//         gint i, j;
 | 
			
		||||
// 
 | 
			
		||||
//         num_groups = XkbKeyNumGroups (priv->xkb, keycode);
 | 
			
		||||
//         num_levels = XkbKeyGroupsWidth (priv->xkb, keycode);
 | 
			
		||||
//         matrix = eek_symbol_matrix_new (num_groups, num_levels);
 | 
			
		||||
//         for (i = 0; i < num_groups; i++)
 | 
			
		||||
//             for (j = 0; j < num_levels; j++) {
 | 
			
		||||
//                 EekModifierType modifier;
 | 
			
		||||
// 
 | 
			
		||||
//                 keysym = XkbKeySymEntry (priv->xkb, keycode, j, i);
 | 
			
		||||
//                 modifier = XkbKeysymToModifiers (priv->display, keysym);
 | 
			
		||||
//                 matrix->data[i * num_levels + j] =
 | 
			
		||||
//                     EEK_SYMBOL(eek_keysym_new_with_modifier (keysym,
 | 
			
		||||
//                                                              modifier));
 | 
			
		||||
//             }
 | 
			
		||||
//     }
 | 
			
		||||
// 
 | 
			
		||||
//     key = eek_section_create_key (section, keycode, column, row);
 | 
			
		||||
//     eek_element_set_name (EEK_ELEMENT(key), name);
 | 
			
		||||
//     eek_element_set_bounds (EEK_ELEMENT(key), &bounds);
 | 
			
		||||
//     eek_key_set_symbol_matrix (key, matrix);
 | 
			
		||||
//     eek_symbol_matrix_free (matrix);
 | 
			
		||||
//     eek_key_set_oref (key, oref);
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static void
 | 
			
		||||
// create_section (EekXkbLayout  *layout,
 | 
			
		||||
//                 EekKeyboard   *keyboard,
 | 
			
		||||
//                 XkbSectionRec *xkbsection)
 | 
			
		||||
// {
 | 
			
		||||
//     XkbGeometryRec *xkbgeometry;
 | 
			
		||||
//     EekXkbLayoutPrivate *priv;
 | 
			
		||||
//     EekSection *section;
 | 
			
		||||
//     EekBounds bounds;
 | 
			
		||||
//     gchar *name;
 | 
			
		||||
//     gfloat left, top;
 | 
			
		||||
//     gint i, j;
 | 
			
		||||
// 
 | 
			
		||||
//     bounds.x = xkb_to_pixmap_coord(layout, xkbsection->left);
 | 
			
		||||
//     bounds.y = xkb_to_pixmap_coord(layout, xkbsection->top);
 | 
			
		||||
//     bounds.width = xkb_to_pixmap_coord(layout, xkbsection->width);
 | 
			
		||||
//     bounds.height = xkb_to_pixmap_coord(layout, xkbsection->height);
 | 
			
		||||
// 
 | 
			
		||||
//     priv = layout->priv;
 | 
			
		||||
//     xkbgeometry = priv->xkb->geom;
 | 
			
		||||
//     section = eek_keyboard_create_section (keyboard);
 | 
			
		||||
//     name = XGetAtomName (priv->display, xkbsection->name);
 | 
			
		||||
//     eek_element_set_name (EEK_ELEMENT(section), name);
 | 
			
		||||
//     XFree (name);
 | 
			
		||||
//     eek_element_set_bounds (EEK_ELEMENT(section), &bounds);
 | 
			
		||||
//     eek_section_set_angle (section,
 | 
			
		||||
//                            /* angle is in tenth of degree */
 | 
			
		||||
//                            xkbsection->angle / 10);
 | 
			
		||||
// 
 | 
			
		||||
//     for (i = 0; i < xkbsection->num_rows; i++) {
 | 
			
		||||
//         XkbRowRec *xkbrow;
 | 
			
		||||
// 
 | 
			
		||||
//         xkbrow = &xkbsection->rows[i];
 | 
			
		||||
//         left = xkbrow->left;
 | 
			
		||||
//         top = xkbrow->top;
 | 
			
		||||
//         eek_section_add_row (section,
 | 
			
		||||
//                              xkbrow->num_keys,
 | 
			
		||||
//                              xkbrow->vertical ?
 | 
			
		||||
//                              EEK_ORIENTATION_VERTICAL :
 | 
			
		||||
//                              EEK_ORIENTATION_HORIZONTAL);
 | 
			
		||||
//         for (j = 0; j < xkbrow->num_keys; j++) {
 | 
			
		||||
//             XkbKeyRec *xkbkey;
 | 
			
		||||
//             XkbBoundsRec *xkbbounds;
 | 
			
		||||
// 
 | 
			
		||||
//             xkbkey = &xkbrow->keys[j];
 | 
			
		||||
//             if (xkbrow->vertical)
 | 
			
		||||
//                 top += xkbkey->gap;
 | 
			
		||||
//             else
 | 
			
		||||
//                 left += xkbkey->gap;
 | 
			
		||||
//             create_key (layout, keyboard, section, j, i, left, top, xkbkey);
 | 
			
		||||
//             xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
 | 
			
		||||
//             if (xkbrow->vertical)
 | 
			
		||||
//                 top += xkbbounds->y2 - xkbbounds->y1;
 | 
			
		||||
//             else
 | 
			
		||||
//                 left += xkbbounds->x2 - xkbbounds->x1;
 | 
			
		||||
//         }
 | 
			
		||||
//     }
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static void
 | 
			
		||||
// create_keyboard (EekXkbLayout *layout, EekKeyboard *keyboard)
 | 
			
		||||
// {
 | 
			
		||||
//     EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
//     XkbGeometryRec *xkbgeometry;
 | 
			
		||||
//     EekBounds bounds;
 | 
			
		||||
//     gint i;
 | 
			
		||||
// 
 | 
			
		||||
//     g_return_if_fail (priv->xkb);
 | 
			
		||||
//     g_return_if_fail (priv->xkb->geom);
 | 
			
		||||
// 
 | 
			
		||||
//     xkbgeometry = priv->xkb->geom;
 | 
			
		||||
// 
 | 
			
		||||
//     eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
 | 
			
		||||
//     setup_scaling (EEK_XKB_LAYOUT(layout), bounds.width, bounds.height);
 | 
			
		||||
// 
 | 
			
		||||
//     bounds.x = bounds.y = 0;
 | 
			
		||||
//     bounds.width = xkb_to_pixmap_coord(layout, xkbgeometry->width_mm);
 | 
			
		||||
//     bounds.height = xkb_to_pixmap_coord(layout, xkbgeometry->height_mm);
 | 
			
		||||
// 
 | 
			
		||||
//     for (i = 0; i < xkbgeometry->num_sections; i++) {
 | 
			
		||||
//         XkbSectionRec *xkbsection;
 | 
			
		||||
// 
 | 
			
		||||
//         xkbsection = &xkbgeometry->sections[i];
 | 
			
		||||
//         create_section (layout, keyboard, xkbsection);
 | 
			
		||||
//     }
 | 
			
		||||
//     eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static EekKeyboard *
 | 
			
		||||
// eek_xkb_layout_real_create_keyboard (EekLayout *self,
 | 
			
		||||
//                                      gdouble    initial_width,
 | 
			
		||||
//                                      gdouble    initial_height)
 | 
			
		||||
// {
 | 
			
		||||
//     EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (self);
 | 
			
		||||
//     EekBounds bounds;
 | 
			
		||||
//     EekKeyboard *keyboard;
 | 
			
		||||
// 
 | 
			
		||||
//     keyboard = g_object_new (EEK_TYPE_KEYBOARD, "layout", self, NULL);
 | 
			
		||||
//     bounds.x = bounds.y = 0.0;
 | 
			
		||||
//     bounds.width = initial_width;
 | 
			
		||||
//     bounds.height = initial_height;
 | 
			
		||||
//     eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
 | 
			
		||||
// 
 | 
			
		||||
//     /* resolve modifiers dynamically assigned at run time */
 | 
			
		||||
//     eek_keyboard_set_num_lock_mask (keyboard,
 | 
			
		||||
//                                     XkbKeysymToModifiers (priv->display,
 | 
			
		||||
//                                                           XK_Num_Lock));
 | 
			
		||||
//     eek_keyboard_set_alt_gr_mask (keyboard,
 | 
			
		||||
//                                   XkbKeysymToModifiers (priv->display,
 | 
			
		||||
//                                                         XK_ISO_Level3_Shift));
 | 
			
		||||
// 
 | 
			
		||||
//     if (priv->shape_oref_hash)
 | 
			
		||||
//         g_hash_table_destroy (priv->shape_oref_hash);
 | 
			
		||||
// 
 | 
			
		||||
//     priv->shape_oref_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
 | 
			
		||||
//     create_keyboard (EEK_XKB_LAYOUT(self), keyboard);
 | 
			
		||||
//     g_hash_table_destroy (priv->shape_oref_hash);
 | 
			
		||||
// 
 | 
			
		||||
//     return keyboard;
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static void
 | 
			
		||||
// eek_xkb_layout_finalize (GObject *object)
 | 
			
		||||
// {
 | 
			
		||||
//     EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (object);
 | 
			
		||||
// 
 | 
			
		||||
//     g_free (priv->names.keycodes);
 | 
			
		||||
//     g_free (priv->names.geometry);
 | 
			
		||||
//     g_free (priv->names.symbols);
 | 
			
		||||
//     XkbFreeKeyboard (priv->xkb, 0, TRUE);   /* free_all = TRUE */
 | 
			
		||||
//     G_OBJECT_CLASS (eek_xkb_layout_parent_class)->finalize (object);
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static void 
 | 
			
		||||
// eek_xkb_layout_set_property (GObject      *object,
 | 
			
		||||
//                              guint         prop_id,
 | 
			
		||||
//                              const GValue *value,
 | 
			
		||||
//                              GParamSpec   *pspec)
 | 
			
		||||
// {
 | 
			
		||||
//     EekXkbLayout *layout = EEK_XKB_LAYOUT (object);
 | 
			
		||||
// 
 | 
			
		||||
//     switch (prop_id) {
 | 
			
		||||
//     case PROP_DISPLAY:
 | 
			
		||||
//         layout->priv->display = g_value_get_pointer (value);
 | 
			
		||||
//         break;
 | 
			
		||||
//     default:
 | 
			
		||||
//         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
//         break;
 | 
			
		||||
//     }
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static void 
 | 
			
		||||
// eek_xkb_layout_get_property (GObject    *object,
 | 
			
		||||
//                              guint       prop_id,
 | 
			
		||||
//                              GValue     *value,
 | 
			
		||||
//                              GParamSpec *pspec)
 | 
			
		||||
// {
 | 
			
		||||
//     EekXkbLayout *layout = EEK_XKB_LAYOUT (object);
 | 
			
		||||
// 
 | 
			
		||||
//     switch (prop_id) {
 | 
			
		||||
//     case PROP_DISPLAY:
 | 
			
		||||
//         g_value_set_pointer (value, layout->priv->display);
 | 
			
		||||
//         break;
 | 
			
		||||
//     default:
 | 
			
		||||
//         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
//         break;
 | 
			
		||||
//     }
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static void
 | 
			
		||||
// eek_xkb_layout_class_init (EekXkbLayoutClass *klass)
 | 
			
		||||
// {
 | 
			
		||||
//     EekLayoutClass *layout_class = EEK_LAYOUT_CLASS (klass);
 | 
			
		||||
//     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 | 
			
		||||
//     GParamSpec *pspec;
 | 
			
		||||
// 
 | 
			
		||||
//     g_type_class_add_private (gobject_class, sizeof (EekXkbLayoutPrivate));
 | 
			
		||||
// 
 | 
			
		||||
//     layout_class->create_keyboard = eek_xkb_layout_real_create_keyboard;
 | 
			
		||||
// 
 | 
			
		||||
//     gobject_class->finalize = eek_xkb_layout_finalize;
 | 
			
		||||
//     gobject_class->set_property = eek_xkb_layout_set_property;
 | 
			
		||||
//     gobject_class->get_property = eek_xkb_layout_get_property;
 | 
			
		||||
// 
 | 
			
		||||
//     pspec = g_param_spec_pointer ("display",
 | 
			
		||||
//                                   "Display",
 | 
			
		||||
//                                   "X Display",
 | 
			
		||||
//                                   G_PARAM_READWRITE |
 | 
			
		||||
//                                   G_PARAM_CONSTRUCT_ONLY);
 | 
			
		||||
//     g_object_class_install_property (gobject_class, PROP_DISPLAY, pspec);
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static void
 | 
			
		||||
// eek_xkb_layout_init (EekXkbLayout *self)
 | 
			
		||||
// {
 | 
			
		||||
//     self->priv = EEK_XKB_LAYOUT_GET_PRIVATE (self);
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static gboolean
 | 
			
		||||
// get_names_from_server (EekXkbLayout *layout,
 | 
			
		||||
//                        GError      **error)
 | 
			
		||||
// {
 | 
			
		||||
//     EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
//     gchar *name;
 | 
			
		||||
// 
 | 
			
		||||
//     XkbGetNames (priv->display, XkbAllNamesMask, priv->xkb);
 | 
			
		||||
// 
 | 
			
		||||
//     if (priv->xkb->names->keycodes <= 0)
 | 
			
		||||
//         g_warning ("XKB keycodes setting is not loaded properly");
 | 
			
		||||
//     else {
 | 
			
		||||
//         name = XGetAtomName (priv->display, priv->xkb->names->keycodes);
 | 
			
		||||
//         if (!name)
 | 
			
		||||
//             g_warning ("Can't get the name of keycodes");
 | 
			
		||||
//         else if (!priv->names.keycodes ||
 | 
			
		||||
//                  g_strcmp0 (name, priv->names.keycodes)) {
 | 
			
		||||
//             g_free (priv->names.keycodes);
 | 
			
		||||
//             priv->names.keycodes = g_strdup (name);
 | 
			
		||||
//             XFree (name);
 | 
			
		||||
//         }
 | 
			
		||||
//     }
 | 
			
		||||
// 
 | 
			
		||||
//     if (priv->xkb->names->geometry <= 0)
 | 
			
		||||
//         g_warning ("XKB geometry setting is not loaded");
 | 
			
		||||
//     else {
 | 
			
		||||
//         name = XGetAtomName (priv->display, priv->xkb->names->geometry);
 | 
			
		||||
//         if (!name)
 | 
			
		||||
//             g_warning ("Can't get the name of geometry");
 | 
			
		||||
//         else if (!priv->names.geometry ||
 | 
			
		||||
//                  g_strcmp0 (name, priv->names.geometry)) {
 | 
			
		||||
//             g_free (priv->names.geometry);
 | 
			
		||||
//             priv->names.geometry = g_strdup (name);
 | 
			
		||||
//             XFree (name);
 | 
			
		||||
//         }
 | 
			
		||||
//     }
 | 
			
		||||
// 
 | 
			
		||||
//     if (priv->xkb->names->symbols <= 0)
 | 
			
		||||
//         g_warning ("XKB symbols setting is not loaded");
 | 
			
		||||
//     else {
 | 
			
		||||
//         name = XGetAtomName (priv->display, priv->xkb->names->symbols);
 | 
			
		||||
//         if (!name)
 | 
			
		||||
//             g_warning ("Can't get the name of symbols");
 | 
			
		||||
//         else if (!priv->names.symbols ||
 | 
			
		||||
//                  g_strcmp0 (name, priv->names.symbols)) {
 | 
			
		||||
//             g_free (priv->names.symbols);
 | 
			
		||||
//             priv->names.symbols = g_strdup (name);
 | 
			
		||||
//             XFree (name);
 | 
			
		||||
//         }
 | 
			
		||||
//     }
 | 
			
		||||
// 
 | 
			
		||||
//     return TRUE;
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// /**
 | 
			
		||||
//  * eek_xkb_layout_new:
 | 
			
		||||
//  *
 | 
			
		||||
//  * Create a new #EekXkbLayout.
 | 
			
		||||
//  */
 | 
			
		||||
// EekLayout *
 | 
			
		||||
// eek_xkb_layout_new (Display *display,
 | 
			
		||||
//                     GError **error)
 | 
			
		||||
// {
 | 
			
		||||
//     return (EekLayout *) g_initable_new (EEK_TYPE_XKB_LAYOUT,
 | 
			
		||||
//                                          NULL,
 | 
			
		||||
//                                          error,
 | 
			
		||||
//                                          "display", display,
 | 
			
		||||
//                                          NULL);
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// /**
 | 
			
		||||
//  * eek_xkb_layout_set_names: (skip)
 | 
			
		||||
//  * @layout: an #EekXkbLayout
 | 
			
		||||
//  * @names: XKB component names
 | 
			
		||||
//  * @error: a #GError
 | 
			
		||||
//  *
 | 
			
		||||
//  * Set the XKB component names to @layout.
 | 
			
		||||
//  * Returns: %TRUE if the component names are successfully set, %FALSE otherwise
 | 
			
		||||
//  */
 | 
			
		||||
// gboolean
 | 
			
		||||
// eek_xkb_layout_set_names (EekXkbLayout         *layout,
 | 
			
		||||
//                           XkbComponentNamesRec *names,
 | 
			
		||||
//                           GError              **error)
 | 
			
		||||
// {
 | 
			
		||||
//     if (g_strcmp0 (names->keycodes, layout->priv->names.keycodes)) {
 | 
			
		||||
//         g_free (layout->priv->names.keycodes);
 | 
			
		||||
//         layout->priv->names.keycodes = g_strdup (names->keycodes);
 | 
			
		||||
//     }
 | 
			
		||||
// 
 | 
			
		||||
//     if (g_strcmp0 (names->geometry, layout->priv->names.geometry)) {
 | 
			
		||||
//         g_free (layout->priv->names.geometry);
 | 
			
		||||
//         layout->priv->names.geometry = g_strdup (names->geometry);
 | 
			
		||||
//     }
 | 
			
		||||
// 
 | 
			
		||||
//     if (g_strcmp0 (names->symbols, layout->priv->names.symbols)) {
 | 
			
		||||
//         g_free (layout->priv->names.symbols);
 | 
			
		||||
//         layout->priv->names.symbols = g_strdup (names->symbols);
 | 
			
		||||
//     }
 | 
			
		||||
// 
 | 
			
		||||
//     return get_keyboard_from_server (layout, error);
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static gboolean
 | 
			
		||||
// get_keyboard_from_server (EekXkbLayout *layout,
 | 
			
		||||
//                           GError      **error)
 | 
			
		||||
// {
 | 
			
		||||
//     EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
// 
 | 
			
		||||
//     if (priv->xkb) {
 | 
			
		||||
//         XkbFreeKeyboard (priv->xkb, 0, True);
 | 
			
		||||
//         priv->xkb = NULL;
 | 
			
		||||
//     }
 | 
			
		||||
// 
 | 
			
		||||
//     if (priv->names.keycodes && priv->names.geometry && priv->names.symbols) {
 | 
			
		||||
//         priv->xkb = XkbGetKeyboardByName (priv->display,
 | 
			
		||||
//                                           XkbUseCoreKbd,
 | 
			
		||||
//                                           &priv->names,
 | 
			
		||||
//                                           0,
 | 
			
		||||
//                                           XKB_COMPONENT_MASK,
 | 
			
		||||
//                                           False);
 | 
			
		||||
//     } else {
 | 
			
		||||
//         priv->xkb = XkbGetKeyboard (priv->display,
 | 
			
		||||
//                                     XKB_COMPONENT_MASK,
 | 
			
		||||
//                                     XkbUseCoreKbd);
 | 
			
		||||
//         if (!get_names_from_server (layout, error)) {
 | 
			
		||||
//             XkbFreeKeyboard (priv->xkb, 0, True);
 | 
			
		||||
//             priv->xkb = NULL;
 | 
			
		||||
//         }
 | 
			
		||||
//     }
 | 
			
		||||
// 
 | 
			
		||||
//     if (priv->xkb == NULL) {
 | 
			
		||||
//         g_set_error (error,
 | 
			
		||||
//                      EEK_ERROR,
 | 
			
		||||
//                      EEK_ERROR_LAYOUT_ERROR,
 | 
			
		||||
//                      "can't get keyboard from server");
 | 
			
		||||
//         g_free (priv->names.keycodes);
 | 
			
		||||
//         priv->names.keycodes = NULL;
 | 
			
		||||
//         g_free (priv->names.geometry);
 | 
			
		||||
//         priv->names.geometry = NULL;
 | 
			
		||||
//         g_free (priv->names.symbols);
 | 
			
		||||
//         priv->names.symbols = NULL;
 | 
			
		||||
//         return FALSE;
 | 
			
		||||
//     }
 | 
			
		||||
//     return TRUE;
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// 
 | 
			
		||||
// static guint
 | 
			
		||||
// find_keycode (EekXkbLayout *layout, gchar *key_name)
 | 
			
		||||
// {
 | 
			
		||||
// #define KEYSYM_NAME_MAX_LENGTH 4
 | 
			
		||||
//     guint keycode;
 | 
			
		||||
//     gint i, j;
 | 
			
		||||
//     XkbKeyNamePtr pkey;
 | 
			
		||||
//     XkbKeyAliasPtr palias;
 | 
			
		||||
//     guint is_name_matched;
 | 
			
		||||
//     gchar *src, *dst;
 | 
			
		||||
//     EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
// 
 | 
			
		||||
//     if (!priv->xkb)
 | 
			
		||||
//         return EEK_INVALID_KEYCODE;
 | 
			
		||||
// 
 | 
			
		||||
//     pkey = priv->xkb->names->keys + priv->xkb->min_key_code;
 | 
			
		||||
//     for (keycode = priv->xkb->min_key_code;
 | 
			
		||||
//          keycode <= priv->xkb->max_key_code; keycode++) {
 | 
			
		||||
//         is_name_matched = 1;
 | 
			
		||||
//         src = key_name;
 | 
			
		||||
//         dst = pkey->name;
 | 
			
		||||
//         for (i = KEYSYM_NAME_MAX_LENGTH; --i >= 0;) {
 | 
			
		||||
//             if ('\0' == *src)
 | 
			
		||||
//                 break;
 | 
			
		||||
//             if (*src++ != *dst++) {
 | 
			
		||||
//                 is_name_matched = 0;
 | 
			
		||||
//                 break;
 | 
			
		||||
//             }
 | 
			
		||||
//         }
 | 
			
		||||
//         if (is_name_matched)
 | 
			
		||||
//             return keycode;
 | 
			
		||||
//         pkey++;
 | 
			
		||||
//     }
 | 
			
		||||
// 
 | 
			
		||||
//     palias = priv->xkb->names->key_aliases;
 | 
			
		||||
//     for (j = priv->xkb->names->num_key_aliases; --j >= 0;) {
 | 
			
		||||
//         is_name_matched = 1;
 | 
			
		||||
//         src = key_name;
 | 
			
		||||
//         dst = palias->alias;
 | 
			
		||||
//         for (i = KEYSYM_NAME_MAX_LENGTH; --i >= 0;) {
 | 
			
		||||
//             if ('\0' == *src)
 | 
			
		||||
//                 break;
 | 
			
		||||
//             if (*src++ != *dst++) {
 | 
			
		||||
//                 is_name_matched = 0;
 | 
			
		||||
//                 break;
 | 
			
		||||
//             }
 | 
			
		||||
//         }
 | 
			
		||||
// 
 | 
			
		||||
//         if (is_name_matched) {
 | 
			
		||||
//             keycode = find_keycode (layout, palias->real);
 | 
			
		||||
//             return keycode;
 | 
			
		||||
//         }
 | 
			
		||||
//         palias++;
 | 
			
		||||
//     }
 | 
			
		||||
// 
 | 
			
		||||
//     return EEK_INVALID_KEYCODE;
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static void
 | 
			
		||||
// setup_scaling (EekXkbLayout *layout,
 | 
			
		||||
//                gdouble       width,
 | 
			
		||||
//                gdouble       height)
 | 
			
		||||
// {
 | 
			
		||||
//     EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
// 
 | 
			
		||||
//     g_return_if_fail (priv->xkb);
 | 
			
		||||
// 
 | 
			
		||||
//     g_return_if_fail (priv->xkb->geom->width_mm > 0);
 | 
			
		||||
//     g_return_if_fail (priv->xkb->geom->height_mm > 0);
 | 
			
		||||
// 
 | 
			
		||||
//     if (width * priv->xkb->geom->height_mm <
 | 
			
		||||
//         height * priv->xkb->geom->width_mm) {
 | 
			
		||||
//         priv->scale_numerator = width;
 | 
			
		||||
//         priv->scale_denominator = priv->xkb->geom->width_mm;
 | 
			
		||||
//     } else {
 | 
			
		||||
//         priv->scale_numerator = height;
 | 
			
		||||
//         priv->scale_denominator = priv->xkb->geom->height_mm;
 | 
			
		||||
//     }
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static gboolean
 | 
			
		||||
// initable_init (GInitable    *initable,
 | 
			
		||||
//                GCancellable *cancellable,
 | 
			
		||||
//                GError      **error)
 | 
			
		||||
// {
 | 
			
		||||
//     EekXkbLayout *layout = EEK_XKB_LAYOUT (initable);
 | 
			
		||||
// 
 | 
			
		||||
//     if (!get_keyboard_from_server (layout, error))
 | 
			
		||||
//         return FALSE;
 | 
			
		||||
// 
 | 
			
		||||
//     if (!get_names_from_server (layout, error))
 | 
			
		||||
//         return FALSE;
 | 
			
		||||
// 
 | 
			
		||||
//     return TRUE;
 | 
			
		||||
// }
 | 
			
		||||
// 
 | 
			
		||||
// static void
 | 
			
		||||
// initable_iface_init (GInitableIface *initable_iface)
 | 
			
		||||
// {
 | 
			
		||||
//   initable_iface->init = initable_init;
 | 
			
		||||
// }
 | 
			
		||||
							
								
								
									
										72
									
								
								eek/eek-wkb-layout.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								eek/eek-wkb-layout.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,72 @@
 | 
			
		||||
/* 
 | 
			
		||||
 * Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
 | 
			
		||||
 * Copyright (C) 2010-2011 Red Hat, Inc.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public License
 | 
			
		||||
 * as published by the Free Software Foundation; either version 2 of
 | 
			
		||||
 * the License, or (at your option) any later version.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is distributed in the hope that it will be useful, but
 | 
			
		||||
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 * 
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
			
		||||
 * 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
//#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
 | 
			
		||||
//#error "Only <eek/eek-xkb.h> can be included directly."
 | 
			
		||||
//#endif
 | 
			
		||||
//
 | 
			
		||||
//#ifndef EEK_XKB_LAYOUT_H
 | 
			
		||||
//#define EEK_XKB_LAYOUT_H 1
 | 
			
		||||
//
 | 
			
		||||
//#include <X11/Xlib.h>
 | 
			
		||||
//#include <X11/XKBlib.h>
 | 
			
		||||
//#include "eek-layout.h"
 | 
			
		||||
//
 | 
			
		||||
//G_BEGIN_DECLS
 | 
			
		||||
//
 | 
			
		||||
//#define EEK_TYPE_XKB_LAYOUT (eek_xkb_layout_get_type())
 | 
			
		||||
//#define EEK_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayout))
 | 
			
		||||
//#define EEK_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
 | 
			
		||||
//#define EEK_IS_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XKB_LAYOUT))
 | 
			
		||||
//#define EEK_IS_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XKB_LAYOUT))
 | 
			
		||||
//#define EEK_XKB_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
 | 
			
		||||
//
 | 
			
		||||
//typedef struct _EekXkbLayout        EekXkbLayout;
 | 
			
		||||
//typedef struct _EekXkbLayoutClass   EekXkbLayoutClass;
 | 
			
		||||
//typedef struct _EekXkbLayoutPrivate EekXkbLayoutPrivate;
 | 
			
		||||
//
 | 
			
		||||
//struct _EekXkbLayout
 | 
			
		||||
//{
 | 
			
		||||
//    /*< private >*/
 | 
			
		||||
//    EekLayout parent;
 | 
			
		||||
//
 | 
			
		||||
//    EekXkbLayoutPrivate *priv;
 | 
			
		||||
//};
 | 
			
		||||
//
 | 
			
		||||
//struct _EekXkbLayoutClass
 | 
			
		||||
//{
 | 
			
		||||
//    /*< private >*/
 | 
			
		||||
//    EekLayoutClass parent_class;
 | 
			
		||||
//
 | 
			
		||||
//    /*< private >*/
 | 
			
		||||
//    /* padding */
 | 
			
		||||
//    gpointer pdummy[24];
 | 
			
		||||
//};
 | 
			
		||||
//
 | 
			
		||||
//GType      eek_xkb_layout_get_type  (void) G_GNUC_CONST;
 | 
			
		||||
//EekLayout *eek_xkb_layout_new       (Display              *display,
 | 
			
		||||
//                                     GError              **error);
 | 
			
		||||
//
 | 
			
		||||
//gboolean   eek_xkb_layout_set_names (EekXkbLayout         *layout,
 | 
			
		||||
//                                     XkbComponentNamesRec *names,
 | 
			
		||||
//                                     GError              **error);
 | 
			
		||||
//
 | 
			
		||||
//G_END_DECLS
 | 
			
		||||
//#endif              /* #ifndef EEK_XKB_LAYOUT_H */
 | 
			
		||||
@ -17,10 +17,10 @@
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
			
		||||
 * 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
#ifndef EEK_XKL_H
 | 
			
		||||
#define EEK_XKL_H 1
 | 
			
		||||
 | 
			
		||||
#include "eek.h"
 | 
			
		||||
#include "eek-xkl-layout.h"
 | 
			
		||||
 | 
			
		||||
#endif  /* EEK_XKL_H */
 | 
			
		||||
//#ifndef EEK_XKB_H
 | 
			
		||||
//#define EEK_XKB_H 1
 | 
			
		||||
//
 | 
			
		||||
//#include "eek.h"
 | 
			
		||||
//#include "eek-xkb-layout.h"
 | 
			
		||||
//
 | 
			
		||||
//#endif  /* EEK_XKB_H */
 | 
			
		||||
@ -16,15 +16,15 @@
 | 
			
		||||
# 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@
 | 
			
		||||
# 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@
 | 
			
		||||
							
								
								
									
										663
									
								
								eek/eek-wkl-layout.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										663
									
								
								eek/eek-wkl-layout.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,663 @@
 | 
			
		||||
/* 
 | 
			
		||||
 * Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
 | 
			
		||||
 * Copyright (C) 2010-2011 Red Hat, Inc.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public License
 | 
			
		||||
 * as published by the Free Software Foundation; either version 2 of
 | 
			
		||||
 * the License, or (at your option) any later version.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is distributed in the hope that it will be useful, but
 | 
			
		||||
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 * 
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
			
		||||
 * 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SECTION:eek-xkl-layout
 | 
			
		||||
 * @short_description: Layout engine using Libxklavier configuration
 | 
			
		||||
 *
 | 
			
		||||
 * The #EekXklLayout is a simple wrapper around #EekXkbLayout class
 | 
			
		||||
 * to use Libxklavier configuration.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
//#ifdef HAVE_CONFIG_H
 | 
			
		||||
//#include "config.h"
 | 
			
		||||
//#endif  /* HAVE_CONFIG_H */
 | 
			
		||||
//
 | 
			
		||||
//#include <libxklavier/xklavier.h>
 | 
			
		||||
//#include <gio/gio.h>
 | 
			
		||||
//#include <string.h>
 | 
			
		||||
//
 | 
			
		||||
//#include "eek-xkl-layout.h"
 | 
			
		||||
//
 | 
			
		||||
//#define noKBDRAW_DEBUG
 | 
			
		||||
//
 | 
			
		||||
//static GInitableIface *parent_initable_iface;
 | 
			
		||||
//
 | 
			
		||||
//static void initable_iface_init (GInitableIface *initable_iface);
 | 
			
		||||
//
 | 
			
		||||
//G_DEFINE_TYPE_WITH_CODE (EekXklLayout, eek_xkl_layout, EEK_TYPE_XKB_LAYOUT,
 | 
			
		||||
//                         G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
 | 
			
		||||
//                                                initable_iface_init));
 | 
			
		||||
//
 | 
			
		||||
//#define EEK_XKL_LAYOUT_GET_PRIVATE(obj)                                  \
 | 
			
		||||
//    (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayoutPrivate))
 | 
			
		||||
//
 | 
			
		||||
//enum {
 | 
			
		||||
//    PROP_0,
 | 
			
		||||
//    PROP_MODEL,
 | 
			
		||||
//    PROP_LAYOUTS,
 | 
			
		||||
//    PROP_VARIANTS,
 | 
			
		||||
//    PROP_OPTIONS,
 | 
			
		||||
//    PROP_LAST
 | 
			
		||||
//};
 | 
			
		||||
//
 | 
			
		||||
//struct _EekXklLayoutPrivate
 | 
			
		||||
//{
 | 
			
		||||
//    XklEngine *engine;
 | 
			
		||||
//    XklConfigRec *config;
 | 
			
		||||
//};
 | 
			
		||||
//
 | 
			
		||||
///* from gnome-keyboard-properties-xkbpv.c:
 | 
			
		||||
// *  BAD STYLE: Taken from xklavier_private_xkb.h
 | 
			
		||||
// *  Any ideas on architectural improvements are WELCOME
 | 
			
		||||
// */
 | 
			
		||||
//extern gboolean xkl_xkb_config_native_prepare (XklEngine * engine,
 | 
			
		||||
//                                               const XklConfigRec * data,
 | 
			
		||||
//                                               XkbComponentNamesPtr
 | 
			
		||||
//                                               component_names);
 | 
			
		||||
//
 | 
			
		||||
//extern void xkl_xkb_config_native_cleanup (XklEngine * engine,
 | 
			
		||||
//                                           XkbComponentNamesPtr
 | 
			
		||||
//                                           component_names);
 | 
			
		||||
//
 | 
			
		||||
//static gboolean set_xkb_component_names (EekXklLayout *layout,
 | 
			
		||||
//                                         XklConfigRec *config);
 | 
			
		||||
//
 | 
			
		||||
//static void
 | 
			
		||||
//eek_xkl_layout_dispose (GObject *object)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (object);
 | 
			
		||||
//
 | 
			
		||||
//    if (priv->config) {
 | 
			
		||||
//        g_object_unref (priv->config);
 | 
			
		||||
//        priv->config = NULL;
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    G_OBJECT_CLASS (eek_xkl_layout_parent_class)->dispose (object);
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
//static void 
 | 
			
		||||
//eek_xkl_layout_set_property (GObject      *object,
 | 
			
		||||
//                             guint         prop_id,
 | 
			
		||||
//                             const GValue *value,
 | 
			
		||||
//                             GParamSpec   *pspec)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayout *layout = EEK_XKL_LAYOUT(object);
 | 
			
		||||
//
 | 
			
		||||
//    switch (prop_id) {
 | 
			
		||||
//    case PROP_MODEL:
 | 
			
		||||
//        eek_xkl_layout_set_model (layout, g_value_get_string (value));
 | 
			
		||||
//        break;
 | 
			
		||||
//    case PROP_LAYOUTS:
 | 
			
		||||
//        eek_xkl_layout_set_layouts (layout, g_value_get_boxed (value));
 | 
			
		||||
//        break;
 | 
			
		||||
//    case PROP_VARIANTS:
 | 
			
		||||
//        eek_xkl_layout_set_variants (layout, g_value_get_boxed (value));
 | 
			
		||||
//        break;
 | 
			
		||||
//    case PROP_OPTIONS:
 | 
			
		||||
//        eek_xkl_layout_set_options (layout, g_value_get_boxed (value));
 | 
			
		||||
//        break;
 | 
			
		||||
//    default:
 | 
			
		||||
//        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
//        break;
 | 
			
		||||
//    }
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
//static void 
 | 
			
		||||
//eek_xkl_layout_get_property (GObject    *object,
 | 
			
		||||
//                             guint       prop_id,
 | 
			
		||||
//                             GValue     *value,
 | 
			
		||||
//                             GParamSpec *pspec)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayout *layout = EEK_XKL_LAYOUT(object);
 | 
			
		||||
//
 | 
			
		||||
//    switch (prop_id) {
 | 
			
		||||
//    case PROP_MODEL:
 | 
			
		||||
//        g_value_set_string (value,
 | 
			
		||||
//                            eek_xkl_layout_get_model (layout));
 | 
			
		||||
//        break;
 | 
			
		||||
//    case PROP_LAYOUTS:
 | 
			
		||||
//        g_value_set_boxed (value,
 | 
			
		||||
//                           eek_xkl_layout_get_layouts (layout));
 | 
			
		||||
//        break;
 | 
			
		||||
//    case PROP_VARIANTS:
 | 
			
		||||
//        g_value_set_boxed (value,
 | 
			
		||||
//                           eek_xkl_layout_get_variants (layout));
 | 
			
		||||
//        break;
 | 
			
		||||
//    case PROP_OPTIONS:
 | 
			
		||||
//        g_value_set_boxed (value,
 | 
			
		||||
//                           eek_xkl_layout_get_options (layout));
 | 
			
		||||
//        break;
 | 
			
		||||
//    default:
 | 
			
		||||
//        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
//        break;
 | 
			
		||||
//    }
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
//static void
 | 
			
		||||
//eek_xkl_layout_class_init (EekXklLayoutClass *klass)
 | 
			
		||||
//{
 | 
			
		||||
//    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 | 
			
		||||
//    GParamSpec *pspec;
 | 
			
		||||
//
 | 
			
		||||
//    g_type_class_add_private (gobject_class, sizeof (EekXklLayoutPrivate));
 | 
			
		||||
//
 | 
			
		||||
//    gobject_class->dispose = eek_xkl_layout_dispose;
 | 
			
		||||
//    gobject_class->set_property = eek_xkl_layout_set_property;
 | 
			
		||||
//    gobject_class->get_property = eek_xkl_layout_get_property;
 | 
			
		||||
//
 | 
			
		||||
//    /**
 | 
			
		||||
//     * EekXklLayout:model:
 | 
			
		||||
//     *
 | 
			
		||||
//     * The libxklavier model name of #EekXklLayout.
 | 
			
		||||
//     */
 | 
			
		||||
//    pspec = g_param_spec_string ("model",
 | 
			
		||||
//                                 "Model",
 | 
			
		||||
//                                 "Libxklavier model",
 | 
			
		||||
//                                 NULL,
 | 
			
		||||
//                                 G_PARAM_READWRITE);
 | 
			
		||||
//    g_object_class_install_property (gobject_class, PROP_MODEL, pspec);
 | 
			
		||||
//
 | 
			
		||||
//    /**
 | 
			
		||||
//     * EekXklLayout:layouts:
 | 
			
		||||
//     *
 | 
			
		||||
//     * The libxklavier layout names of #EekXklLayout.
 | 
			
		||||
//     */
 | 
			
		||||
//    pspec = g_param_spec_boxed ("layouts",
 | 
			
		||||
//                                "Layouts",
 | 
			
		||||
//                                "Libxklavier layouts",
 | 
			
		||||
//                                G_TYPE_STRV,
 | 
			
		||||
//                                G_PARAM_READWRITE);
 | 
			
		||||
//    g_object_class_install_property (gobject_class, PROP_LAYOUTS, pspec);
 | 
			
		||||
//
 | 
			
		||||
//    /**
 | 
			
		||||
//     * EekXklLayout:variants:
 | 
			
		||||
//     *
 | 
			
		||||
//     * The libxklavier variant names of #EekXklLayout.
 | 
			
		||||
//     */
 | 
			
		||||
//    pspec = g_param_spec_boxed ("variants",
 | 
			
		||||
//                                "Variants",
 | 
			
		||||
//                                "Libxklavier variants",
 | 
			
		||||
//                                G_TYPE_STRV,
 | 
			
		||||
//                                G_PARAM_READWRITE);
 | 
			
		||||
//    g_object_class_install_property (gobject_class, PROP_VARIANTS, pspec);
 | 
			
		||||
//
 | 
			
		||||
//    /**
 | 
			
		||||
//     * EekXklLayout:options:
 | 
			
		||||
//     *
 | 
			
		||||
//     * The libxklavier option names of #EekXklLayout.
 | 
			
		||||
//     */
 | 
			
		||||
//    pspec = g_param_spec_boxed ("options",
 | 
			
		||||
//                                "Options",
 | 
			
		||||
//                                "Libxklavier options",
 | 
			
		||||
//                                G_TYPE_STRV,
 | 
			
		||||
//                                G_PARAM_READWRITE);
 | 
			
		||||
//    g_object_class_install_property (gobject_class, PROP_OPTIONS, pspec);
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
//static void
 | 
			
		||||
//eek_xkl_layout_init (EekXklLayout *self)
 | 
			
		||||
//{
 | 
			
		||||
//    self->priv = EEK_XKL_LAYOUT_GET_PRIVATE (self);
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_new:
 | 
			
		||||
// *
 | 
			
		||||
// * Create a new #EekXklLayout.
 | 
			
		||||
// */
 | 
			
		||||
//EekLayout *
 | 
			
		||||
//eek_xkl_layout_new (Display *display, GError **error)
 | 
			
		||||
//{
 | 
			
		||||
//    return (EekLayout *) g_initable_new (EEK_TYPE_XKL_LAYOUT,
 | 
			
		||||
//                                         NULL,
 | 
			
		||||
//                                         error,
 | 
			
		||||
//                                         "display", display,
 | 
			
		||||
//                                         NULL);
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
//G_INLINE_FUNC void
 | 
			
		||||
//merge_xkl_config_rec (XklConfigRec *dst, XklConfigRec *src)
 | 
			
		||||
//{
 | 
			
		||||
//    if (src->model) {
 | 
			
		||||
//        g_free (dst->model);
 | 
			
		||||
//        dst->model = g_strdup (src->model);
 | 
			
		||||
//    }
 | 
			
		||||
//    if (src->layouts) {
 | 
			
		||||
//        g_strfreev (dst->layouts);
 | 
			
		||||
//        dst->layouts = g_strdupv (src->layouts);
 | 
			
		||||
//    }
 | 
			
		||||
//    if (src->variants) {
 | 
			
		||||
//        g_strfreev (dst->variants);
 | 
			
		||||
//        dst->variants = g_strdupv (src->variants);
 | 
			
		||||
//    }
 | 
			
		||||
//    if (src->options) {
 | 
			
		||||
//        g_strfreev (dst->options);
 | 
			
		||||
//        dst->options = g_strdupv (src->options);
 | 
			
		||||
//    }
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_set_config: (skip)
 | 
			
		||||
// * @layout: an #EekXklLayout
 | 
			
		||||
// * @config: Libxklavier configuration
 | 
			
		||||
// *
 | 
			
		||||
// * Reconfigure @layout with @config.
 | 
			
		||||
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
// */
 | 
			
		||||
//gboolean
 | 
			
		||||
//eek_xkl_layout_set_config (EekXklLayout *layout,
 | 
			
		||||
//                           XklConfigRec *config)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
//    XklConfigRec *c;
 | 
			
		||||
//    gboolean retval;
 | 
			
		||||
//
 | 
			
		||||
//    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
//    c = xkl_config_rec_new ();
 | 
			
		||||
//    merge_xkl_config_rec (c, priv->config);
 | 
			
		||||
//    merge_xkl_config_rec (c, config);
 | 
			
		||||
//    retval = set_xkb_component_names (layout, c);
 | 
			
		||||
//    g_object_unref (c);
 | 
			
		||||
//    merge_xkl_config_rec (priv->config, config);
 | 
			
		||||
//    return retval;
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_set_config_full:
 | 
			
		||||
// * @layout: an #EekXklLayout
 | 
			
		||||
// * @model: Libxklavier model name
 | 
			
		||||
// * @layouts: Libxklavier layouts
 | 
			
		||||
// * @variants: Libxklavier variants
 | 
			
		||||
// * @options: Libxklavier options
 | 
			
		||||
// *
 | 
			
		||||
// * Reconfigure @layout with @model, @layouts, @variants, and @options.
 | 
			
		||||
// * This function is merely a wrapper around
 | 
			
		||||
// * eek_xkl_layout_set_config() to avoid passing a pointer of
 | 
			
		||||
// * XklConfigRec, which is not currently available in the
 | 
			
		||||
// * gobject-introspection repository.
 | 
			
		||||
// *
 | 
			
		||||
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
// * Since: 0.0.2
 | 
			
		||||
// */
 | 
			
		||||
//gboolean
 | 
			
		||||
//eek_xkl_layout_set_config_full (EekXklLayout *layout,
 | 
			
		||||
//                                gchar *model,
 | 
			
		||||
//                                gchar **layouts,
 | 
			
		||||
//                                gchar **variants,
 | 
			
		||||
//                                gchar **options)
 | 
			
		||||
//{
 | 
			
		||||
//    XklConfigRec *config;
 | 
			
		||||
//    gboolean retval;
 | 
			
		||||
//
 | 
			
		||||
//    config = xkl_config_rec_new ();
 | 
			
		||||
//    config->model = g_strdup (model);
 | 
			
		||||
//    config->layouts = g_strdupv (layouts);
 | 
			
		||||
//    config->variants = g_strdupv (variants);
 | 
			
		||||
//    config->options = g_strdupv (options);
 | 
			
		||||
//    retval = eek_xkl_layout_set_config (layout, config);
 | 
			
		||||
//    g_object_unref (config);
 | 
			
		||||
//    return retval;
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_set_model:
 | 
			
		||||
// * @layout: an #EekXklLayout
 | 
			
		||||
// * @model: model name
 | 
			
		||||
// *
 | 
			
		||||
// * Set the model name of @layout configuration (in the Libxklavier terminology).
 | 
			
		||||
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
// */
 | 
			
		||||
//gboolean
 | 
			
		||||
//eek_xkl_layout_set_model (EekXklLayout *layout,
 | 
			
		||||
//                          const gchar  *model)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
//    XklConfigRec *config;
 | 
			
		||||
//    gboolean retval;
 | 
			
		||||
//    
 | 
			
		||||
//    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
//    config = xkl_config_rec_new ();
 | 
			
		||||
//    /* config->model will be freed on g_object_unref (config) */
 | 
			
		||||
//    if (model)
 | 
			
		||||
//        config->model = g_strdup (model);
 | 
			
		||||
//    else
 | 
			
		||||
//        config->model = NULL;
 | 
			
		||||
//    retval = eek_xkl_layout_set_config (layout, config);
 | 
			
		||||
//    g_object_unref (config);
 | 
			
		||||
//    return retval;
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_set_layouts:
 | 
			
		||||
// * @layout: an #EekXklLayout
 | 
			
		||||
// * @layouts: layout names
 | 
			
		||||
// *
 | 
			
		||||
// * Set the layout names of @layout (in the Libxklavier terminology).
 | 
			
		||||
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
// */
 | 
			
		||||
//gboolean
 | 
			
		||||
//eek_xkl_layout_set_layouts (EekXklLayout *layout,
 | 
			
		||||
//                            gchar       **layouts)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
//    XklConfigRec *config;
 | 
			
		||||
//    gboolean retval;
 | 
			
		||||
//
 | 
			
		||||
//    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
//    config = xkl_config_rec_new ();
 | 
			
		||||
//    /* config->layouts will be freed on g_object_unref (config) */
 | 
			
		||||
//    if (layouts)
 | 
			
		||||
//        config->layouts = g_strdupv (layouts);
 | 
			
		||||
//    else
 | 
			
		||||
//        config->layouts = layouts;
 | 
			
		||||
//    retval = eek_xkl_layout_set_config (layout, config);
 | 
			
		||||
//    g_object_unref (config);
 | 
			
		||||
//    return retval;
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_set_variants:
 | 
			
		||||
// * @layout: an #EekXklLayout
 | 
			
		||||
// * @variants: variant names
 | 
			
		||||
// *
 | 
			
		||||
// * Set the variant names of @layout (in the Libxklavier terminology).
 | 
			
		||||
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
// */
 | 
			
		||||
//gboolean
 | 
			
		||||
//eek_xkl_layout_set_variants (EekXklLayout *layout,
 | 
			
		||||
//                             gchar       **variants)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
//    XklConfigRec *config;
 | 
			
		||||
//    gboolean retval;
 | 
			
		||||
//
 | 
			
		||||
//    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
//    config = xkl_config_rec_new ();
 | 
			
		||||
//    /* config->variants will be freed on g_object_unref (config) */
 | 
			
		||||
//    if (variants)
 | 
			
		||||
//        config->variants = g_strdupv (variants);
 | 
			
		||||
//    else
 | 
			
		||||
//        config->variants = NULL;
 | 
			
		||||
//    retval = eek_xkl_layout_set_config (layout, config);
 | 
			
		||||
//    g_object_unref (config);
 | 
			
		||||
//    return retval;
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_set_options:
 | 
			
		||||
// * @layout: an #EekXklLayout
 | 
			
		||||
// * @options: option names
 | 
			
		||||
// *
 | 
			
		||||
// * Set the option names of @layout (in the Libxklavier terminology).
 | 
			
		||||
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
// */
 | 
			
		||||
//gboolean
 | 
			
		||||
//eek_xkl_layout_set_options (EekXklLayout *layout,
 | 
			
		||||
//                            gchar       **options)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
//    XklConfigRec *config;
 | 
			
		||||
//    gboolean retval;
 | 
			
		||||
//
 | 
			
		||||
//    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
//    config = xkl_config_rec_new ();
 | 
			
		||||
//    /* config->options will be freed on g_object_unref (config) */
 | 
			
		||||
//    if (options)
 | 
			
		||||
//        config->options = options;
 | 
			
		||||
//    else
 | 
			
		||||
//        config->options = NULL;
 | 
			
		||||
//    retval = eek_xkl_layout_set_config (layout, config);
 | 
			
		||||
//    g_object_unref (config);
 | 
			
		||||
//    return retval;
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_enable_option:
 | 
			
		||||
// * @layout: an #EekXklLayout
 | 
			
		||||
// * @option: option name
 | 
			
		||||
// *
 | 
			
		||||
// * Set the option of @layout (in the Libxklavier terminology).
 | 
			
		||||
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
// */
 | 
			
		||||
//gboolean
 | 
			
		||||
//eek_xkl_layout_enable_option  (EekXklLayout *layout,
 | 
			
		||||
//                               const gchar  *option)
 | 
			
		||||
//{
 | 
			
		||||
//    gchar **options, **_options;
 | 
			
		||||
//    gint i, j;
 | 
			
		||||
//
 | 
			
		||||
//    options = eek_xkl_layout_get_options (layout);
 | 
			
		||||
//    for (i = 0; options && options[i]; i++)
 | 
			
		||||
//        if (g_strcmp0 (options[i], option) == 0)
 | 
			
		||||
//            return TRUE;
 | 
			
		||||
//    _options = g_new0 (gchar *, (i + 2));
 | 
			
		||||
//    for (j = 0; j < i; j++)
 | 
			
		||||
//        _options[j] = g_strdup (options[j]);
 | 
			
		||||
//    _options[i] = g_strdup (option);
 | 
			
		||||
//    /* eek_xkl_layout_set_options() will free _options and its elements. */
 | 
			
		||||
//    return eek_xkl_layout_set_options (layout, _options);
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_disable_option:
 | 
			
		||||
// * @layout: an #EekXklLayout
 | 
			
		||||
// * @option: option name
 | 
			
		||||
// *
 | 
			
		||||
// * Unset the option of @layout (in the Libxklavier terminology).
 | 
			
		||||
// * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
// */
 | 
			
		||||
//gboolean
 | 
			
		||||
//eek_xkl_layout_disable_option (EekXklLayout *layout,
 | 
			
		||||
//                               const gchar  *option)
 | 
			
		||||
//{
 | 
			
		||||
//    gchar **options, **_options;
 | 
			
		||||
//    gint i, j, k;
 | 
			
		||||
//
 | 
			
		||||
//    options = eek_xkl_layout_get_options (layout);
 | 
			
		||||
//    if (!options)
 | 
			
		||||
//        return TRUE;
 | 
			
		||||
//    for (i = 0, k = 0; options[i]; i++)
 | 
			
		||||
//        if (g_strcmp0 (options[i], option) == 0)
 | 
			
		||||
//            k = i;
 | 
			
		||||
//    if (options[k] == NULL)
 | 
			
		||||
//        return TRUE;
 | 
			
		||||
//    _options = g_new0 (gchar *, i);
 | 
			
		||||
//    for (j = 0; j < k; j++)
 | 
			
		||||
//        _options[j] = g_strdup (options[j]);
 | 
			
		||||
//    for (j = k + 1; j < i; j++)
 | 
			
		||||
//        _options[j] = g_strdup (options[j]);
 | 
			
		||||
//    /* eek_xkl_layout_set_options() will free _options and its elements. */
 | 
			
		||||
//    return eek_xkl_layout_set_options (layout, _options);
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_get_model:
 | 
			
		||||
// * @layout: an #EekXklLayout
 | 
			
		||||
// *
 | 
			
		||||
// * Get the model name of @layout configuration (in the Libxklavier terminology).
 | 
			
		||||
// */
 | 
			
		||||
//gchar *
 | 
			
		||||
//eek_xkl_layout_get_model (EekXklLayout *layout)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
//
 | 
			
		||||
//    g_return_val_if_fail (priv, NULL);
 | 
			
		||||
//    return g_strdup (priv->config->model);
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_get_layouts:
 | 
			
		||||
// * @layout: an #EekXklLayout
 | 
			
		||||
// *
 | 
			
		||||
// * Get the layout names of @layout configuration (in the Libxklavier
 | 
			
		||||
// * terminology).
 | 
			
		||||
// */
 | 
			
		||||
//gchar **
 | 
			
		||||
//eek_xkl_layout_get_layouts (EekXklLayout *layout)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
//
 | 
			
		||||
//    g_return_val_if_fail (priv, NULL);
 | 
			
		||||
//    return g_strdupv (priv->config->layouts);
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_get_variants:
 | 
			
		||||
// * @layout: an #EekXklLayout
 | 
			
		||||
// *
 | 
			
		||||
// * Get the variant names of @layout configuration (in the Libxklavier
 | 
			
		||||
// * terminology).
 | 
			
		||||
// */
 | 
			
		||||
//gchar **
 | 
			
		||||
//eek_xkl_layout_get_variants (EekXklLayout *layout)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
//
 | 
			
		||||
//    g_return_val_if_fail (priv, NULL);
 | 
			
		||||
//    return g_strdupv (priv->config->variants);
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_get_options:
 | 
			
		||||
// * @layout: an #EekXklLayout
 | 
			
		||||
// *
 | 
			
		||||
// * Get the option names of @layout configuration (in the Libxklavier
 | 
			
		||||
// * terminology).
 | 
			
		||||
// */
 | 
			
		||||
//gchar **
 | 
			
		||||
//eek_xkl_layout_get_options (EekXklLayout *layout)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
//
 | 
			
		||||
//    g_return_val_if_fail (priv, NULL);
 | 
			
		||||
//    return g_strdupv (priv->config->options);
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
//static gboolean
 | 
			
		||||
//set_xkb_component_names (EekXklLayout *layout, XklConfigRec *config)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayoutPrivate *priv = layout->priv;
 | 
			
		||||
//    XkbComponentNamesRec names;
 | 
			
		||||
//    gboolean retval = FALSE;
 | 
			
		||||
//
 | 
			
		||||
//#if DEBUG
 | 
			
		||||
//    if (config->layouts) {
 | 
			
		||||
//        gint i;
 | 
			
		||||
//
 | 
			
		||||
//        fprintf (stderr, "layout = ");
 | 
			
		||||
//        for (i = 0; config->layouts[i] != NULL; i++)
 | 
			
		||||
//            fprintf (stderr, "\"%s\" ", config->layouts[i]);
 | 
			
		||||
//        fputc ('\n', stderr);
 | 
			
		||||
//    } else
 | 
			
		||||
//        fprintf (stderr, "layouts = NULL\n");
 | 
			
		||||
//    if (config->variants) {
 | 
			
		||||
//        gint i;
 | 
			
		||||
//
 | 
			
		||||
//        fprintf (stderr, "variant = ");
 | 
			
		||||
//        for (i = 0; config->variants[i]; i++)
 | 
			
		||||
//            fprintf (stderr, "\"%s\" ", config->variants[i]);
 | 
			
		||||
//        fputc ('\n', stderr);
 | 
			
		||||
//    } else
 | 
			
		||||
//        fprintf (stderr, "variants = NULL\n");
 | 
			
		||||
//    if (config->options) {
 | 
			
		||||
//        gint i;
 | 
			
		||||
//
 | 
			
		||||
//        fprintf (stderr, "option = ");
 | 
			
		||||
//        for (i = 0; config->options[i]; i++)
 | 
			
		||||
//            fprintf (stderr, "\"%s\" ", config->options[i]);
 | 
			
		||||
//        fputc ('\n', stderr);
 | 
			
		||||
//    } else
 | 
			
		||||
//        fprintf (stderr, "options = NULL\n");
 | 
			
		||||
//#endif
 | 
			
		||||
//
 | 
			
		||||
//    if (xkl_xkb_config_native_prepare (priv->engine, config, &names)) {
 | 
			
		||||
//        GError *error = NULL;
 | 
			
		||||
//        retval = eek_xkb_layout_set_names (EEK_XKB_LAYOUT(layout),
 | 
			
		||||
//                                           &names,
 | 
			
		||||
//                                           &error);
 | 
			
		||||
//        if (!retval)
 | 
			
		||||
//            g_warning ("can't set XKB layout");
 | 
			
		||||
//        xkl_xkb_config_native_cleanup (priv->engine, &names);
 | 
			
		||||
//    }
 | 
			
		||||
//    return retval;
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
///**
 | 
			
		||||
// * eek_xkl_layout_get_option:
 | 
			
		||||
// * @layout: an #EekXklLayout
 | 
			
		||||
// * @option: option name
 | 
			
		||||
// *
 | 
			
		||||
// * Tell if the option of @layout (in the Libxklavier terminology) is set.
 | 
			
		||||
// * Returns: %TRUE if the option is set, %FALSE otherwise
 | 
			
		||||
// */
 | 
			
		||||
//gboolean
 | 
			
		||||
//eek_xkl_layout_get_option (EekXklLayout *layout,
 | 
			
		||||
//                           const gchar  *option)
 | 
			
		||||
//{
 | 
			
		||||
//    gchar **options;
 | 
			
		||||
//    gint i;
 | 
			
		||||
//
 | 
			
		||||
//    options = eek_xkl_layout_get_options (layout);
 | 
			
		||||
//    for (i = 0; options && options[i]; i++)
 | 
			
		||||
//        if (g_strcmp0 (options[i], option) == 0)
 | 
			
		||||
//            return TRUE;
 | 
			
		||||
//    return FALSE;
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
//static gboolean
 | 
			
		||||
//initable_init (GInitable    *initable,
 | 
			
		||||
//               GCancellable *cancellable,
 | 
			
		||||
//               GError      **error)
 | 
			
		||||
//{
 | 
			
		||||
//    EekXklLayout *layout = EEK_XKL_LAYOUT (initable);
 | 
			
		||||
//    Display *display;
 | 
			
		||||
//
 | 
			
		||||
//    if (!parent_initable_iface->init (initable, cancellable, error))
 | 
			
		||||
//        return FALSE;
 | 
			
		||||
//
 | 
			
		||||
//    layout->priv->config = xkl_config_rec_new ();
 | 
			
		||||
//
 | 
			
		||||
//    g_object_get (G_OBJECT (initable),
 | 
			
		||||
//                  "display", &display,
 | 
			
		||||
//                  NULL);
 | 
			
		||||
//
 | 
			
		||||
//    layout->priv->engine = xkl_engine_get_instance (display);
 | 
			
		||||
//
 | 
			
		||||
//    if (!xkl_config_rec_get_from_server (layout->priv->config,
 | 
			
		||||
//                                         layout->priv->engine)) {
 | 
			
		||||
//        g_set_error (error,
 | 
			
		||||
//                     EEK_ERROR,
 | 
			
		||||
//                     EEK_ERROR_LAYOUT_ERROR,
 | 
			
		||||
//                     "can't load libxklavier configuration");
 | 
			
		||||
//        return FALSE;
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    set_xkb_component_names (layout, layout->priv->config);
 | 
			
		||||
//    return TRUE;
 | 
			
		||||
//}
 | 
			
		||||
//
 | 
			
		||||
//static void
 | 
			
		||||
//initable_iface_init (GInitableIface *initable_iface)
 | 
			
		||||
//{
 | 
			
		||||
//    parent_initable_iface = g_type_interface_peek_parent (initable_iface);
 | 
			
		||||
//    initable_iface->init = initable_init;
 | 
			
		||||
//}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										97
									
								
								eek/eek-wkl-layout.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								eek/eek-wkl-layout.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,97 @@
 | 
			
		||||
/* 
 | 
			
		||||
 * Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
 | 
			
		||||
 * Copyright (C) 2010-2011 Red Hat, Inc.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public License
 | 
			
		||||
 * as published by the Free Software Foundation; either version 2 of
 | 
			
		||||
 * the License, or (at your option) any later version.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is distributed in the hope that it will be useful, but
 | 
			
		||||
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 * 
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
			
		||||
 * 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
//#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
 | 
			
		||||
//#error "Only <eek/eek-xkl.h> can be included directly."
 | 
			
		||||
//#endif
 | 
			
		||||
//
 | 
			
		||||
//#ifndef EEK_XKL_LAYOUT_H
 | 
			
		||||
//#define EEK_XKL_LAYOUT_H 1
 | 
			
		||||
//
 | 
			
		||||
//#include <libxklavier/xklavier.h>
 | 
			
		||||
//#include "eek-xkb-layout.h"
 | 
			
		||||
//
 | 
			
		||||
//G_BEGIN_DECLS
 | 
			
		||||
//
 | 
			
		||||
//#define EEK_TYPE_XKL_LAYOUT (eek_xkl_layout_get_type())
 | 
			
		||||
//#define EEK_XKL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayout))
 | 
			
		||||
//#define EEK_XKL_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XKL_LAYOUT, EekXklLayoutClass))
 | 
			
		||||
//#define EEK_IS_XKL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XKL_LAYOUT))
 | 
			
		||||
//#define EEK_IS_XKL_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XKL_LAYOUT))
 | 
			
		||||
//#define EEK_XKL_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayoutClass))
 | 
			
		||||
//
 | 
			
		||||
//typedef struct _EekXklLayout        EekXklLayout;
 | 
			
		||||
//typedef struct _EekXklLayoutClass   EekXklLayoutClass;
 | 
			
		||||
//typedef struct _EekXklLayoutPrivate EekXklLayoutPrivate;
 | 
			
		||||
//
 | 
			
		||||
//struct _EekXklLayout
 | 
			
		||||
//{
 | 
			
		||||
//    /*< private >*/
 | 
			
		||||
//    EekXkbLayout parent;
 | 
			
		||||
//
 | 
			
		||||
//    EekXklLayoutPrivate *priv;
 | 
			
		||||
//};
 | 
			
		||||
//
 | 
			
		||||
//struct _EekXklLayoutClass
 | 
			
		||||
//{
 | 
			
		||||
//    /*< private >*/
 | 
			
		||||
//    EekXkbLayoutClass parent_class;
 | 
			
		||||
//
 | 
			
		||||
//    /*< private >*/
 | 
			
		||||
//    /* padding */
 | 
			
		||||
//    gpointer pdummy[24];
 | 
			
		||||
//};
 | 
			
		||||
//
 | 
			
		||||
//GType      eek_xkl_layout_get_type        (void) G_GNUC_CONST;
 | 
			
		||||
//
 | 
			
		||||
//EekLayout *eek_xkl_layout_new             (Display      *display,
 | 
			
		||||
//                                           GError      **error);
 | 
			
		||||
//
 | 
			
		||||
//gboolean   eek_xkl_layout_set_config      (EekXklLayout *layout,
 | 
			
		||||
//                                           XklConfigRec *config);
 | 
			
		||||
//
 | 
			
		||||
//gboolean   eek_xkl_layout_set_config_full (EekXklLayout *layout,
 | 
			
		||||
//                                           gchar        *model,
 | 
			
		||||
//                                           gchar       **layouts,
 | 
			
		||||
//                                           gchar       **variants,
 | 
			
		||||
//                                           gchar       **options);
 | 
			
		||||
//
 | 
			
		||||
//gboolean   eek_xkl_layout_set_model       (EekXklLayout *layout,
 | 
			
		||||
//                                           const gchar  *model);
 | 
			
		||||
//gboolean   eek_xkl_layout_set_layouts     (EekXklLayout *layout,
 | 
			
		||||
//                                           gchar       **layouts);
 | 
			
		||||
//gboolean   eek_xkl_layout_set_variants    (EekXklLayout *layout,
 | 
			
		||||
//                                           gchar       **variants);
 | 
			
		||||
//gboolean   eek_xkl_layout_set_options     (EekXklLayout *layout,
 | 
			
		||||
//                                           gchar       **options);
 | 
			
		||||
//gboolean   eek_xkl_layout_enable_option   (EekXklLayout *layout,
 | 
			
		||||
//                                           const gchar  *option);
 | 
			
		||||
//gboolean   eek_xkl_layout_disable_option  (EekXklLayout *layout,
 | 
			
		||||
//                                           const gchar  *option);
 | 
			
		||||
//
 | 
			
		||||
//gchar     *eek_xkl_layout_get_model       (EekXklLayout *layout);
 | 
			
		||||
//gchar    **eek_xkl_layout_get_layouts     (EekXklLayout *layout);
 | 
			
		||||
//gchar    **eek_xkl_layout_get_variants    (EekXklLayout *layout);
 | 
			
		||||
//gchar    **eek_xkl_layout_get_options     (EekXklLayout *layout);
 | 
			
		||||
//gboolean   eek_xkl_layout_get_option      (EekXklLayout *layout,
 | 
			
		||||
//                                           const gchar  *option);
 | 
			
		||||
//
 | 
			
		||||
//G_END_DECLS
 | 
			
		||||
//#endif              /* #ifndef EEK_XKL_LAYOUT_H */
 | 
			
		||||
@ -17,10 +17,10 @@
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
			
		||||
 * 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
#ifndef EEK_XKB_H
 | 
			
		||||
#define EEK_XKB_H 1
 | 
			
		||||
 | 
			
		||||
#include "eek.h"
 | 
			
		||||
#include "eek-xkb-layout.h"
 | 
			
		||||
 | 
			
		||||
#endif  /* EEK_XKB_H */
 | 
			
		||||
//#ifndef EEK_XKL_H
 | 
			
		||||
//#define EEK_XKL_H 1
 | 
			
		||||
//
 | 
			
		||||
//#include "eek.h"
 | 
			
		||||
//#include "eek-xkl-layout.h"
 | 
			
		||||
//
 | 
			
		||||
//#endif  /* EEK_XKL_H */
 | 
			
		||||
@ -1,933 +0,0 @@
 | 
			
		||||
/* 
 | 
			
		||||
 * Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org>
 | 
			
		||||
 * Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
 | 
			
		||||
 * Copyright (C) 2010-2011 Red Hat, Inc.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public License
 | 
			
		||||
 * as published by the Free Software Foundation; either version 2 of
 | 
			
		||||
 * the License, or (at your option) any later version.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is distributed in the hope that it will be useful, but
 | 
			
		||||
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 * 
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
			
		||||
 * 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SECTION:eek-xkb-layout
 | 
			
		||||
 * @short_description: Layout engine using XKB configuration
 | 
			
		||||
 *
 | 
			
		||||
 * The #EekXkbLayout inherits #EekLayout class and arranges keyboard
 | 
			
		||||
 * elements using XKB.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_CONFIG_H
 | 
			
		||||
#include "config.h"
 | 
			
		||||
#endif  /* HAVE_CONFIG_H */
 | 
			
		||||
 | 
			
		||||
#include <X11/keysym.h>
 | 
			
		||||
#include <X11/XKBlib.h>
 | 
			
		||||
#include <X11/extensions/XKBgeom.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <stdarg.h>
 | 
			
		||||
#include <gio/gio.h>
 | 
			
		||||
 | 
			
		||||
#include "eek-xkb-layout.h"
 | 
			
		||||
#include "eek-keyboard.h"
 | 
			
		||||
#include "eek-section.h"
 | 
			
		||||
#include "eek-key.h"
 | 
			
		||||
#include "eek-keysym.h"
 | 
			
		||||
 | 
			
		||||
#define noKBDRAW_DEBUG
 | 
			
		||||
 | 
			
		||||
static void initable_iface_init (GInitableIface *initable_iface);
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_CODE (EekXkbLayout, eek_xkb_layout, EEK_TYPE_LAYOUT,
 | 
			
		||||
                         G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
 | 
			
		||||
                                                initable_iface_init));
 | 
			
		||||
 | 
			
		||||
#define EEK_XKB_LAYOUT_GET_PRIVATE(obj)                                  \
 | 
			
		||||
    (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutPrivate))
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
    PROP_0,
 | 
			
		||||
    PROP_DISPLAY,
 | 
			
		||||
    PROP_KEYCODES,
 | 
			
		||||
    PROP_GEOMETRY,
 | 
			
		||||
    PROP_SYMBOLS,
 | 
			
		||||
    PROP_LAST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct _EekXkbLayoutPrivate
 | 
			
		||||
{
 | 
			
		||||
    /* Configuration names that should synch'ed to the symbolic names
 | 
			
		||||
       in priv->xkb->names.  Since we use GLib's memory allocator,
 | 
			
		||||
       don't store any address returned from the X server here. */
 | 
			
		||||
    XkbComponentNamesRec names;
 | 
			
		||||
 | 
			
		||||
    Display *display;
 | 
			
		||||
 | 
			
		||||
    /* Actual XKB configuration of DISPLAY. */
 | 
			
		||||
    XkbDescRec *xkb;
 | 
			
		||||
 | 
			
		||||
    /* Hash table to cache orefs by shape address. */
 | 
			
		||||
    GHashTable *shape_oref_hash;
 | 
			
		||||
 | 
			
		||||
    gint scale_numerator;
 | 
			
		||||
    gint scale_denominator;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static guint
 | 
			
		||||
find_keycode (EekXkbLayout *layout, gchar *key_name);
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
get_keyboard (EekXkbLayout *layout);
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
get_names (EekXkbLayout *layout);
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
setup_scaling (EekXkbLayout *layout,
 | 
			
		||||
               gdouble       width,
 | 
			
		||||
               gdouble       height);
 | 
			
		||||
 | 
			
		||||
G_INLINE_FUNC gint
 | 
			
		||||
xkb_to_pixmap_coord (EekXkbLayout *layout,
 | 
			
		||||
                     gint          n)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
    return n * priv->scale_numerator / priv->scale_denominator;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
G_INLINE_FUNC gdouble
 | 
			
		||||
xkb_to_pixmap_double (EekXkbLayout *layout,
 | 
			
		||||
                     gdouble       d)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
    return d * priv->scale_numerator / priv->scale_denominator;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
create_key (EekXkbLayout *layout,
 | 
			
		||||
            EekKeyboard  *keyboard,
 | 
			
		||||
            EekSection   *section,
 | 
			
		||||
            gint          column,
 | 
			
		||||
            gint          row,
 | 
			
		||||
            gdouble       x,
 | 
			
		||||
            gdouble       y,
 | 
			
		||||
            XkbKeyRec    *xkbkey)
 | 
			
		||||
{
 | 
			
		||||
    XkbGeometryRec *xkbgeometry;
 | 
			
		||||
    XkbBoundsRec *xkbbounds;
 | 
			
		||||
    XkbShapeRec *xkbshape;
 | 
			
		||||
    XkbOutlineRec *xkboutline;
 | 
			
		||||
    EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
    EekKey *key;
 | 
			
		||||
    EekBounds bounds;
 | 
			
		||||
    EekSymbolMatrix *matrix = NULL;
 | 
			
		||||
    gchar name[XkbKeyNameLength + 1];
 | 
			
		||||
    KeyCode keycode;
 | 
			
		||||
    gint num_groups, num_levels;
 | 
			
		||||
    guint oref;
 | 
			
		||||
    gpointer v;
 | 
			
		||||
 | 
			
		||||
    xkbgeometry = priv->xkb->geom;
 | 
			
		||||
    xkbshape = &xkbgeometry->shapes[xkbkey->shape_ndx];
 | 
			
		||||
    if (g_hash_table_lookup_extended (priv->shape_oref_hash, xkbshape,
 | 
			
		||||
                                      NULL, &v)) {
 | 
			
		||||
        oref = GPOINTER_TO_UINT(v);
 | 
			
		||||
    } else {
 | 
			
		||||
        EekOutline *outline;
 | 
			
		||||
 | 
			
		||||
        xkboutline = xkbshape->primary == NULL ? &xkbshape->outlines[0] :
 | 
			
		||||
            xkbshape->primary;
 | 
			
		||||
 | 
			
		||||
        outline = g_slice_new (EekOutline);
 | 
			
		||||
        outline->corner_radius = xkb_to_pixmap_coord(layout, xkboutline->corner_radius);
 | 
			
		||||
 | 
			
		||||
        if (xkboutline->num_points <= 2) { /* rectangular */
 | 
			
		||||
            gdouble x1, y1, x2, y2;
 | 
			
		||||
 | 
			
		||||
            outline->num_points = 4;
 | 
			
		||||
            outline->points = g_slice_alloc0 (sizeof (EekPoint) *
 | 
			
		||||
                                              outline->num_points);
 | 
			
		||||
            if (xkboutline->num_points == 1) {
 | 
			
		||||
                x1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.x1);
 | 
			
		||||
                y1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.y1);
 | 
			
		||||
                x2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
 | 
			
		||||
                y2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
 | 
			
		||||
            } else {
 | 
			
		||||
                x1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
 | 
			
		||||
                y1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
 | 
			
		||||
                x2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].x);
 | 
			
		||||
                y2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].y);
 | 
			
		||||
            }
 | 
			
		||||
            outline->points[0].x = outline->points[3].x = x1;
 | 
			
		||||
            outline->points[0].y = outline->points[1].y = y1;
 | 
			
		||||
            outline->points[1].x = outline->points[2].x = x2;
 | 
			
		||||
            outline->points[2].y = outline->points[3].y = y2;
 | 
			
		||||
        } else {                /* polygon */
 | 
			
		||||
            gint i;
 | 
			
		||||
 | 
			
		||||
            outline->num_points = xkboutline->num_points;
 | 
			
		||||
            outline->points = g_new0 (EekPoint, outline->num_points);
 | 
			
		||||
            for (i = 0; i < xkboutline->num_points; i++) {
 | 
			
		||||
                outline->points[i].x =
 | 
			
		||||
                    xkb_to_pixmap_coord(layout, xkboutline->points[i].x);
 | 
			
		||||
                outline->points[i].y =
 | 
			
		||||
                    xkb_to_pixmap_coord(layout, xkboutline->points[i].y);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        oref = eek_keyboard_add_outline (keyboard, outline);
 | 
			
		||||
        eek_outline_free (outline);
 | 
			
		||||
        g_hash_table_insert (priv->shape_oref_hash, xkbshape,
 | 
			
		||||
                             GUINT_TO_POINTER(oref));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    memset (name, 0, sizeof name);
 | 
			
		||||
    memcpy (name, xkbkey->name.name, sizeof name - 1);
 | 
			
		||||
 | 
			
		||||
    xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
 | 
			
		||||
    bounds.x = xkb_to_pixmap_coord(layout, xkbbounds->x1 + x);
 | 
			
		||||
    bounds.y = xkb_to_pixmap_coord(layout, xkbbounds->y1 + y);
 | 
			
		||||
    bounds.width = xkb_to_pixmap_coord(layout, xkbbounds->x2 - xkbbounds->x1);
 | 
			
		||||
    bounds.height = xkb_to_pixmap_coord(layout, xkbbounds->y2 - xkbbounds->y1);
 | 
			
		||||
 | 
			
		||||
    keycode = find_keycode (layout, name);
 | 
			
		||||
    if (keycode == EEK_INVALID_KEYCODE) {
 | 
			
		||||
        num_groups = num_levels = 0;
 | 
			
		||||
        matrix = eek_symbol_matrix_new (0, 0);
 | 
			
		||||
    } else {
 | 
			
		||||
        KeySym keysym;
 | 
			
		||||
        gint i, j;
 | 
			
		||||
 | 
			
		||||
        num_groups = XkbKeyNumGroups (priv->xkb, keycode);
 | 
			
		||||
        num_levels = XkbKeyGroupsWidth (priv->xkb, keycode);
 | 
			
		||||
        matrix = eek_symbol_matrix_new (num_groups, num_levels);
 | 
			
		||||
        for (i = 0; i < num_groups; i++)
 | 
			
		||||
            for (j = 0; j < num_levels; j++) {
 | 
			
		||||
                EekModifierType modifier;
 | 
			
		||||
 | 
			
		||||
                keysym = XkbKeySymEntry (priv->xkb, keycode, j, i);
 | 
			
		||||
                modifier = XkbKeysymToModifiers (priv->display, keysym);
 | 
			
		||||
                matrix->data[i * num_levels + j] =
 | 
			
		||||
                    EEK_SYMBOL(eek_keysym_new_with_modifier (keysym,
 | 
			
		||||
                                                             modifier));
 | 
			
		||||
            }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    key = eek_section_create_key (section, keycode, column, row);
 | 
			
		||||
    eek_element_set_name (EEK_ELEMENT(key), name);
 | 
			
		||||
    eek_element_set_bounds (EEK_ELEMENT(key), &bounds);
 | 
			
		||||
    eek_key_set_symbol_matrix (key, matrix);
 | 
			
		||||
    eek_symbol_matrix_free (matrix);
 | 
			
		||||
    eek_key_set_oref (key, oref);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
create_section (EekXkbLayout  *layout,
 | 
			
		||||
                EekKeyboard   *keyboard,
 | 
			
		||||
                XkbSectionRec *xkbsection)
 | 
			
		||||
{
 | 
			
		||||
    XkbGeometryRec *xkbgeometry;
 | 
			
		||||
    EekXkbLayoutPrivate *priv;
 | 
			
		||||
    EekSection *section;
 | 
			
		||||
    EekBounds bounds;
 | 
			
		||||
    gchar *name;
 | 
			
		||||
    gfloat left, top;
 | 
			
		||||
    gint i, j;
 | 
			
		||||
 | 
			
		||||
    bounds.x = xkb_to_pixmap_coord(layout, xkbsection->left);
 | 
			
		||||
    bounds.y = xkb_to_pixmap_coord(layout, xkbsection->top);
 | 
			
		||||
    bounds.width = xkb_to_pixmap_coord(layout, xkbsection->width);
 | 
			
		||||
    bounds.height = xkb_to_pixmap_coord(layout, xkbsection->height);
 | 
			
		||||
 | 
			
		||||
    priv = layout->priv;
 | 
			
		||||
    xkbgeometry = priv->xkb->geom;
 | 
			
		||||
    section = eek_keyboard_create_section (keyboard);
 | 
			
		||||
    name = XGetAtomName (priv->display, xkbsection->name);
 | 
			
		||||
    eek_element_set_name (EEK_ELEMENT(section), name);
 | 
			
		||||
    XFree (name);
 | 
			
		||||
    eek_element_set_bounds (EEK_ELEMENT(section), &bounds);
 | 
			
		||||
    eek_section_set_angle (section,
 | 
			
		||||
                           /* angle is in tenth of degree */
 | 
			
		||||
                           xkbsection->angle / 10);
 | 
			
		||||
 | 
			
		||||
    for (i = 0; i < xkbsection->num_rows; i++) {
 | 
			
		||||
        XkbRowRec *xkbrow;
 | 
			
		||||
 | 
			
		||||
        xkbrow = &xkbsection->rows[i];
 | 
			
		||||
        left = xkbrow->left;
 | 
			
		||||
        top = xkbrow->top;
 | 
			
		||||
        eek_section_add_row (section,
 | 
			
		||||
                             xkbrow->num_keys,
 | 
			
		||||
                             xkbrow->vertical ?
 | 
			
		||||
                             EEK_ORIENTATION_VERTICAL :
 | 
			
		||||
                             EEK_ORIENTATION_HORIZONTAL);
 | 
			
		||||
        for (j = 0; j < xkbrow->num_keys; j++) {
 | 
			
		||||
            XkbKeyRec *xkbkey;
 | 
			
		||||
            XkbBoundsRec *xkbbounds;
 | 
			
		||||
 | 
			
		||||
            xkbkey = &xkbrow->keys[j];
 | 
			
		||||
            if (xkbrow->vertical)
 | 
			
		||||
                top += xkbkey->gap;
 | 
			
		||||
            else
 | 
			
		||||
                left += xkbkey->gap;
 | 
			
		||||
            create_key (layout, keyboard, section, j, i, left, top, xkbkey);
 | 
			
		||||
            xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
 | 
			
		||||
            if (xkbrow->vertical)
 | 
			
		||||
                top += xkbbounds->y2 - xkbbounds->y1;
 | 
			
		||||
            else
 | 
			
		||||
                left += xkbbounds->x2 - xkbbounds->x1;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
create_keyboard (EekXkbLayout *layout, EekKeyboard *keyboard)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
    XkbGeometryRec *xkbgeometry;
 | 
			
		||||
    EekBounds bounds;
 | 
			
		||||
    gint i;
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (priv->xkb);
 | 
			
		||||
    g_return_if_fail (priv->xkb->geom);
 | 
			
		||||
 | 
			
		||||
    xkbgeometry = priv->xkb->geom;
 | 
			
		||||
 | 
			
		||||
    eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
 | 
			
		||||
    setup_scaling (EEK_XKB_LAYOUT(layout), bounds.width, bounds.height);
 | 
			
		||||
 | 
			
		||||
    bounds.x = bounds.y = 0;
 | 
			
		||||
    bounds.width = xkb_to_pixmap_coord(layout, xkbgeometry->width_mm);
 | 
			
		||||
    bounds.height = xkb_to_pixmap_coord(layout, xkbgeometry->height_mm);
 | 
			
		||||
 | 
			
		||||
    for (i = 0; i < xkbgeometry->num_sections; i++) {
 | 
			
		||||
        XkbSectionRec *xkbsection;
 | 
			
		||||
 | 
			
		||||
        xkbsection = &xkbgeometry->sections[i];
 | 
			
		||||
        create_section (layout, keyboard, xkbsection);
 | 
			
		||||
    }
 | 
			
		||||
    eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static EekKeyboard *
 | 
			
		||||
eek_xkb_layout_real_create_keyboard (EekLayout *self,
 | 
			
		||||
                                     gdouble    initial_width,
 | 
			
		||||
                                     gdouble    initial_height)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (self);
 | 
			
		||||
    EekBounds bounds;
 | 
			
		||||
    EekKeyboard *keyboard;
 | 
			
		||||
 | 
			
		||||
    keyboard = g_object_new (EEK_TYPE_KEYBOARD, "layout", self, NULL);
 | 
			
		||||
    bounds.x = bounds.y = 0.0;
 | 
			
		||||
    bounds.width = initial_width;
 | 
			
		||||
    bounds.height = initial_height;
 | 
			
		||||
    eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
 | 
			
		||||
 | 
			
		||||
    /* resolve modifiers dynamically assigned at run time */
 | 
			
		||||
    eek_keyboard_set_num_lock_mask (keyboard,
 | 
			
		||||
                                    XkbKeysymToModifiers (priv->display,
 | 
			
		||||
                                                          XK_Num_Lock));
 | 
			
		||||
    eek_keyboard_set_alt_gr_mask (keyboard,
 | 
			
		||||
                                  XkbKeysymToModifiers (priv->display,
 | 
			
		||||
                                                        XK_ISO_Level3_Shift));
 | 
			
		||||
 | 
			
		||||
    if (priv->shape_oref_hash)
 | 
			
		||||
        g_hash_table_destroy (priv->shape_oref_hash);
 | 
			
		||||
 | 
			
		||||
    priv->shape_oref_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
 | 
			
		||||
    create_keyboard (EEK_XKB_LAYOUT(self), keyboard);
 | 
			
		||||
    g_hash_table_destroy (priv->shape_oref_hash);
 | 
			
		||||
 | 
			
		||||
    return keyboard;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eek_xkb_layout_finalize (GObject *object)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (object);
 | 
			
		||||
 | 
			
		||||
    g_free (priv->names.keycodes);
 | 
			
		||||
    g_free (priv->names.geometry);
 | 
			
		||||
    g_free (priv->names.symbols);
 | 
			
		||||
    XkbFreeKeyboard (priv->xkb, 0, TRUE);	/* free_all = TRUE */
 | 
			
		||||
    G_OBJECT_CLASS (eek_xkb_layout_parent_class)->finalize (object);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void 
 | 
			
		||||
eek_xkb_layout_set_property (GObject      *object,
 | 
			
		||||
                             guint         prop_id,
 | 
			
		||||
                             const GValue *value,
 | 
			
		||||
                             GParamSpec   *pspec)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayout *layout = EEK_XKB_LAYOUT (object);
 | 
			
		||||
    const gchar *name;
 | 
			
		||||
 | 
			
		||||
    switch (prop_id) {
 | 
			
		||||
    case PROP_DISPLAY:
 | 
			
		||||
        layout->priv->display = g_value_get_pointer (value);
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_KEYCODES:
 | 
			
		||||
        name = g_value_get_string (value);
 | 
			
		||||
        eek_xkb_layout_set_keycodes (EEK_XKB_LAYOUT(object), name);
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_GEOMETRY:
 | 
			
		||||
        name = g_value_get_string (value);
 | 
			
		||||
        eek_xkb_layout_set_geometry (EEK_XKB_LAYOUT(object), name);
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_SYMBOLS:
 | 
			
		||||
        name = g_value_get_string (value);
 | 
			
		||||
        eek_xkb_layout_set_symbols (EEK_XKB_LAYOUT(object), name);
 | 
			
		||||
        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);
 | 
			
		||||
    const gchar *name;
 | 
			
		||||
 | 
			
		||||
    switch (prop_id) {
 | 
			
		||||
    case PROP_DISPLAY:
 | 
			
		||||
        g_value_set_pointer (value, layout->priv->display);
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_KEYCODES:
 | 
			
		||||
        name = eek_xkb_layout_get_keycodes (EEK_XKB_LAYOUT(object));
 | 
			
		||||
        g_value_set_string (value, name);
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_GEOMETRY:
 | 
			
		||||
        name = eek_xkb_layout_get_geometry (EEK_XKB_LAYOUT(object));
 | 
			
		||||
        g_value_set_string (value, name);
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_SYMBOLS:
 | 
			
		||||
        name = eek_xkb_layout_get_symbols (EEK_XKB_LAYOUT(object));
 | 
			
		||||
        g_value_set_string (value, name);
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eek_xkb_layout_class_init (EekXkbLayoutClass *klass)
 | 
			
		||||
{
 | 
			
		||||
    EekLayoutClass *layout_class = EEK_LAYOUT_CLASS (klass);
 | 
			
		||||
    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 | 
			
		||||
    GParamSpec *pspec;
 | 
			
		||||
 | 
			
		||||
    g_type_class_add_private (gobject_class, sizeof (EekXkbLayoutPrivate));
 | 
			
		||||
 | 
			
		||||
    layout_class->create_keyboard = eek_xkb_layout_real_create_keyboard;
 | 
			
		||||
 | 
			
		||||
    gobject_class->finalize = eek_xkb_layout_finalize;
 | 
			
		||||
    gobject_class->set_property = eek_xkb_layout_set_property;
 | 
			
		||||
    gobject_class->get_property = eek_xkb_layout_get_property;
 | 
			
		||||
 | 
			
		||||
    pspec = g_param_spec_pointer ("display",
 | 
			
		||||
                                  "Display",
 | 
			
		||||
                                  "X Display",
 | 
			
		||||
                                  G_PARAM_READWRITE |
 | 
			
		||||
                                  G_PARAM_CONSTRUCT_ONLY);
 | 
			
		||||
    g_object_class_install_property (gobject_class, PROP_DISPLAY, pspec);
 | 
			
		||||
 | 
			
		||||
    pspec = g_param_spec_string ("keycodes",
 | 
			
		||||
				 "Keycodes",
 | 
			
		||||
				 "XKB keycodes component name",
 | 
			
		||||
				 NULL,
 | 
			
		||||
				 G_PARAM_READWRITE);
 | 
			
		||||
    g_object_class_install_property (gobject_class, PROP_KEYCODES, pspec);
 | 
			
		||||
 | 
			
		||||
    pspec = g_param_spec_string ("geometry",
 | 
			
		||||
                                 "Geometry",
 | 
			
		||||
                                 "XKB geometry component name",
 | 
			
		||||
                                 NULL,
 | 
			
		||||
                                 G_PARAM_READWRITE);
 | 
			
		||||
    g_object_class_install_property (gobject_class, PROP_GEOMETRY, pspec);
 | 
			
		||||
 | 
			
		||||
    pspec = g_param_spec_string ("symbols",
 | 
			
		||||
                                 "Symbols",
 | 
			
		||||
                                 "XKB symbols component name",
 | 
			
		||||
                                 NULL,
 | 
			
		||||
                                 G_PARAM_READWRITE);
 | 
			
		||||
    g_object_class_install_property (gobject_class, PROP_SYMBOLS, pspec);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eek_xkb_layout_init (EekXkbLayout *self)
 | 
			
		||||
{
 | 
			
		||||
    self->priv = EEK_XKB_LAYOUT_GET_PRIVATE (self);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
get_names (EekXkbLayout *layout)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
    gchar *name;
 | 
			
		||||
 | 
			
		||||
    XkbGetNames (priv->display, XkbAllNamesMask, priv->xkb);
 | 
			
		||||
 | 
			
		||||
    if (priv->xkb->names->keycodes <= 0)
 | 
			
		||||
        g_warning ("XKB keycodes setting is not loaded properly");
 | 
			
		||||
    else {
 | 
			
		||||
        name = XGetAtomName (priv->display, priv->xkb->names->keycodes);
 | 
			
		||||
        if (!name)
 | 
			
		||||
            g_warning ("Can't get the name of keycodes");
 | 
			
		||||
        else if (!priv->names.keycodes ||
 | 
			
		||||
                 g_strcmp0 (name, priv->names.keycodes)) {
 | 
			
		||||
            g_free (priv->names.keycodes);
 | 
			
		||||
            priv->names.keycodes = g_strdup (name);
 | 
			
		||||
            XFree (name);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (priv->xkb->names->geometry <= 0)
 | 
			
		||||
        g_warning ("XKB geometry setting is not loaded");
 | 
			
		||||
    else {
 | 
			
		||||
        name = XGetAtomName (priv->display, priv->xkb->names->geometry);
 | 
			
		||||
        if (!name)
 | 
			
		||||
            g_warning ("Can't get the name of geometry");
 | 
			
		||||
        else if (!priv->names.geometry ||
 | 
			
		||||
                 g_strcmp0 (name, priv->names.geometry)) {
 | 
			
		||||
            g_free (priv->names.geometry);
 | 
			
		||||
            priv->names.geometry = g_strdup (name);
 | 
			
		||||
            XFree (name);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (priv->xkb->names->symbols <= 0)
 | 
			
		||||
        g_warning ("XKB symbols setting is not loaded");
 | 
			
		||||
    else {
 | 
			
		||||
        name = XGetAtomName (priv->display, priv->xkb->names->symbols);
 | 
			
		||||
        if (!name)
 | 
			
		||||
            g_warning ("Can't get the name of symbols");
 | 
			
		||||
        else if (!priv->names.symbols ||
 | 
			
		||||
                 g_strcmp0 (name, priv->names.symbols)) {
 | 
			
		||||
            g_free (priv->names.symbols);
 | 
			
		||||
            priv->names.symbols = g_strdup (name);
 | 
			
		||||
            XFree (name);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 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
 | 
			
		||||
 *
 | 
			
		||||
 * Set the XKB component names to @layout.
 | 
			
		||||
 * Returns: %TRUE if any of the component names changed, %FALSE otherwise
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkb_layout_set_names (EekXkbLayout *layout, XkbComponentNamesRec *names)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
    gboolean retval;
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
 | 
			
		||||
    if (g_strcmp0 (names->keycodes, priv->names.keycodes)) {
 | 
			
		||||
        g_free (priv->names.keycodes);
 | 
			
		||||
        priv->names.keycodes = g_strdup (names->keycodes);
 | 
			
		||||
        retval = TRUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (g_strcmp0 (names->geometry, priv->names.geometry)) {
 | 
			
		||||
        g_free (priv->names.geometry);
 | 
			
		||||
        priv->names.geometry = g_strdup (names->geometry);
 | 
			
		||||
        retval = TRUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (g_strcmp0 (names->symbols, priv->names.symbols)) {
 | 
			
		||||
        g_free (priv->names.symbols);
 | 
			
		||||
        priv->names.symbols = g_strdup (names->symbols);
 | 
			
		||||
        retval = TRUE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    get_keyboard (layout);
 | 
			
		||||
    g_assert (priv->xkb);
 | 
			
		||||
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkb_layout_set_names_full:
 | 
			
		||||
 * @layout: an #EekXkbLayout
 | 
			
		||||
 * @Varargs: pairs of component name and value, terminated by NULL.
 | 
			
		||||
 *
 | 
			
		||||
 * Set the XKB component names to @layout.  This function is merely a
 | 
			
		||||
 * wrapper around eek_xkb_layout_set_names() to avoid passing a
 | 
			
		||||
 * pointer of XkbComponentNamesRec, which is not currently available
 | 
			
		||||
 * in the gobject-introspection repository.
 | 
			
		||||
 *
 | 
			
		||||
 * Available component names are: keymap, keycodes, types, compat,
 | 
			
		||||
 * symbols, geometry.
 | 
			
		||||
 *
 | 
			
		||||
 * Returns: %TRUE if the component name is successfully set, %FALSE otherwise
 | 
			
		||||
 * Since: 0.0.2
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkb_layout_set_names_full (EekXkbLayout *layout,
 | 
			
		||||
                               ...)
 | 
			
		||||
{
 | 
			
		||||
    va_list var_args;
 | 
			
		||||
    gboolean retval;
 | 
			
		||||
 | 
			
		||||
    va_start (var_args, layout);
 | 
			
		||||
    retval = eek_xkb_layout_set_names_full_valist (layout, var_args);
 | 
			
		||||
    va_end (var_args);
 | 
			
		||||
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkb_layout_set_names_full_valist:
 | 
			
		||||
 * @layout: an #EekXkbLayout
 | 
			
		||||
 * @var_args: <type>va_list</type> of pairs of component name and value.
 | 
			
		||||
 *
 | 
			
		||||
 * See eek_xkb_layout_set_names_full(), this version takes a
 | 
			
		||||
 * <type>va_list</type> for language bindings to use.
 | 
			
		||||
 *
 | 
			
		||||
 * Since: 0.0.5
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkb_layout_set_names_full_valist (EekXkbLayout *layout,
 | 
			
		||||
                                      va_list       var_args)
 | 
			
		||||
{
 | 
			
		||||
    XkbComponentNamesRec names;
 | 
			
		||||
    gchar *name, *value;
 | 
			
		||||
 | 
			
		||||
    memset (&names, 0, sizeof names);
 | 
			
		||||
    name = va_arg (var_args, gchar *);
 | 
			
		||||
    while (name) {
 | 
			
		||||
        value = va_arg (var_args, gchar *);
 | 
			
		||||
        if (g_strcmp0 (name, "keymap") == 0)
 | 
			
		||||
            names.keymap = (char *)value;
 | 
			
		||||
        else if (g_strcmp0 (name, "keycodes") == 0)
 | 
			
		||||
            names.keycodes = (char *)value;
 | 
			
		||||
        else if (g_strcmp0 (name, "types") == 0)
 | 
			
		||||
            names.types = (char *)value;
 | 
			
		||||
        else if (g_strcmp0 (name, "compat") == 0)
 | 
			
		||||
            names.compat = (char *)value;
 | 
			
		||||
        else if (g_strcmp0 (name, "symbols") == 0)
 | 
			
		||||
            names.symbols = (char *)value;
 | 
			
		||||
        else if (g_strcmp0 (name, "geometry") == 0)
 | 
			
		||||
            names.geometry = (char *)value;
 | 
			
		||||
        name = va_arg (var_args, gchar *);
 | 
			
		||||
    }
 | 
			
		||||
    return eek_xkb_layout_set_names (layout, &names);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkb_layout_set_keycodes:
 | 
			
		||||
 * @layout: an #EekXkbLayout
 | 
			
		||||
 * @keycodes: component name for keycodes
 | 
			
		||||
 *
 | 
			
		||||
 * Set the keycodes component (in the XKB terminology).
 | 
			
		||||
 * Returns: %TRUE if the component name is successfully set, %FALSE otherwise
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkb_layout_set_keycodes (EekXkbLayout *layout, const gchar *keycodes)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
    XkbComponentNamesRec names;
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
    memcpy (&names, &priv->names, sizeof names);
 | 
			
		||||
    names.keycodes = (gchar *)keycodes;
 | 
			
		||||
    return eek_xkb_layout_set_names (layout, &names);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkb_layout_set_geometry:
 | 
			
		||||
 * @layout: an #EekXkbLayout
 | 
			
		||||
 * @geometry: component name for geometry
 | 
			
		||||
 *
 | 
			
		||||
 * Returns: %TRUE if the component name is successfully set, %FALSE otherwise
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkb_layout_set_geometry (EekXkbLayout *layout, const gchar *geometry)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
    XkbComponentNamesRec names;
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
    memcpy (&names, &priv->names, sizeof names);
 | 
			
		||||
    names.geometry = (gchar *)geometry;
 | 
			
		||||
    return eek_xkb_layout_set_names (layout, &names);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkb_layout_set_symbols:
 | 
			
		||||
 * @layout: an #EekXkbLayout
 | 
			
		||||
 * @symbols: component name for symbols
 | 
			
		||||
 *
 | 
			
		||||
 * Set the symbols component (in the XKB terminology).
 | 
			
		||||
 * Returns: %TRUE if the component name is successfully set, %FALSE otherwise
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkb_layout_set_symbols (EekXkbLayout *layout, const gchar *symbols)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
    XkbComponentNamesRec names;
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
    memcpy (&names, &priv->names, sizeof names);
 | 
			
		||||
    names.symbols = (gchar *)symbols;
 | 
			
		||||
    return eek_xkb_layout_set_names (layout, &names);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkb_layout_get_keycodes:
 | 
			
		||||
 * @layout: an #EekXkbLayout
 | 
			
		||||
 *
 | 
			
		||||
 * Get the keycodes component name (in the XKB terminology).
 | 
			
		||||
 */
 | 
			
		||||
G_CONST_RETURN gchar *
 | 
			
		||||
eek_xkb_layout_get_keycodes (EekXkbLayout *layout)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, NULL);
 | 
			
		||||
    return priv->names.keycodes;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkb_layout_get_geometry:
 | 
			
		||||
 * @layout: an #EekXkbLayout
 | 
			
		||||
 *
 | 
			
		||||
 * Get the geometry component name (in the XKB terminology).
 | 
			
		||||
 */
 | 
			
		||||
G_CONST_RETURN gchar *
 | 
			
		||||
eek_xkb_layout_get_geometry (EekXkbLayout *layout)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, NULL);
 | 
			
		||||
    return priv->names.geometry;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkb_layout_get_symbols:
 | 
			
		||||
 * @layout: an #EekXkbLayout
 | 
			
		||||
 *
 | 
			
		||||
 * Get the symbols component name (in the XKB terminology).
 | 
			
		||||
 */
 | 
			
		||||
G_CONST_RETURN gchar *
 | 
			
		||||
eek_xkb_layout_get_symbols (EekXkbLayout *layout)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, NULL);
 | 
			
		||||
    return priv->names.symbols;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
get_keyboard (EekXkbLayout *layout)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
 | 
			
		||||
    if (priv->xkb)
 | 
			
		||||
        XkbFreeKeyboard (priv->xkb, 0, TRUE);	/* free_all = TRUE */
 | 
			
		||||
    priv->xkb = NULL;
 | 
			
		||||
 | 
			
		||||
    if (priv->names.keycodes &&
 | 
			
		||||
        priv->names.geometry &&
 | 
			
		||||
        priv->names.symbols) {
 | 
			
		||||
        priv->xkb = XkbGetKeyboardByName (priv->display, XkbUseCoreKbd,
 | 
			
		||||
                                          &priv->names, 0,
 | 
			
		||||
                                          XkbGBN_GeometryMask |
 | 
			
		||||
                                          XkbGBN_KeyNamesMask |
 | 
			
		||||
                                          XkbGBN_OtherNamesMask |
 | 
			
		||||
                                          XkbGBN_ClientSymbolsMask |
 | 
			
		||||
                                          XkbGBN_IndicatorMapMask, FALSE);
 | 
			
		||||
    } else {
 | 
			
		||||
        priv->xkb = XkbGetKeyboard (priv->display,
 | 
			
		||||
                                    XkbGBN_GeometryMask |
 | 
			
		||||
                                    XkbGBN_KeyNamesMask |
 | 
			
		||||
                                    XkbGBN_OtherNamesMask |
 | 
			
		||||
                                    XkbGBN_SymbolsMask |
 | 
			
		||||
                                    XkbGBN_IndicatorMapMask,
 | 
			
		||||
                                    XkbUseCoreKbd);
 | 
			
		||||
        get_names (layout);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (priv->xkb == NULL) {
 | 
			
		||||
        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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static guint
 | 
			
		||||
find_keycode (EekXkbLayout *layout, gchar *key_name)
 | 
			
		||||
{
 | 
			
		||||
#define KEYSYM_NAME_MAX_LENGTH 4
 | 
			
		||||
    guint keycode;
 | 
			
		||||
    gint i, j;
 | 
			
		||||
    XkbKeyNamePtr pkey;
 | 
			
		||||
    XkbKeyAliasPtr palias;
 | 
			
		||||
    guint is_name_matched;
 | 
			
		||||
    gchar *src, *dst;
 | 
			
		||||
    EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
 | 
			
		||||
    if (!priv->xkb)
 | 
			
		||||
        return EEK_INVALID_KEYCODE;
 | 
			
		||||
 | 
			
		||||
#ifdef KBDRAW_DEBUG
 | 
			
		||||
    printf ("    looking for keycode for (%c%c%c%c)\n",
 | 
			
		||||
            key_name[0], key_name[1], key_name[2], key_name[3]);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    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) {
 | 
			
		||||
#ifdef KBDRAW_DEBUG
 | 
			
		||||
            printf ("      found keycode %u\n", keycode);
 | 
			
		||||
#endif
 | 
			
		||||
            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);
 | 
			
		||||
#ifdef KBDRAW_DEBUG
 | 
			
		||||
            printf ("found alias keycode %u\n", keycode);
 | 
			
		||||
#endif
 | 
			
		||||
            return keycode;
 | 
			
		||||
        }
 | 
			
		||||
        palias++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return EEK_INVALID_KEYCODE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
setup_scaling (EekXkbLayout *layout,
 | 
			
		||||
               gdouble       width,
 | 
			
		||||
               gdouble       height)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayoutPrivate *priv = layout->priv;
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (priv->xkb);
 | 
			
		||||
 | 
			
		||||
    g_return_if_fail (priv->xkb->geom->width_mm > 0);
 | 
			
		||||
    g_return_if_fail (priv->xkb->geom->height_mm > 0);
 | 
			
		||||
 | 
			
		||||
    if (width * priv->xkb->geom->height_mm <
 | 
			
		||||
        height * priv->xkb->geom->width_mm) {
 | 
			
		||||
        priv->scale_numerator = width;
 | 
			
		||||
        priv->scale_denominator = priv->xkb->geom->width_mm;
 | 
			
		||||
    } else {
 | 
			
		||||
        priv->scale_numerator = height;
 | 
			
		||||
        priv->scale_denominator = priv->xkb->geom->height_mm;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
initable_init (GInitable    *initable,
 | 
			
		||||
               GCancellable *cancellable,
 | 
			
		||||
               GError      **error)
 | 
			
		||||
{
 | 
			
		||||
    EekXkbLayout *layout = EEK_XKB_LAYOUT (initable);
 | 
			
		||||
 | 
			
		||||
    /* XXX: XkbClientMapMask | XkbIndicatorMapMask | XkbNamesMask |
 | 
			
		||||
       XkbGeometryMask */
 | 
			
		||||
    layout->priv->xkb = XkbGetKeyboard (layout->priv->display,
 | 
			
		||||
                                        XkbGBN_GeometryMask |
 | 
			
		||||
                                        XkbGBN_KeyNamesMask |
 | 
			
		||||
                                        XkbGBN_OtherNamesMask |
 | 
			
		||||
                                        XkbGBN_SymbolsMask |
 | 
			
		||||
                                        XkbGBN_IndicatorMapMask,
 | 
			
		||||
                                        XkbUseCoreKbd);
 | 
			
		||||
 | 
			
		||||
    if (layout->priv->xkb == NULL) {
 | 
			
		||||
        g_set_error (error,
 | 
			
		||||
                     EEK_ERROR,
 | 
			
		||||
                     EEK_ERROR_LAYOUT_ERROR,
 | 
			
		||||
                     "can't get initial XKB keyboard configuration");
 | 
			
		||||
        return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    get_names (layout);
 | 
			
		||||
    get_keyboard (layout);
 | 
			
		||||
    
 | 
			
		||||
    if (layout->priv->xkb == NULL) {
 | 
			
		||||
        g_set_error (error,
 | 
			
		||||
                     EEK_ERROR,
 | 
			
		||||
                     EEK_ERROR_LAYOUT_ERROR,
 | 
			
		||||
                     "can't get XKB keyboard configuration");
 | 
			
		||||
        return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
initable_iface_init (GInitableIface *initable_iface)
 | 
			
		||||
{
 | 
			
		||||
  initable_iface->init = initable_init;
 | 
			
		||||
}
 | 
			
		||||
@ -1,88 +0,0 @@
 | 
			
		||||
/* 
 | 
			
		||||
 * Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
 | 
			
		||||
 * Copyright (C) 2010-2011 Red Hat, Inc.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public License
 | 
			
		||||
 * as published by the Free Software Foundation; either version 2 of
 | 
			
		||||
 * the License, or (at your option) any later version.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is distributed in the hope that it will be useful, but
 | 
			
		||||
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 * 
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
			
		||||
 * 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
 | 
			
		||||
#error "Only <eek/eek-xkb.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef EEK_XKB_LAYOUT_H
 | 
			
		||||
#define EEK_XKB_LAYOUT_H 1
 | 
			
		||||
 | 
			
		||||
#include <X11/Xlib.h>
 | 
			
		||||
#include <X11/XKBlib.h>
 | 
			
		||||
#include "eek-layout.h"
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define EEK_TYPE_XKB_LAYOUT (eek_xkb_layout_get_type())
 | 
			
		||||
#define EEK_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayout))
 | 
			
		||||
#define EEK_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
 | 
			
		||||
#define EEK_IS_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XKB_LAYOUT))
 | 
			
		||||
#define EEK_IS_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XKB_LAYOUT))
 | 
			
		||||
#define EEK_XKB_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
 | 
			
		||||
 | 
			
		||||
typedef struct _EekXkbLayout        EekXkbLayout;
 | 
			
		||||
typedef struct _EekXkbLayoutClass   EekXkbLayoutClass;
 | 
			
		||||
typedef struct _EekXkbLayoutPrivate EekXkbLayoutPrivate;
 | 
			
		||||
 | 
			
		||||
struct _EekXkbLayout
 | 
			
		||||
{
 | 
			
		||||
    /*< private >*/
 | 
			
		||||
    EekLayout parent;
 | 
			
		||||
 | 
			
		||||
    EekXkbLayoutPrivate *priv;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct _EekXkbLayoutClass
 | 
			
		||||
{
 | 
			
		||||
    /*< private >*/
 | 
			
		||||
    EekLayoutClass parent_class;
 | 
			
		||||
 | 
			
		||||
    /*< private >*/
 | 
			
		||||
    /* padding */
 | 
			
		||||
    gpointer pdummy[24];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
GType        eek_xkb_layout_get_type       (void) G_GNUC_CONST;
 | 
			
		||||
EekLayout   *eek_xkb_layout_new            (Display              *display,
 | 
			
		||||
                                            GError              **error);
 | 
			
		||||
 | 
			
		||||
gboolean     eek_xkb_layout_set_names      (EekXkbLayout         *layout,
 | 
			
		||||
                                            XkbComponentNamesRec *names);
 | 
			
		||||
 | 
			
		||||
gboolean     eek_xkb_layout_set_names_full (EekXkbLayout         *layout,
 | 
			
		||||
                                            ...);
 | 
			
		||||
gboolean     eek_xkb_layout_set_names_full_valist
 | 
			
		||||
                                           (EekXkbLayout         *layout,
 | 
			
		||||
                                            va_list               var_args);
 | 
			
		||||
                                        
 | 
			
		||||
gboolean     eek_xkb_layout_set_keycodes   (EekXkbLayout         *layout,
 | 
			
		||||
                                            const gchar          *keycodes);
 | 
			
		||||
gboolean     eek_xkb_layout_set_geometry   (EekXkbLayout         *layout,
 | 
			
		||||
                                            const gchar          *geometry);
 | 
			
		||||
gboolean     eek_xkb_layout_set_symbols    (EekXkbLayout         *layout,
 | 
			
		||||
                                            const gchar          *symbols);
 | 
			
		||||
 | 
			
		||||
const gchar *eek_xkb_layout_get_keycodes   (EekXkbLayout         *layout);
 | 
			
		||||
const gchar *eek_xkb_layout_get_geometry   (EekXkbLayout         *layout);
 | 
			
		||||
const gchar *eek_xkb_layout_get_symbols    (EekXkbLayout         *layout);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
#endif				/* #ifndef EEK_XKB_LAYOUT_H */
 | 
			
		||||
@ -1,658 +0,0 @@
 | 
			
		||||
/* 
 | 
			
		||||
 * Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
 | 
			
		||||
 * Copyright (C) 2010-2011 Red Hat, Inc.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public License
 | 
			
		||||
 * as published by the Free Software Foundation; either version 2 of
 | 
			
		||||
 * the License, or (at your option) any later version.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is distributed in the hope that it will be useful, but
 | 
			
		||||
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 * 
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
			
		||||
 * 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SECTION:eek-xkl-layout
 | 
			
		||||
 * @short_description: Layout engine using Libxklavier configuration
 | 
			
		||||
 *
 | 
			
		||||
 * The #EekXklLayout is a simple wrapper around #EekXkbLayout class
 | 
			
		||||
 * to use Libxklavier configuration.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_CONFIG_H
 | 
			
		||||
#include "config.h"
 | 
			
		||||
#endif  /* HAVE_CONFIG_H */
 | 
			
		||||
 | 
			
		||||
#include <libxklavier/xklavier.h>
 | 
			
		||||
#include <gio/gio.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include "eek-xkl-layout.h"
 | 
			
		||||
 | 
			
		||||
#define noKBDRAW_DEBUG
 | 
			
		||||
 | 
			
		||||
static GInitableIface *parent_initable_iface;
 | 
			
		||||
 | 
			
		||||
static void initable_iface_init (GInitableIface *initable_iface);
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE_WITH_CODE (EekXklLayout, eek_xkl_layout, EEK_TYPE_XKB_LAYOUT,
 | 
			
		||||
                         G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
 | 
			
		||||
                                                initable_iface_init));
 | 
			
		||||
 | 
			
		||||
#define EEK_XKL_LAYOUT_GET_PRIVATE(obj)                                  \
 | 
			
		||||
    (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayoutPrivate))
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
    PROP_0,
 | 
			
		||||
    PROP_MODEL,
 | 
			
		||||
    PROP_LAYOUTS,
 | 
			
		||||
    PROP_VARIANTS,
 | 
			
		||||
    PROP_OPTIONS,
 | 
			
		||||
    PROP_LAST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct _EekXklLayoutPrivate
 | 
			
		||||
{
 | 
			
		||||
    XklEngine *engine;
 | 
			
		||||
    XklConfigRec *config;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* from gnome-keyboard-properties-xkbpv.c:
 | 
			
		||||
 *  BAD STYLE: Taken from xklavier_private_xkb.h
 | 
			
		||||
 *  Any ideas on architectural improvements are WELCOME
 | 
			
		||||
 */
 | 
			
		||||
extern gboolean xkl_xkb_config_native_prepare (XklEngine * engine,
 | 
			
		||||
					       const XklConfigRec * data,
 | 
			
		||||
					       XkbComponentNamesPtr
 | 
			
		||||
					       component_names);
 | 
			
		||||
 | 
			
		||||
extern void xkl_xkb_config_native_cleanup (XklEngine * engine,
 | 
			
		||||
					   XkbComponentNamesPtr
 | 
			
		||||
					   component_names);
 | 
			
		||||
 | 
			
		||||
static gboolean set_xkb_component_names (EekXklLayout *layout,
 | 
			
		||||
                                         XklConfigRec *config);
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eek_xkl_layout_dispose (GObject *object)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (object);
 | 
			
		||||
 | 
			
		||||
    if (priv->config) {
 | 
			
		||||
        g_object_unref (priv->config);
 | 
			
		||||
        priv->config = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    G_OBJECT_CLASS (eek_xkl_layout_parent_class)->dispose (object);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void 
 | 
			
		||||
eek_xkl_layout_set_property (GObject      *object,
 | 
			
		||||
                             guint         prop_id,
 | 
			
		||||
                             const GValue *value,
 | 
			
		||||
                             GParamSpec   *pspec)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayout *layout = EEK_XKL_LAYOUT(object);
 | 
			
		||||
 | 
			
		||||
    switch (prop_id) {
 | 
			
		||||
    case PROP_MODEL:
 | 
			
		||||
        eek_xkl_layout_set_model (layout, g_value_get_string (value));
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_LAYOUTS:
 | 
			
		||||
        eek_xkl_layout_set_layouts (layout, g_value_get_boxed (value));
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_VARIANTS:
 | 
			
		||||
        eek_xkl_layout_set_variants (layout, g_value_get_boxed (value));
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_OPTIONS:
 | 
			
		||||
        eek_xkl_layout_set_options (layout, g_value_get_boxed (value));
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void 
 | 
			
		||||
eek_xkl_layout_get_property (GObject    *object,
 | 
			
		||||
                             guint       prop_id,
 | 
			
		||||
                             GValue     *value,
 | 
			
		||||
                             GParamSpec *pspec)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayout *layout = EEK_XKL_LAYOUT(object);
 | 
			
		||||
 | 
			
		||||
    switch (prop_id) {
 | 
			
		||||
    case PROP_MODEL:
 | 
			
		||||
        g_value_set_string (value,
 | 
			
		||||
                            eek_xkl_layout_get_model (layout));
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_LAYOUTS:
 | 
			
		||||
        g_value_set_boxed (value,
 | 
			
		||||
                           eek_xkl_layout_get_layouts (layout));
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_VARIANTS:
 | 
			
		||||
        g_value_set_boxed (value,
 | 
			
		||||
                           eek_xkl_layout_get_variants (layout));
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_OPTIONS:
 | 
			
		||||
        g_value_set_boxed (value,
 | 
			
		||||
                           eek_xkl_layout_get_options (layout));
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eek_xkl_layout_class_init (EekXklLayoutClass *klass)
 | 
			
		||||
{
 | 
			
		||||
    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 | 
			
		||||
    GParamSpec *pspec;
 | 
			
		||||
 | 
			
		||||
    g_type_class_add_private (gobject_class, sizeof (EekXklLayoutPrivate));
 | 
			
		||||
 | 
			
		||||
    gobject_class->dispose = eek_xkl_layout_dispose;
 | 
			
		||||
    gobject_class->set_property = eek_xkl_layout_set_property;
 | 
			
		||||
    gobject_class->get_property = eek_xkl_layout_get_property;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * EekXklLayout:model:
 | 
			
		||||
     *
 | 
			
		||||
     * The libxklavier model name of #EekXklLayout.
 | 
			
		||||
     */
 | 
			
		||||
    pspec = g_param_spec_string ("model",
 | 
			
		||||
                                 "Model",
 | 
			
		||||
                                 "Libxklavier model",
 | 
			
		||||
                                 NULL,
 | 
			
		||||
                                 G_PARAM_READWRITE);
 | 
			
		||||
    g_object_class_install_property (gobject_class, PROP_MODEL, pspec);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * EekXklLayout:layouts:
 | 
			
		||||
     *
 | 
			
		||||
     * The libxklavier layout names of #EekXklLayout.
 | 
			
		||||
     */
 | 
			
		||||
    pspec = g_param_spec_boxed ("layouts",
 | 
			
		||||
                                "Layouts",
 | 
			
		||||
                                "Libxklavier layouts",
 | 
			
		||||
                                G_TYPE_STRV,
 | 
			
		||||
                                G_PARAM_READWRITE);
 | 
			
		||||
    g_object_class_install_property (gobject_class, PROP_LAYOUTS, pspec);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * EekXklLayout:variants:
 | 
			
		||||
     *
 | 
			
		||||
     * The libxklavier variant names of #EekXklLayout.
 | 
			
		||||
     */
 | 
			
		||||
    pspec = g_param_spec_boxed ("variants",
 | 
			
		||||
                                "Variants",
 | 
			
		||||
                                "Libxklavier variants",
 | 
			
		||||
                                G_TYPE_STRV,
 | 
			
		||||
                                G_PARAM_READWRITE);
 | 
			
		||||
    g_object_class_install_property (gobject_class, PROP_VARIANTS, pspec);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * EekXklLayout:options:
 | 
			
		||||
     *
 | 
			
		||||
     * The libxklavier option names of #EekXklLayout.
 | 
			
		||||
     */
 | 
			
		||||
    pspec = g_param_spec_boxed ("options",
 | 
			
		||||
                                "Options",
 | 
			
		||||
                                "Libxklavier options",
 | 
			
		||||
                                G_TYPE_STRV,
 | 
			
		||||
                                G_PARAM_READWRITE);
 | 
			
		||||
    g_object_class_install_property (gobject_class, PROP_OPTIONS, pspec);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eek_xkl_layout_init (EekXklLayout *self)
 | 
			
		||||
{
 | 
			
		||||
    self->priv = EEK_XKL_LAYOUT_GET_PRIVATE (self);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_new:
 | 
			
		||||
 *
 | 
			
		||||
 * Create a new #EekXklLayout.
 | 
			
		||||
 */
 | 
			
		||||
EekLayout *
 | 
			
		||||
eek_xkl_layout_new (Display *display, GError **error)
 | 
			
		||||
{
 | 
			
		||||
    return (EekLayout *) g_initable_new (EEK_TYPE_XKL_LAYOUT,
 | 
			
		||||
                                         NULL,
 | 
			
		||||
                                         error,
 | 
			
		||||
                                         "display", display,
 | 
			
		||||
                                         NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
G_INLINE_FUNC void
 | 
			
		||||
merge_xkl_config_rec (XklConfigRec *dst, XklConfigRec *src)
 | 
			
		||||
{
 | 
			
		||||
    if (src->model) {
 | 
			
		||||
        g_free (dst->model);
 | 
			
		||||
        dst->model = g_strdup (src->model);
 | 
			
		||||
    }
 | 
			
		||||
    if (src->layouts) {
 | 
			
		||||
        g_strfreev (dst->layouts);
 | 
			
		||||
        dst->layouts = g_strdupv (src->layouts);
 | 
			
		||||
    }
 | 
			
		||||
    if (src->variants) {
 | 
			
		||||
        g_strfreev (dst->variants);
 | 
			
		||||
        dst->variants = g_strdupv (src->variants);
 | 
			
		||||
    }
 | 
			
		||||
    if (src->options) {
 | 
			
		||||
        g_strfreev (dst->options);
 | 
			
		||||
        dst->options = g_strdupv (src->options);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_set_config: (skip)
 | 
			
		||||
 * @layout: an #EekXklLayout
 | 
			
		||||
 * @config: Libxklavier configuration
 | 
			
		||||
 *
 | 
			
		||||
 * Reconfigure @layout with @config.
 | 
			
		||||
 * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkl_layout_set_config (EekXklLayout *layout,
 | 
			
		||||
                           XklConfigRec *config)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
    XklConfigRec *c;
 | 
			
		||||
    gboolean retval;
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
    c = xkl_config_rec_new ();
 | 
			
		||||
    merge_xkl_config_rec (c, priv->config);
 | 
			
		||||
    merge_xkl_config_rec (c, config);
 | 
			
		||||
    retval = set_xkb_component_names (layout, c);
 | 
			
		||||
    g_object_unref (c);
 | 
			
		||||
    merge_xkl_config_rec (priv->config, config);
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_set_config_full:
 | 
			
		||||
 * @layout: an #EekXklLayout
 | 
			
		||||
 * @model: Libxklavier model name
 | 
			
		||||
 * @layouts: Libxklavier layouts
 | 
			
		||||
 * @variants: Libxklavier variants
 | 
			
		||||
 * @options: Libxklavier options
 | 
			
		||||
 *
 | 
			
		||||
 * Reconfigure @layout with @model, @layouts, @variants, and @options.
 | 
			
		||||
 * This function is merely a wrapper around
 | 
			
		||||
 * eek_xkl_layout_set_config() to avoid passing a pointer of
 | 
			
		||||
 * XklConfigRec, which is not currently available in the
 | 
			
		||||
 * gobject-introspection repository.
 | 
			
		||||
 *
 | 
			
		||||
 * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
 * Since: 0.0.2
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkl_layout_set_config_full (EekXklLayout *layout,
 | 
			
		||||
                                gchar *model,
 | 
			
		||||
                                gchar **layouts,
 | 
			
		||||
                                gchar **variants,
 | 
			
		||||
                                gchar **options)
 | 
			
		||||
{
 | 
			
		||||
    XklConfigRec *config;
 | 
			
		||||
    gboolean retval;
 | 
			
		||||
 | 
			
		||||
    config = xkl_config_rec_new ();
 | 
			
		||||
    config->model = g_strdup (model);
 | 
			
		||||
    config->layouts = g_strdupv (layouts);
 | 
			
		||||
    config->variants = g_strdupv (variants);
 | 
			
		||||
    config->options = g_strdupv (options);
 | 
			
		||||
    retval = eek_xkl_layout_set_config (layout, config);
 | 
			
		||||
    g_object_unref (config);
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_set_model:
 | 
			
		||||
 * @layout: an #EekXklLayout
 | 
			
		||||
 * @model: model name
 | 
			
		||||
 *
 | 
			
		||||
 * Set the model name of @layout configuration (in the Libxklavier terminology).
 | 
			
		||||
 * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkl_layout_set_model (EekXklLayout *layout,
 | 
			
		||||
                          const gchar  *model)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
    XklConfigRec *config;
 | 
			
		||||
    gboolean retval;
 | 
			
		||||
    
 | 
			
		||||
    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
    config = xkl_config_rec_new ();
 | 
			
		||||
    /* config->model will be freed on g_object_unref (config) */
 | 
			
		||||
    if (model)
 | 
			
		||||
        config->model = g_strdup (model);
 | 
			
		||||
    else
 | 
			
		||||
        config->model = NULL;
 | 
			
		||||
    retval = eek_xkl_layout_set_config (layout, config);
 | 
			
		||||
    g_object_unref (config);
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_set_layouts:
 | 
			
		||||
 * @layout: an #EekXklLayout
 | 
			
		||||
 * @layouts: layout names
 | 
			
		||||
 *
 | 
			
		||||
 * Set the layout names of @layout (in the Libxklavier terminology).
 | 
			
		||||
 * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkl_layout_set_layouts (EekXklLayout *layout,
 | 
			
		||||
                            gchar       **layouts)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
    XklConfigRec *config;
 | 
			
		||||
    gboolean retval;
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
    config = xkl_config_rec_new ();
 | 
			
		||||
    /* config->layouts will be freed on g_object_unref (config) */
 | 
			
		||||
    if (layouts)
 | 
			
		||||
        config->layouts = g_strdupv (layouts);
 | 
			
		||||
    else
 | 
			
		||||
        config->layouts = layouts;
 | 
			
		||||
    retval = eek_xkl_layout_set_config (layout, config);
 | 
			
		||||
    g_object_unref (config);
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_set_variants:
 | 
			
		||||
 * @layout: an #EekXklLayout
 | 
			
		||||
 * @variants: variant names
 | 
			
		||||
 *
 | 
			
		||||
 * Set the variant names of @layout (in the Libxklavier terminology).
 | 
			
		||||
 * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkl_layout_set_variants (EekXklLayout *layout,
 | 
			
		||||
                             gchar       **variants)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
    XklConfigRec *config;
 | 
			
		||||
    gboolean retval;
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
    config = xkl_config_rec_new ();
 | 
			
		||||
    /* config->variants will be freed on g_object_unref (config) */
 | 
			
		||||
    if (variants)
 | 
			
		||||
        config->variants = g_strdupv (variants);
 | 
			
		||||
    else
 | 
			
		||||
        config->variants = NULL;
 | 
			
		||||
    retval = eek_xkl_layout_set_config (layout, config);
 | 
			
		||||
    g_object_unref (config);
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_set_options:
 | 
			
		||||
 * @layout: an #EekXklLayout
 | 
			
		||||
 * @options: option names
 | 
			
		||||
 *
 | 
			
		||||
 * Set the option names of @layout (in the Libxklavier terminology).
 | 
			
		||||
 * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkl_layout_set_options (EekXklLayout *layout,
 | 
			
		||||
                            gchar       **options)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
    XklConfigRec *config;
 | 
			
		||||
    gboolean retval;
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, FALSE);
 | 
			
		||||
    config = xkl_config_rec_new ();
 | 
			
		||||
    /* config->options will be freed on g_object_unref (config) */
 | 
			
		||||
    if (options)
 | 
			
		||||
        config->options = options;
 | 
			
		||||
    else
 | 
			
		||||
        config->options = NULL;
 | 
			
		||||
    retval = eek_xkl_layout_set_config (layout, config);
 | 
			
		||||
    g_object_unref (config);
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_enable_option:
 | 
			
		||||
 * @layout: an #EekXklLayout
 | 
			
		||||
 * @option: option name
 | 
			
		||||
 *
 | 
			
		||||
 * Set the option of @layout (in the Libxklavier terminology).
 | 
			
		||||
 * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkl_layout_enable_option  (EekXklLayout *layout,
 | 
			
		||||
                               const gchar  *option)
 | 
			
		||||
{
 | 
			
		||||
    gchar **options, **_options;
 | 
			
		||||
    gint i, j;
 | 
			
		||||
 | 
			
		||||
    options = eek_xkl_layout_get_options (layout);
 | 
			
		||||
    for (i = 0; options && options[i]; i++)
 | 
			
		||||
        if (g_strcmp0 (options[i], option) == 0)
 | 
			
		||||
            return TRUE;
 | 
			
		||||
    _options = g_new0 (gchar *, (i + 2));
 | 
			
		||||
    for (j = 0; j < i; j++)
 | 
			
		||||
        _options[j] = g_strdup (options[j]);
 | 
			
		||||
    _options[i] = g_strdup (option);
 | 
			
		||||
    /* eek_xkl_layout_set_options() will free _options and its elements. */
 | 
			
		||||
    return eek_xkl_layout_set_options (layout, _options);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_disable_option:
 | 
			
		||||
 * @layout: an #EekXklLayout
 | 
			
		||||
 * @option: option name
 | 
			
		||||
 *
 | 
			
		||||
 * Unset the option of @layout (in the Libxklavier terminology).
 | 
			
		||||
 * Returns: %TRUE if the current layout changed, %FALSE otherwise
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkl_layout_disable_option (EekXklLayout *layout,
 | 
			
		||||
                               const gchar  *option)
 | 
			
		||||
{
 | 
			
		||||
    gchar **options, **_options;
 | 
			
		||||
    gint i, j, k;
 | 
			
		||||
 | 
			
		||||
    options = eek_xkl_layout_get_options (layout);
 | 
			
		||||
    if (!options)
 | 
			
		||||
        return TRUE;
 | 
			
		||||
    for (i = 0, k = 0; options[i]; i++)
 | 
			
		||||
        if (g_strcmp0 (options[i], option) == 0)
 | 
			
		||||
            k = i;
 | 
			
		||||
    if (options[k] == NULL)
 | 
			
		||||
        return TRUE;
 | 
			
		||||
    _options = g_new0 (gchar *, i);
 | 
			
		||||
    for (j = 0; j < k; j++)
 | 
			
		||||
        _options[j] = g_strdup (options[j]);
 | 
			
		||||
    for (j = k + 1; j < i; j++)
 | 
			
		||||
        _options[j] = g_strdup (options[j]);
 | 
			
		||||
    /* eek_xkl_layout_set_options() will free _options and its elements. */
 | 
			
		||||
    return eek_xkl_layout_set_options (layout, _options);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_get_model:
 | 
			
		||||
 * @layout: an #EekXklLayout
 | 
			
		||||
 *
 | 
			
		||||
 * Get the model name of @layout configuration (in the Libxklavier terminology).
 | 
			
		||||
 */
 | 
			
		||||
gchar *
 | 
			
		||||
eek_xkl_layout_get_model (EekXklLayout *layout)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, NULL);
 | 
			
		||||
    return g_strdup (priv->config->model);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_get_layouts:
 | 
			
		||||
 * @layout: an #EekXklLayout
 | 
			
		||||
 *
 | 
			
		||||
 * Get the layout names of @layout configuration (in the Libxklavier
 | 
			
		||||
 * terminology).
 | 
			
		||||
 */
 | 
			
		||||
gchar **
 | 
			
		||||
eek_xkl_layout_get_layouts (EekXklLayout *layout)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, NULL);
 | 
			
		||||
    return g_strdupv (priv->config->layouts);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_get_variants:
 | 
			
		||||
 * @layout: an #EekXklLayout
 | 
			
		||||
 *
 | 
			
		||||
 * Get the variant names of @layout configuration (in the Libxklavier
 | 
			
		||||
 * terminology).
 | 
			
		||||
 */
 | 
			
		||||
gchar **
 | 
			
		||||
eek_xkl_layout_get_variants (EekXklLayout *layout)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, NULL);
 | 
			
		||||
    return g_strdupv (priv->config->variants);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_get_options:
 | 
			
		||||
 * @layout: an #EekXklLayout
 | 
			
		||||
 *
 | 
			
		||||
 * Get the option names of @layout configuration (in the Libxklavier
 | 
			
		||||
 * terminology).
 | 
			
		||||
 */
 | 
			
		||||
gchar **
 | 
			
		||||
eek_xkl_layout_get_options (EekXklLayout *layout)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
 | 
			
		||||
 | 
			
		||||
    g_return_val_if_fail (priv, NULL);
 | 
			
		||||
    return g_strdupv (priv->config->options);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
set_xkb_component_names (EekXklLayout *layout, XklConfigRec *config)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayoutPrivate *priv = layout->priv;
 | 
			
		||||
    XkbComponentNamesRec names;
 | 
			
		||||
    gboolean retval = FALSE;
 | 
			
		||||
 | 
			
		||||
#if DEBUG
 | 
			
		||||
    if (config->layouts) {
 | 
			
		||||
        gint i;
 | 
			
		||||
 | 
			
		||||
        fprintf (stderr, "layout = ");
 | 
			
		||||
        for (i = 0; config->layouts[i] != NULL; i++)
 | 
			
		||||
            fprintf (stderr, "\"%s\" ", config->layouts[i]);
 | 
			
		||||
        fputc ('\n', stderr);
 | 
			
		||||
    } else
 | 
			
		||||
        fprintf (stderr, "layouts = NULL\n");
 | 
			
		||||
    if (config->variants) {
 | 
			
		||||
        gint i;
 | 
			
		||||
 | 
			
		||||
        fprintf (stderr, "variant = ");
 | 
			
		||||
        for (i = 0; config->variants[i]; i++)
 | 
			
		||||
            fprintf (stderr, "\"%s\" ", config->variants[i]);
 | 
			
		||||
        fputc ('\n', stderr);
 | 
			
		||||
    } else
 | 
			
		||||
        fprintf (stderr, "variants = NULL\n");
 | 
			
		||||
    if (config->options) {
 | 
			
		||||
        gint i;
 | 
			
		||||
 | 
			
		||||
        fprintf (stderr, "option = ");
 | 
			
		||||
        for (i = 0; config->options[i]; i++)
 | 
			
		||||
            fprintf (stderr, "\"%s\" ", config->options[i]);
 | 
			
		||||
        fputc ('\n', stderr);
 | 
			
		||||
    } else
 | 
			
		||||
        fprintf (stderr, "options = NULL\n");
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    if (xkl_xkb_config_native_prepare (priv->engine, config, &names)) {
 | 
			
		||||
        retval = eek_xkb_layout_set_names (EEK_XKB_LAYOUT(layout), &names);
 | 
			
		||||
        xkl_xkb_config_native_cleanup (priv->engine, &names);
 | 
			
		||||
    }
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eek_xkl_layout_get_option:
 | 
			
		||||
 * @layout: an #EekXklLayout
 | 
			
		||||
 * @option: option name
 | 
			
		||||
 *
 | 
			
		||||
 * Tell if the option of @layout (in the Libxklavier terminology) is set.
 | 
			
		||||
 * Returns: %TRUE if the option is set, %FALSE otherwise
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
eek_xkl_layout_get_option (EekXklLayout *layout,
 | 
			
		||||
                           const gchar  *option)
 | 
			
		||||
{
 | 
			
		||||
    gchar **options;
 | 
			
		||||
    gint i;
 | 
			
		||||
 | 
			
		||||
    options = eek_xkl_layout_get_options (layout);
 | 
			
		||||
    for (i = 0; options && options[i]; i++)
 | 
			
		||||
        if (g_strcmp0 (options[i], option) == 0)
 | 
			
		||||
            return TRUE;
 | 
			
		||||
    return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
initable_init (GInitable    *initable,
 | 
			
		||||
               GCancellable *cancellable,
 | 
			
		||||
               GError      **error)
 | 
			
		||||
{
 | 
			
		||||
    EekXklLayout *layout = EEK_XKL_LAYOUT (initable);
 | 
			
		||||
    Display *display;
 | 
			
		||||
 | 
			
		||||
    if (!parent_initable_iface->init (initable, cancellable, error))
 | 
			
		||||
        return FALSE;
 | 
			
		||||
 | 
			
		||||
    layout->priv->config = xkl_config_rec_new ();
 | 
			
		||||
 | 
			
		||||
    g_object_get (G_OBJECT (initable),
 | 
			
		||||
                  "display", &display,
 | 
			
		||||
                  NULL);
 | 
			
		||||
 | 
			
		||||
    layout->priv->engine = xkl_engine_get_instance (display);
 | 
			
		||||
 | 
			
		||||
    if (!xkl_config_rec_get_from_server (layout->priv->config,
 | 
			
		||||
                                         layout->priv->engine)) {
 | 
			
		||||
        g_set_error (error,
 | 
			
		||||
                     EEK_ERROR,
 | 
			
		||||
                     EEK_ERROR_LAYOUT_ERROR,
 | 
			
		||||
                     "can't load libxklavier configuration");
 | 
			
		||||
        return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    set_xkb_component_names (layout, layout->priv->config);
 | 
			
		||||
    return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
initable_iface_init (GInitableIface *initable_iface)
 | 
			
		||||
{
 | 
			
		||||
    parent_initable_iface = g_type_interface_peek_parent (initable_iface);
 | 
			
		||||
    initable_iface->init = initable_init;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,97 +0,0 @@
 | 
			
		||||
/* 
 | 
			
		||||
 * Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
 | 
			
		||||
 * Copyright (C) 2010-2011 Red Hat, Inc.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is free software; you can redistribute it and/or
 | 
			
		||||
 * modify it under the terms of the GNU Lesser General Public License
 | 
			
		||||
 * as published by the Free Software Foundation; either version 2 of
 | 
			
		||||
 * the License, or (at your option) any later version.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is distributed in the hope that it will be useful, but
 | 
			
		||||
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
 * Lesser General Public License for more details.
 | 
			
		||||
 * 
 | 
			
		||||
 * You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
 * License along with this library; if not, write to the Free Software
 | 
			
		||||
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
			
		||||
 * 02110-1301 USA
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
 | 
			
		||||
#error "Only <eek/eek-xkl.h> can be included directly."
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef EEK_XKL_LAYOUT_H
 | 
			
		||||
#define EEK_XKL_LAYOUT_H 1
 | 
			
		||||
 | 
			
		||||
#include <libxklavier/xklavier.h>
 | 
			
		||||
#include "eek-xkb-layout.h"
 | 
			
		||||
 | 
			
		||||
G_BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
#define EEK_TYPE_XKL_LAYOUT (eek_xkl_layout_get_type())
 | 
			
		||||
#define EEK_XKL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayout))
 | 
			
		||||
#define EEK_XKL_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XKL_LAYOUT, EekXklLayoutClass))
 | 
			
		||||
#define EEK_IS_XKL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XKL_LAYOUT))
 | 
			
		||||
#define EEK_IS_XKL_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XKL_LAYOUT))
 | 
			
		||||
#define EEK_XKL_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayoutClass))
 | 
			
		||||
 | 
			
		||||
typedef struct _EekXklLayout        EekXklLayout;
 | 
			
		||||
typedef struct _EekXklLayoutClass   EekXklLayoutClass;
 | 
			
		||||
typedef struct _EekXklLayoutPrivate EekXklLayoutPrivate;
 | 
			
		||||
 | 
			
		||||
struct _EekXklLayout
 | 
			
		||||
{
 | 
			
		||||
    /*< private >*/
 | 
			
		||||
    EekXkbLayout parent;
 | 
			
		||||
 | 
			
		||||
    EekXklLayoutPrivate *priv;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct _EekXklLayoutClass
 | 
			
		||||
{
 | 
			
		||||
    /*< private >*/
 | 
			
		||||
    EekXkbLayoutClass parent_class;
 | 
			
		||||
 | 
			
		||||
    /*< private >*/
 | 
			
		||||
    /* padding */
 | 
			
		||||
    gpointer pdummy[24];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
GType      eek_xkl_layout_get_type        (void) G_GNUC_CONST;
 | 
			
		||||
 | 
			
		||||
EekLayout *eek_xkl_layout_new             (Display      *display,
 | 
			
		||||
                                           GError      **error);
 | 
			
		||||
 | 
			
		||||
gboolean   eek_xkl_layout_set_config      (EekXklLayout *layout,
 | 
			
		||||
                                           XklConfigRec *config);
 | 
			
		||||
 | 
			
		||||
gboolean   eek_xkl_layout_set_config_full (EekXklLayout *layout,
 | 
			
		||||
                                           gchar        *model,
 | 
			
		||||
                                           gchar       **layouts,
 | 
			
		||||
                                           gchar       **variants,
 | 
			
		||||
                                           gchar       **options);
 | 
			
		||||
 | 
			
		||||
gboolean   eek_xkl_layout_set_model       (EekXklLayout *layout,
 | 
			
		||||
                                           const gchar  *model);
 | 
			
		||||
gboolean   eek_xkl_layout_set_layouts     (EekXklLayout *layout,
 | 
			
		||||
                                           gchar       **layouts);
 | 
			
		||||
gboolean   eek_xkl_layout_set_variants    (EekXklLayout *layout,
 | 
			
		||||
                                           gchar       **variants);
 | 
			
		||||
gboolean   eek_xkl_layout_set_options     (EekXklLayout *layout,
 | 
			
		||||
                                           gchar       **options);
 | 
			
		||||
gboolean   eek_xkl_layout_enable_option   (EekXklLayout *layout,
 | 
			
		||||
                                           const gchar  *option);
 | 
			
		||||
gboolean   eek_xkl_layout_disable_option  (EekXklLayout *layout,
 | 
			
		||||
                                           const gchar  *option);
 | 
			
		||||
 | 
			
		||||
gchar     *eek_xkl_layout_get_model       (EekXklLayout *layout);
 | 
			
		||||
gchar    **eek_xkl_layout_get_layouts     (EekXklLayout *layout);
 | 
			
		||||
gchar    **eek_xkl_layout_get_variants    (EekXklLayout *layout);
 | 
			
		||||
gchar    **eek_xkl_layout_get_options     (EekXklLayout *layout);
 | 
			
		||||
gboolean   eek_xkl_layout_get_option      (EekXklLayout *layout,
 | 
			
		||||
                                           const gchar  *option);
 | 
			
		||||
 | 
			
		||||
G_END_DECLS
 | 
			
		||||
#endif				/* #ifndef EEK_XKL_LAYOUT_H */
 | 
			
		||||
@ -59,7 +59,7 @@ struct _EekXmlLayoutPrivate
 | 
			
		||||
 | 
			
		||||
G_DEFINE_BOXED_TYPE(EekXmlKeyboardDesc, eek_xml_keyboard_desc, eek_xml_keyboard_desc_copy, eek_xml_keyboard_desc_free);
 | 
			
		||||
 | 
			
		||||
#define BUFSIZE	8192
 | 
			
		||||
#define BUFSIZE    8192
 | 
			
		||||
 | 
			
		||||
static GList        *parse_keyboards (const gchar         *path,
 | 
			
		||||
                                      GError             **error);
 | 
			
		||||
@ -571,6 +571,7 @@ struct _SymbolsParseData {
 | 
			
		||||
    GSList *symbols;
 | 
			
		||||
    gchar *label;
 | 
			
		||||
    gchar *icon;
 | 
			
		||||
    gchar *tooltip;
 | 
			
		||||
    EekSymbolCategory category;
 | 
			
		||||
    guint keyval;
 | 
			
		||||
    gint groups;
 | 
			
		||||
@ -683,6 +684,11 @@ symbols_start_element_callback (GMarkupParseContext *pcontext,
 | 
			
		||||
        if (attribute != NULL)
 | 
			
		||||
            data->icon = g_strdup (attribute);
 | 
			
		||||
 | 
			
		||||
        attribute = get_attribute (attribute_names, attribute_values,
 | 
			
		||||
                                   "tooltip");
 | 
			
		||||
        if (attribute != NULL)
 | 
			
		||||
            data->tooltip = g_strdup (attribute);
 | 
			
		||||
 | 
			
		||||
        attribute = get_attribute (attribute_names, attribute_values,
 | 
			
		||||
                                   "category");
 | 
			
		||||
        if (attribute != NULL)
 | 
			
		||||
@ -766,6 +772,11 @@ symbols_end_element_callback (GMarkupParseContext *pcontext,
 | 
			
		||||
            g_free (data->icon);
 | 
			
		||||
            data->icon = NULL;
 | 
			
		||||
        }
 | 
			
		||||
        if (data->tooltip) {
 | 
			
		||||
            eek_symbol_set_tooltip (symbol, data->tooltip);
 | 
			
		||||
            g_free (data->tooltip);
 | 
			
		||||
            data->tooltip = NULL;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        data->symbols = g_slist_prepend (data->symbols, symbol);
 | 
			
		||||
        goto out;
 | 
			
		||||
@ -1010,10 +1021,10 @@ eek_xml_layout_class_init (EekXmlLayoutClass *klass)
 | 
			
		||||
    gobject_class->finalize = eek_xml_layout_finalize;
 | 
			
		||||
 | 
			
		||||
    pspec = g_param_spec_string ("id",
 | 
			
		||||
				 "ID",
 | 
			
		||||
				 "ID",
 | 
			
		||||
				 NULL,
 | 
			
		||||
				 G_PARAM_CONSTRUCT_ONLY |
 | 
			
		||||
                 "ID",
 | 
			
		||||
                 "ID",
 | 
			
		||||
                 NULL,
 | 
			
		||||
                 G_PARAM_CONSTRUCT_ONLY |
 | 
			
		||||
                                 G_PARAM_READWRITE);
 | 
			
		||||
    g_object_class_install_property (gobject_class, PROP_ID, pspec);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -16,55 +16,68 @@
 | 
			
		||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 | 
			
		||||
# 02110-1301 USA
 | 
			
		||||
 | 
			
		||||
NULL =
 | 
			
		||||
 | 
			
		||||
lib_LTLIBRARIES = libeekboard.la
 | 
			
		||||
 | 
			
		||||
libeekboard_headers =				\
 | 
			
		||||
	eekboard-service.h			\
 | 
			
		||||
	eekboard-context-service.h		\
 | 
			
		||||
	eekboard-client.h			\
 | 
			
		||||
	eekboard-context.h			\
 | 
			
		||||
	eekboard-xklutil.h
 | 
			
		||||
	$(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 =			\
 | 
			
		||||
	eekboard-marshalers.h
 | 
			
		||||
	$(builddir)/eekboard-marshalers.h	\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
libeekboard_sources =				\
 | 
			
		||||
	eekboard-service.c			\
 | 
			
		||||
	eekboard-context-service.c		\
 | 
			
		||||
	eekboard-client.c			\
 | 
			
		||||
	eekboard-context.c			\
 | 
			
		||||
	eekboard-xklutil.c
 | 
			
		||||
	$(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 =		\
 | 
			
		||||
	eekboard-marshalers.c			\
 | 
			
		||||
	eekboard-marshalers.h
 | 
			
		||||
	$(builddir)/eekboard-marshalers.c	\
 | 
			
		||||
	$(builddir)/eekboard-marshalers.h	\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
BUILT_SOURCES =					\
 | 
			
		||||
	$(libeekboard_marshalers_sources)
 | 
			
		||||
	$(libeekboard_marshalers_sources)	\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
libeekboard_la_SOURCES =			\
 | 
			
		||||
	$(libeekboard_sources)			\
 | 
			
		||||
	eekboard-marshalers.c
 | 
			
		||||
	$(builddir)/eekboard-marshalers.c	\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
libeekboard_la_CFLAGS =					\
 | 
			
		||||
	-DEEKBOARD_COMPILATION=1			\
 | 
			
		||||
	-DKEYBOARDDIR=\"$(pkgdatadir)/keyboards\"	\
 | 
			
		||||
	-I$(top_srcdir)					\
 | 
			
		||||
	$(GIO2_CFLAGS)					\
 | 
			
		||||
	$(LIBXKLAVIER_CFLAGS)
 | 
			
		||||
	$(LIBXKLAVIER_CFLAGS)				\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
libeekboard_la_LIBADD =				\
 | 
			
		||||
	$(top_builddir)/eek/libeek.la		\
 | 
			
		||||
	$(top_builddir)/eek/libeek-xkl.la	\
 | 
			
		||||
	$(GIO2_LIBS)				\
 | 
			
		||||
	$(LIBXKLAVIER_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
 | 
			
		||||
	eekboard-$(EEK_API_VERSION).pc		\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
DISTCLEANFILES =				\
 | 
			
		||||
	$(BUILT_SOURCES)			\
 | 
			
		||||
	$(pkgconfig_DATA)
 | 
			
		||||
	$(pkgconfig_DATA)			\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
CLEANFILES =
 | 
			
		||||
 | 
			
		||||
@ -72,22 +85,37 @@ 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 && \
 | 
			
		||||
	$(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 && \
 | 
			
		||||
	$(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
 | 
			
		||||
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) --includedir=$(top_srcdir)/eek
 | 
			
		||||
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 = --strip-prefix=Eekboard
 | 
			
		||||
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
 | 
			
		||||
@ -103,3 +131,5 @@ typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
 | 
			
		||||
 | 
			
		||||
CLEANFILES += $(gir_DATA) $(typelib_DATA)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -325,6 +325,38 @@ eekboard_client_pop_context (EekboardClient *client,
 | 
			
		||||
                       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,
 | 
			
		||||
 | 
			
		||||
@ -67,6 +67,10 @@ void             eekboard_client_push_context    (EekboardClient  *eekboard,
 | 
			
		||||
                                                  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);
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,7 @@
 | 
			
		||||
 | 
			
		||||
#include "eekboard/eekboard-context-service.h"
 | 
			
		||||
#include "eekboard/eekboard-xklutil.h"
 | 
			
		||||
#include "eek/eek-xkl.h"
 | 
			
		||||
//#include "eek/eek-xkl.h"  //x11_stub
 | 
			
		||||
 | 
			
		||||
#define CSW 640
 | 
			
		||||
#define CSH 480
 | 
			
		||||
@ -173,6 +173,8 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
 | 
			
		||||
            display = XOpenDisplay (NULL);
 | 
			
		||||
 | 
			
		||||
        error = NULL;
 | 
			
		||||
        /*
 | 
			
		||||
        //x11_stub_start
 | 
			
		||||
        layout = eek_xkl_layout_new (display, &error);
 | 
			
		||||
        if (layout == NULL) {
 | 
			
		||||
            g_warning ("can't create keyboard %s: %s",
 | 
			
		||||
@ -185,6 +187,8 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
 | 
			
		||||
            g_object_unref (layout);
 | 
			
		||||
            return NULL;
 | 
			
		||||
        }
 | 
			
		||||
        //x11_stub_eend
 | 
			
		||||
        */
 | 
			
		||||
    } else {
 | 
			
		||||
        error = NULL;
 | 
			
		||||
        layout = eek_xml_layout_new (keyboard_type, &error);
 | 
			
		||||
@ -201,6 +205,26 @@ eekboard_context_service_real_create_keyboard (EekboardContextService *self,
 | 
			
		||||
    return keyboard;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eekboard_context_service_real_show_keyboard (EekboardContextService *self)
 | 
			
		||||
{
 | 
			
		||||
    gboolean visible = self->priv->visible;
 | 
			
		||||
    self->priv->visible = TRUE;
 | 
			
		||||
    if (visible != self->priv->visible)
 | 
			
		||||
        emit_visibility_changed_signal (self,
 | 
			
		||||
                                        self->priv->visible);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eekboard_context_service_real_hide_keyboard (EekboardContextService *self)
 | 
			
		||||
{
 | 
			
		||||
    gboolean visible = self->priv->visible;
 | 
			
		||||
    self->priv->visible = FALSE;
 | 
			
		||||
    if (visible != self->priv->visible)
 | 
			
		||||
        emit_visibility_changed_signal (self,
 | 
			
		||||
                                        self->priv->visible);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eekboard_context_service_set_property (GObject      *object,
 | 
			
		||||
                                       guint         prop_id,
 | 
			
		||||
@ -209,7 +233,6 @@ eekboard_context_service_set_property (GObject      *object,
 | 
			
		||||
{
 | 
			
		||||
    EekboardContextService *context = EEKBOARD_CONTEXT_SERVICE(object);
 | 
			
		||||
    GDBusConnection *connection;
 | 
			
		||||
    gboolean was_visible;
 | 
			
		||||
 | 
			
		||||
    switch (prop_id) {
 | 
			
		||||
    case PROP_OBJECT_PATH:
 | 
			
		||||
@ -234,11 +257,12 @@ eekboard_context_service_set_property (GObject      *object,
 | 
			
		||||
        context->priv->keyboard = g_value_get_object (value);
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_VISIBLE:
 | 
			
		||||
        was_visible = context->priv->visible;
 | 
			
		||||
        context->priv->visible = g_value_get_boolean (value);
 | 
			
		||||
        if (was_visible != context->priv->visible)
 | 
			
		||||
            emit_visibility_changed_signal (context,
 | 
			
		||||
                                            context->priv->visible);
 | 
			
		||||
        if (context->priv->keyboard) {
 | 
			
		||||
            if (g_value_get_boolean (value))
 | 
			
		||||
                eekboard_context_service_show_keyboard (context);
 | 
			
		||||
            else
 | 
			
		||||
                eekboard_context_service_hide_keyboard (context);
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_FULLSCREEN:
 | 
			
		||||
        context->priv->fullscreen = g_value_get_boolean (value);
 | 
			
		||||
@ -358,8 +382,8 @@ eekboard_context_service_class_init (EekboardContextServiceClass *klass)
 | 
			
		||||
                              sizeof (EekboardContextServicePrivate));
 | 
			
		||||
 | 
			
		||||
    klass->create_keyboard = eekboard_context_service_real_create_keyboard;
 | 
			
		||||
    klass->show_keyboard = NULL;
 | 
			
		||||
    klass->hide_keyboard = NULL;
 | 
			
		||||
    klass->show_keyboard = eekboard_context_service_real_show_keyboard;
 | 
			
		||||
    klass->hide_keyboard = eekboard_context_service_real_hide_keyboard;
 | 
			
		||||
 | 
			
		||||
    gobject_class->constructed = eekboard_context_service_constructed;
 | 
			
		||||
    gobject_class->set_property = eekboard_context_service_set_property;
 | 
			
		||||
@ -730,6 +754,11 @@ handle_method_call (GDBusConnection       *connection,
 | 
			
		||||
    EekboardContextService *context = user_data;
 | 
			
		||||
    EekboardContextServiceClass *klass = EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context);
 | 
			
		||||
    
 | 
			
		||||
    if (context->priv->repeat_timeout_id) {
 | 
			
		||||
        g_source_remove (context->priv->repeat_timeout_id);
 | 
			
		||||
        context->priv->repeat_timeout_id = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (g_strcmp0 (method_name, "AddKeyboard") == 0) {
 | 
			
		||||
        const gchar *keyboard_type;
 | 
			
		||||
        static guint keyboard_id = 0;
 | 
			
		||||
@ -864,15 +893,13 @@ handle_method_call (GDBusConnection       *connection,
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (klass->show_keyboard)
 | 
			
		||||
            klass->show_keyboard (context);
 | 
			
		||||
        eekboard_context_service_show_keyboard (context);
 | 
			
		||||
        g_dbus_method_invocation_return_value (invocation, NULL);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (g_strcmp0 (method_name, "HideKeyboard") == 0) {
 | 
			
		||||
        if (klass->hide_keyboard)
 | 
			
		||||
            klass->hide_keyboard (context);
 | 
			
		||||
        eekboard_context_service_hide_keyboard (context);
 | 
			
		||||
        g_dbus_method_invocation_return_value (invocation, NULL);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
@ -999,6 +1026,24 @@ eekboard_context_service_disable (EekboardContextService *context)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
eekboard_context_service_show_keyboard (EekboardContextService *context)
 | 
			
		||||
{
 | 
			
		||||
    g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE(context));
 | 
			
		||||
    g_return_if_fail (context->priv->connection);
 | 
			
		||||
 | 
			
		||||
    EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context)->show_keyboard (context);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
eekboard_context_service_hide_keyboard (EekboardContextService *context)
 | 
			
		||||
{
 | 
			
		||||
    g_return_if_fail (EEKBOARD_IS_CONTEXT_SERVICE(context));
 | 
			
		||||
    g_return_if_fail (context->priv->connection);
 | 
			
		||||
 | 
			
		||||
    EEKBOARD_CONTEXT_SERVICE_GET_CLASS(context)->hide_keyboard (context);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * eekboard_context_service_destroy:
 | 
			
		||||
 * @context: an #EekboardContextService
 | 
			
		||||
 | 
			
		||||
@ -84,6 +84,10 @@ GType         eekboard_context_service_get_type
 | 
			
		||||
                                              (void) G_GNUC_CONST;
 | 
			
		||||
void          eekboard_context_service_enable (EekboardContextService *context);
 | 
			
		||||
void          eekboard_context_service_disable (EekboardContextService *context);
 | 
			
		||||
void          eekboard_context_service_show_keyboard
 | 
			
		||||
                                              (EekboardContextService *context);
 | 
			
		||||
void          eekboard_context_service_hide_keyboard
 | 
			
		||||
                                              (EekboardContextService *context);
 | 
			
		||||
void          eekboard_context_service_destroy (EekboardContextService *context);
 | 
			
		||||
EekKeyboard  *eekboard_context_service_get_keyboard
 | 
			
		||||
                                              (EekboardContextService *context);
 | 
			
		||||
 | 
			
		||||
@ -151,7 +151,7 @@ eekboard_context_real_destroyed (EekboardContext *self)
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
eekboard_context_real_key_activated (EekboardContext *self,
 | 
			
		||||
                                     const gchar     *keyname,
 | 
			
		||||
                                     guint            keycode,
 | 
			
		||||
                                     EekSymbol       *symbol,
 | 
			
		||||
                                     guint            modifiers)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -55,6 +55,7 @@ struct _EekboardServicePrivate {
 | 
			
		||||
 | 
			
		||||
    GHashTable *context_hash;
 | 
			
		||||
    GSList *context_stack;
 | 
			
		||||
    gboolean visible;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE (EekboardService, eekboard_service, G_TYPE_OBJECT);
 | 
			
		||||
@ -70,6 +71,8 @@ static const gchar introspection_xml[] =
 | 
			
		||||
    "      <arg direction='in' type='s' name='object_path'/>"
 | 
			
		||||
    "    </method>"
 | 
			
		||||
    "    <method name='PopContext'/>"
 | 
			
		||||
    "    <method name='ShowKeyboard'/>"
 | 
			
		||||
    "    <method name='HideKeyboard'/>"
 | 
			
		||||
    "    <method name='Destroy'/>"
 | 
			
		||||
    /* signals */
 | 
			
		||||
    "  </interface>"
 | 
			
		||||
@ -358,6 +361,14 @@ context_destroyed_cb (EekboardContextService *context, EekboardService *service)
 | 
			
		||||
    g_free (object_path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
on_notify_visible (GObject *object, GParamSpec *spec, gpointer user_data)
 | 
			
		||||
{
 | 
			
		||||
    EekboardService *service = user_data;
 | 
			
		||||
 | 
			
		||||
    g_object_get (object, "visible", &service->priv->visible, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
handle_method_call (GDBusConnection       *connection,
 | 
			
		||||
                    const gchar           *sender,
 | 
			
		||||
@ -424,6 +435,10 @@ handle_method_call (GDBusConnection       *connection,
 | 
			
		||||
        service->priv->context_stack = g_slist_prepend (service->priv->context_stack,
 | 
			
		||||
                                               g_object_ref (context));
 | 
			
		||||
        eekboard_context_service_enable (context);
 | 
			
		||||
        g_signal_connect (context, "notify::visible",
 | 
			
		||||
                          G_CALLBACK(on_notify_visible), service);
 | 
			
		||||
        if (service->priv->visible)
 | 
			
		||||
            eekboard_context_service_show_keyboard (context);
 | 
			
		||||
 | 
			
		||||
        g_dbus_method_invocation_return_value (invocation, NULL);
 | 
			
		||||
        return;
 | 
			
		||||
@ -448,6 +463,9 @@ handle_method_call (GDBusConnection       *connection,
 | 
			
		||||
            }
 | 
			
		||||
            g_free (object_path);
 | 
			
		||||
                
 | 
			
		||||
            g_signal_handlers_disconnect_by_func (context,
 | 
			
		||||
                                                  G_CALLBACK(on_notify_visible),
 | 
			
		||||
                                                  service);
 | 
			
		||||
            eekboard_context_service_disable (context);
 | 
			
		||||
            service->priv->context_stack = g_slist_next (service->priv->context_stack);
 | 
			
		||||
            if (service->priv->context_stack)
 | 
			
		||||
@ -458,6 +476,24 @@ handle_method_call (GDBusConnection       *connection,
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (g_strcmp0 (method_name, "ShowKeyboard") == 0) {
 | 
			
		||||
        if (service->priv->context_stack) {
 | 
			
		||||
            eekboard_context_service_show_keyboard (service->priv->context_stack->data);
 | 
			
		||||
        } else {
 | 
			
		||||
            service->priv->visible = TRUE;
 | 
			
		||||
        }
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (g_strcmp0 (method_name, "HideKeyboard") == 0) {
 | 
			
		||||
        if (service->priv->context_stack) {
 | 
			
		||||
            eekboard_context_service_hide_keyboard (service->priv->context_stack->data);
 | 
			
		||||
        } else {
 | 
			
		||||
            service->priv->visible = FALSE;
 | 
			
		||||
        }
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (g_strcmp0 (method_name, "Destroy") == 0) {
 | 
			
		||||
        g_signal_emit (service, signals[DESTROYED], 0);
 | 
			
		||||
        g_dbus_method_invocation_return_value (invocation, NULL);
 | 
			
		||||
 | 
			
		||||
@ -1 +1,3 @@
 | 
			
		||||
SUBDIRS = simple-client
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -1 +1,3 @@
 | 
			
		||||
EXTRA_DIST = simple-client
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										218
									
								
								git.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										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
 | 
			
		||||
@ -29,7 +29,6 @@ eekboard_CFLAGS =					\
 | 
			
		||||
	-I$(top_srcdir)					\
 | 
			
		||||
	$(GIO2_CFLAGS)					\
 | 
			
		||||
	$(GTK_CFLAGS)					\
 | 
			
		||||
	$(XKB_CFLAGS)					\
 | 
			
		||||
	$(LIBXKLAVIER_CFLAGS)				\
 | 
			
		||||
	-DLIBEXECDIR=\"$(libexecdir)\"			\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
@ -37,10 +36,8 @@ eekboard_CFLAGS =					\
 | 
			
		||||
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)
 | 
			
		||||
 | 
			
		||||
@ -75,7 +72,6 @@ eekboard_server_LDADD =				\
 | 
			
		||||
	$(top_builddir)/eekboard/libeekboard.la	\
 | 
			
		||||
	$(top_builddir)/eek/libeek.la		\
 | 
			
		||||
	$(top_builddir)/eek/libeek-gtk.la	\
 | 
			
		||||
	$(top_builddir)/eek/libeek-xkl.la	\
 | 
			
		||||
	$(GIO2_LIBS)				\
 | 
			
		||||
	$(GTK_LIBS)				\
 | 
			
		||||
	$(LIBXKLAVIER_LIBS)			\
 | 
			
		||||
@ -101,7 +97,6 @@ eekboard_setup_CFLAGS = \
 | 
			
		||||
	-I$(top_srcdir)					\
 | 
			
		||||
	$(GIO2_CFLAGS)					\
 | 
			
		||||
	$(GTK_CFLAGS)					\
 | 
			
		||||
	$(XKB_CFLAGS)					\
 | 
			
		||||
	$(LIBXKLAVIER_CFLAGS)				\
 | 
			
		||||
	-DPKGDATADIR=\"$(pkgdatadir)\"			\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
@ -128,3 +123,5 @@ noinst_HEADERS =				\
 | 
			
		||||
	$(eekboard_server_headers)		\
 | 
			
		||||
	$(eekboard_setup_headers)		\
 | 
			
		||||
	$(NULL)
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
@ -32,14 +32,14 @@
 | 
			
		||||
#include "eekboard/eekboard-client.h"
 | 
			
		||||
#include "client.h"
 | 
			
		||||
 | 
			
		||||
#define DEFAULT_KEYBOARD "us"
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										67
									
								
								src/client.c
									
									
									
									
									
								
							
							
						
						
									
										67
									
								
								src/client.c
									
									
									
									
									
								
							@ -29,12 +29,12 @@
 | 
			
		||||
#include <gdk/gdkx.h>
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_XTEST
 | 
			
		||||
#include <X11/extensions/XTest.h>
 | 
			
		||||
#include <X11/XKBlib.h>
 | 
			
		||||
//#include <X11/extensions/XTest.h>
 | 
			
		||||
//#include <X11/XKBlib.h>
 | 
			
		||||
#endif  /* HAVE_XTEST */
 | 
			
		||||
 | 
			
		||||
#include "eek/eek.h"
 | 
			
		||||
#include "eek/eek-xkl.h"
 | 
			
		||||
//#include "eek/eek-xkl.h"
 | 
			
		||||
#include "eekboard/eekboard-client.h"
 | 
			
		||||
#include "eekboard/eekboard-xklutil.h"
 | 
			
		||||
#include "client.h"
 | 
			
		||||
@ -44,6 +44,12 @@
 | 
			
		||||
#define CSW 640
 | 
			
		||||
#define CSH 480
 | 
			
		||||
 | 
			
		||||
#define DEFAULT_KEYBOARD "us"
 | 
			
		||||
static gchar *default_keyboards[2] = {
 | 
			
		||||
    DEFAULT_KEYBOARD,
 | 
			
		||||
    NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define IBUS_INTERFACE_PANEL    "org.freedesktop.IBus.Panel"
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
@ -87,7 +93,7 @@ struct _Client {
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_XTEST
 | 
			
		||||
    guint modifier_keycodes[8]; 
 | 
			
		||||
    XkbDescRec *xkb;
 | 
			
		||||
//    XkbDescRec *xkb;  //x11_stub
 | 
			
		||||
#endif  /* HAVE_XTEST */
 | 
			
		||||
 | 
			
		||||
    GSettings *settings;
 | 
			
		||||
@ -141,6 +147,7 @@ client_set_property (GObject      *object,
 | 
			
		||||
{
 | 
			
		||||
    Client *client = CLIENT(object);
 | 
			
		||||
    GDBusConnection *connection;
 | 
			
		||||
    gchar **keyboards;
 | 
			
		||||
 | 
			
		||||
    switch (prop_id) {
 | 
			
		||||
    case PROP_CONNECTION:
 | 
			
		||||
@ -166,7 +173,10 @@ client_set_property (GObject      *object,
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    case PROP_KEYBOARDS:
 | 
			
		||||
        client_set_keyboards (client, g_value_get_boxed (value));
 | 
			
		||||
        keyboards = g_value_get_boxed (value);
 | 
			
		||||
        if (g_strv_length (keyboards) == 0)
 | 
			
		||||
            keyboards = default_keyboards;
 | 
			
		||||
        client_set_keyboards (client, (const gchar * const *)keyboards);
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 | 
			
		||||
@ -305,7 +315,7 @@ client_set_keyboards (Client              *client,
 | 
			
		||||
    gboolean retval;
 | 
			
		||||
    retval = set_keyboards (client, keyboards);
 | 
			
		||||
    if (retval && IS_KEYBOARD_VISIBLE (client))
 | 
			
		||||
        eekboard_context_show_keyboard (client->context, NULL);
 | 
			
		||||
        eekboard_client_show_keyboard (client->eekboard, NULL);
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -347,7 +357,7 @@ client_enable_xkl (Client *client)
 | 
			
		||||
 | 
			
		||||
    retval = set_keyboards_from_xkl (client);
 | 
			
		||||
    if (IS_KEYBOARD_VISIBLE (client))
 | 
			
		||||
        eekboard_context_show_keyboard (client->context, NULL);
 | 
			
		||||
        eekboard_client_show_keyboard (client->eekboard, NULL);
 | 
			
		||||
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
@ -538,21 +548,21 @@ focus_listener_cb (const AtspiEvent *event,
 | 
			
		||||
        case ATSPI_ROLE_TERMINAL:
 | 
			
		||||
            if (strncmp (event->type, "focus", 5) == 0 || event->detail1 == 1) {
 | 
			
		||||
                client->acc = accessible;
 | 
			
		||||
                eekboard_context_show_keyboard (client->context, NULL);
 | 
			
		||||
                eekboard_client_show_keyboard (client->eekboard, NULL);
 | 
			
		||||
            } else if (g_settings_get_boolean (client->settings, "auto-hide") &&
 | 
			
		||||
                       event->detail1 == 0 && accessible == client->acc) {
 | 
			
		||||
                client->acc = NULL;
 | 
			
		||||
                eekboard_context_hide_keyboard (client->context, NULL);
 | 
			
		||||
                eekboard_client_hide_keyboard (client->eekboard, NULL);
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case ATSPI_ROLE_ENTRY:
 | 
			
		||||
            if (strncmp (event->type, "focus", 5) == 0 || event->detail1 == 1) {
 | 
			
		||||
                client->acc = accessible;
 | 
			
		||||
                eekboard_context_show_keyboard (client->context, NULL);
 | 
			
		||||
                eekboard_client_show_keyboard (client->eekboard, NULL);
 | 
			
		||||
            } else if (g_settings_get_boolean (client->settings, "auto-hide") &&
 | 
			
		||||
                       event->detail1 == 0) {
 | 
			
		||||
                client->acc = NULL;
 | 
			
		||||
                eekboard_context_hide_keyboard (client->context, NULL);
 | 
			
		||||
                eekboard_client_hide_keyboard (client->eekboard, NULL);
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
            
 | 
			
		||||
@ -560,7 +570,7 @@ focus_listener_cb (const AtspiEvent *event,
 | 
			
		||||
            ;
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        eekboard_context_hide_keyboard (client->context, NULL);
 | 
			
		||||
        eekboard_client_hide_keyboard (client->eekboard, NULL);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -612,7 +622,7 @@ add_match_rule (GDBusConnection *connection,
 | 
			
		||||
static gboolean
 | 
			
		||||
on_hide_keyboard_timeout (Client *client)
 | 
			
		||||
{
 | 
			
		||||
    eekboard_context_hide_keyboard (client->context, NULL);
 | 
			
		||||
    eekboard_client_hide_keyboard (client->eekboard, NULL);
 | 
			
		||||
    client->hide_keyboard_timeout_id = 0;
 | 
			
		||||
    return FALSE;
 | 
			
		||||
}
 | 
			
		||||
@ -635,7 +645,7 @@ focus_message_filter (GDBusConnection *connection,
 | 
			
		||||
                g_source_remove (client->hide_keyboard_timeout_id);
 | 
			
		||||
                client->hide_keyboard_timeout_id = 0;
 | 
			
		||||
            }
 | 
			
		||||
            eekboard_context_show_keyboard (client->context, NULL);
 | 
			
		||||
            eekboard_client_show_keyboard (client->eekboard, NULL);
 | 
			
		||||
        } else if (g_settings_get_boolean (client->settings, "auto-hide") &&
 | 
			
		||||
                   g_strcmp0 (member, "FocusOut") == 0) {
 | 
			
		||||
            guint delay;
 | 
			
		||||
@ -779,8 +789,8 @@ set_keyboards (Client              *client,
 | 
			
		||||
    for (p = keyboards; *p != NULL; p++) {
 | 
			
		||||
        keyboard_id = eekboard_context_add_keyboard (client->context, *p, NULL);
 | 
			
		||||
        if (keyboard_id == 0) {
 | 
			
		||||
            g_slist_free (head);
 | 
			
		||||
            return FALSE;
 | 
			
		||||
            g_warning ("can't add keyboard %s", *p);
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        client->keyboards = g_slist_prepend (client->keyboards,
 | 
			
		||||
                                             GUINT_TO_POINTER(keyboard_id));
 | 
			
		||||
@ -848,6 +858,8 @@ get_replaced_keycode (Client *client)
 | 
			
		||||
{
 | 
			
		||||
    guint keycode;
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
    //x11_stub_start
 | 
			
		||||
    for (keycode = client->xkb->max_key_code;
 | 
			
		||||
         keycode >= client->xkb->min_key_code;
 | 
			
		||||
         --keycode) {
 | 
			
		||||
@ -857,6 +869,8 @@ get_replaced_keycode (Client *client)
 | 
			
		||||
            return keycode;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    //x11_stub_eend
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
@ -879,6 +893,8 @@ replace_keycode (Client *client,
 | 
			
		||||
    int keysyms_per_keycode;
 | 
			
		||||
    KeySym *syms;
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
    //x11_stub_start
 | 
			
		||||
    g_return_val_if_fail (client->xkb->min_key_code <= keycode &&
 | 
			
		||||
                          keycode <= client->xkb->max_key_code,
 | 
			
		||||
                          FALSE);
 | 
			
		||||
@ -890,6 +906,9 @@ replace_keycode (Client *client,
 | 
			
		||||
    XChangeKeyboardMapping (xdisplay, keycode, 1, syms, 1);
 | 
			
		||||
    XSync (xdisplay, False);
 | 
			
		||||
    XFree (syms);
 | 
			
		||||
    //x11_stub_eend
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
    *keysym = old_keysym;
 | 
			
		||||
    
 | 
			
		||||
    return TRUE;
 | 
			
		||||
@ -1107,6 +1126,9 @@ client_enable_xtest (Client *client)
 | 
			
		||||
 | 
			
		||||
    g_assert (display);
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
    //x11_stub_start
 | 
			
		||||
 | 
			
		||||
    if (!XTestQueryExtension (xdisplay,
 | 
			
		||||
                              &event_base, &error_base,
 | 
			
		||||
                              &major_version, &minor_version)) {
 | 
			
		||||
@ -1131,15 +1153,20 @@ client_enable_xtest (Client *client)
 | 
			
		||||
        g_signal_connect (client->context, "key-activated",
 | 
			
		||||
                          G_CALLBACK(on_key_activated), client);
 | 
			
		||||
 | 
			
		||||
    //x11_stub_eend
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
    return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
client_disable_xtest (Client *client)
 | 
			
		||||
{
 | 
			
		||||
    if (client->xkb) {
 | 
			
		||||
        XkbFreeKeyboard (client->xkb, 0, TRUE);	/* free_all = TRUE */
 | 
			
		||||
        client->xkb = NULL;
 | 
			
		||||
    }
 | 
			
		||||
    //x11_stub_start
 | 
			
		||||
    //if (client->xkb) {
 | 
			
		||||
    //    XkbFreeKeyboard (client->xkb, 0, TRUE); /* free_all = TRUE */
 | 
			
		||||
    //    client->xkb = NULL;
 | 
			
		||||
    //}
 | 
			
		||||
    //x11_stub_eend
 | 
			
		||||
}
 | 
			
		||||
#endif  /* HAVE_XTEST */
 | 
			
		||||
 | 
			
		||||
@ -242,7 +242,7 @@ set_geometry (ServerContextService *context)
 | 
			
		||||
        else
 | 
			
		||||
            height = (width / bounds.width) * bounds.height;
 | 
			
		||||
 | 
			
		||||
        gtk_widget_set_size_request (context->widget, width, height);
 | 
			
		||||
        gtk_window_resize (GTK_WINDOW(context->widget), width, height);
 | 
			
		||||
 | 
			
		||||
        gtk_window_move (GTK_WINDOW(context->window),
 | 
			
		||||
                         (rect.width - width) / 2,
 | 
			
		||||
@ -259,9 +259,9 @@ set_geometry (ServerContextService *context)
 | 
			
		||||
                                G_CALLBACK(on_size_allocate_set_dock),
 | 
			
		||||
                                context);
 | 
			
		||||
    } else {
 | 
			
		||||
        gtk_widget_set_size_request (context->widget,
 | 
			
		||||
                                     bounds.width,
 | 
			
		||||
                                     bounds.height);
 | 
			
		||||
        gtk_window_resize (GTK_WINDOW(context->window),
 | 
			
		||||
                           bounds.width,
 | 
			
		||||
                           bounds.height);
 | 
			
		||||
        gtk_window_move (GTK_WINDOW(context->window),
 | 
			
		||||
                         MAX(rect.width - 20 - bounds.width, 0),
 | 
			
		||||
                         MAX(rect.height - 40 - bounds.height, 0));
 | 
			
		||||
@ -301,6 +301,8 @@ update_widget (ServerContextService *context)
 | 
			
		||||
    eek_gtk_keyboard_set_theme (EEK_GTK_KEYBOARD(context->widget), theme);
 | 
			
		||||
    g_object_unref (theme);
 | 
			
		||||
 | 
			
		||||
    gtk_widget_set_has_tooltip (context->widget, TRUE);
 | 
			
		||||
 | 
			
		||||
    if (!context->window) {
 | 
			
		||||
        context->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 | 
			
		||||
        g_signal_connect (context->window, "destroy",
 | 
			
		||||
@ -330,6 +332,9 @@ server_context_service_real_show_keyboard (EekboardContextService *_context)
 | 
			
		||||
        update_widget (context);
 | 
			
		||||
    g_assert (context->window);
 | 
			
		||||
    gtk_widget_show_all (context->window);
 | 
			
		||||
 | 
			
		||||
    EEKBOARD_CONTEXT_SERVICE_CLASS (server_context_service_parent_class)->
 | 
			
		||||
        show_keyboard (_context);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@ -339,6 +344,9 @@ server_context_service_real_hide_keyboard (EekboardContextService *_context)
 | 
			
		||||
 | 
			
		||||
    if (context->window)
 | 
			
		||||
        gtk_widget_hide (context->window);
 | 
			
		||||
 | 
			
		||||
    EEKBOARD_CONTEXT_SERVICE_CLASS (server_context_service_parent_class)->
 | 
			
		||||
        hide_keyboard (_context);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
 | 
			
		||||
@ -27,4 +27,6 @@ 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)
 | 
			
		||||
eek_xml_test_LDADD = $(top_builddir)/eek/libeek.la $(GIO2_LIBS) $(GTK_LIBS)
 | 
			
		||||
 | 
			
		||||
-include $(top_srcdir)/git.mk
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user