Skip to content

Commit

Permalink
re-implement ibus in c language.
Browse files Browse the repository at this point in the history
  • Loading branch information
phuang committed Feb 5, 2009
1 parent 41ad463 commit aedad1e
Show file tree
Hide file tree
Showing 226 changed files with 33,580 additions and 10,515 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -6,6 +6,7 @@
*.so
*~
tags
TAGS
Makefile.qmake
Makefile
Makefile.in
Expand Down Expand Up @@ -34,3 +35,4 @@ stamp-h1
py-compile
ibus-*.tar.*
ibus.spec
ibus-1.0.pc
32 changes: 19 additions & 13 deletions Makefile.am
Expand Up @@ -19,25 +19,30 @@
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA

SUBDIRS = \
daemon \
gconf \
ibus \
launcher \
ui \
lib \
util \
client \
setup \
icons \
m4 \
po \
SUBDIRS = \
src \
bindings \
gconf \
ibus \
ui \
util \
client \
setup \
bus \
icons \
m4 \
po \
docs \
$(NULL)

ACLOCAL_AMFLAGS = -I m4

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = ibus-1.0.pc

EXTRA_DIST = \
autogen.sh \
ibus-1.0.pc.in \
ibus.spec.in \
python-config.py \
$(NULL)
Expand All @@ -55,6 +60,7 @@ install-data-hook:

DISTCHECK_CONFIGURE_FLAGS = \
--enable-pygconf \
--enable-gtk-doc \
$(NULL)

rpm: dist @PACKAGE_NAME@.spec
Expand Down
1 change: 1 addition & 0 deletions autogen.sh
Expand Up @@ -4,6 +4,7 @@ set -x

autopoint --force
libtoolize --automake --copy --force
gtkdocize #--flavour=no-tmpl
aclocal -I m4 --force
autoheader --force
automake --add-missing --copy --force
Expand Down
2 changes: 1 addition & 1 deletion lib/Makefile.am → bindings/Makefile.am
Expand Up @@ -20,5 +20,5 @@
# Boston, MA 02111-1307 USA

SUBDIRS = \
gtk2 \
python \
$(NULL)
80 changes: 80 additions & 0 deletions bindings/python/Makefile.am
@@ -0,0 +1,80 @@
# vim:set noet ts=4:
#
# ibus - The Input Bus
#
# Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
#
# 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 program; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA

# pyexec_PYTHON =
# pyexec_LTLIBRARIES = ibus.la
#
# INCLUDES = \
# -I$(top_srcdir)/src \
# -I$(top_builddir)/src \
# $(NULL)
#
# ibus_la_SOURCES = ibus.c ibusmodule.c
# ibus_la_CFLAGS = \
# @PYTHON_CFLAGS@ \
# @GLIB2_CFLAGS@ \
# @GOBJECT2_CFLAGS@ \
# @PYGOBJECT2_CFLAGS@ \
# @DBUS_CFLAGS@ \
# $(NULL)
# ibus_la_LDFLAGS = \
# @PYTHON_LIBS@ \
# @GLIB2_LIBS@ \
# @GOBJECT2_LIBS@ \
# @DBUS_LIBS@ \
# $(top_builddir)/src/libibus.la \
# -avoid-version \
# -module \
# -export-symbols-regex "initibus" \
# $(NULL)
#
# ibus-codegen.defs:
# (cd $(srcdir); \
# ./gendefs.sh; ) > ibus-codegen.defs
#
# IBUS_DEFS = \
# ibus.defs \
# ibus-types.defs \
# ibus-func.defs \
# ibus-virtual-methods.defs \
# ibus.override \
# $(NULL)
#
# ibus.c: $(IBUS_DEFS) ibus.override ibus-codegen.defs
#
# CLEANFILES = ibus.c ibus-codegen.defs
# EXTRA_DIST = \
# gendefs.sh \
# common.h \
# $(GIK_DEFS) \
# $(NULL)
#
# PYGOBJECT_CODEGEN = pygobject-codegen-2.0
#
# .defs.c:
# (cd $(srcdir)\
# && $(PYGOBJECT_CODEGEN) \
# -o $*.override \
# -I $(abs_builddir) \
# -p py$* $*.defs) > gen-$*.c \
# && cp gen-$*.c $*.c \
# && rm -f gen-$*.c
#
7 changes: 7 additions & 0 deletions bindings/python/common.h
@@ -0,0 +1,7 @@
#ifndef __PY_COMMON_H_
#define __PY_COMMON_H_

#include <pygobject.h>
#include <ibus.h>

#endif //__PY_COMMON_H_
3 changes: 3 additions & 0 deletions bindings/python/gendefs.sh
@@ -0,0 +1,3 @@
#!/bin/sh
codegendir=`pkg-config pygobject-2.0 --variable=codegendir`
python $codegendir/h2def.py -m ibus ../../src/*.h
27 changes: 27 additions & 0 deletions bindings/python/ibus-types.defs
@@ -0,0 +1,27 @@
;; (define-boxed EventKey
;; (in-module "Gik")
;; (c-name "GikEventKey")
;; (gtype-id "GIK_TYPE_EVENT_KEY")
;; (copy-func "gik_event_copy")
;; (release-func "gik_event_free")
;; (fields
;; '("gint" "type")
;; '("guint" "state")
;; '("guint" "keyval")
;; '("guint16" "hardware_keycode")
;; '("guint" "is_modifier")
;; )
;; )
;;
;; (define-boxed Event
;; (in-module "Gik")
;; (c-name "GikEvent")
;; (gtype-id "GIK_TYPE_EVENT")
;; (copy-func "gik_event_copy")
;; (release-func "gik_event_free")
;; (fields
;; '("gint" "type")
;; '("GikEventKey" "key")
;; )
;; )
;;
23 changes: 23 additions & 0 deletions bindings/python/ibus-virtual-methods.defs
@@ -0,0 +1,23 @@
;; For GikEngine class
;; (define-virtual filter_keypress
;; (of-object "GikEngine")
;; (return-type "gboolean")
;; (parameters
;; '("GikEventKey*" "key")
;; )
;; )
;;
;; (define-virtual focus_in
;; (of-object "GikEngine")
;; (return-type "none")
;; )
;;
;; (define-virtual focus_out
;; (of-object "GikEngine")
;; (return-type "none")
;; )
;;
;; (define-virtual reset
;; (of-object "GikEngine")
;; (return-type "none")
;; )
5 changes: 5 additions & 0 deletions bindings/python/ibus.defs
@@ -0,0 +1,5 @@
(include "ibus-types.defs")
(include "ibus-func.defs")
(include "ibus-virtual-methods.defs")
(include "ibus-codegen.defs")

11 changes: 11 additions & 0 deletions bindings/python/ibus.override
@@ -0,0 +1,11 @@
%%
headers
#include "common.h"
%%
modulename ibus
%%
import gobject.GObject as PyGObject_Type
%%
ignore-glob
*_get_type
%%
29 changes: 29 additions & 0 deletions bindings/python/ibusmodule.c
@@ -0,0 +1,29 @@
#include <Python.h>
#include <pygobject.h>

void pyibus_register_classes (PyObject *d);
void pyibus_add_constants (PyObject *module, const gchar *strip_prefix);
extern PyMethodDef pyibus_functions[];


DL_EXPORT(void)
initibus (void)
{
PyObject *m, *d;

init_pygobject ();

m = Py_InitModule ("ibus", pyibus_functions);
d = PyModule_GetDict (m);

pyibus_register_classes (d);

if (PyErr_Occurred ()) {
Py_FatalError ("unable to initialise ibus module");
}
pyibus_add_constants (m, "GIK_");
if (PyErr_Occurred ()) {
Py_FatalError ("unable to initialise ibus module");
}
}

2 changes: 2 additions & 0 deletions bus/.gitignore
@@ -0,0 +1,2 @@
ibus-daemon
test-matchrule
99 changes: 99 additions & 0 deletions bus/Makefile.am
@@ -0,0 +1,99 @@
# vim:set noet ts=4:
#
# ibus - The Input Bus
#
# Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
#
# 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 program; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA

libibus = $(top_builddir)/src/libibus.la

INCLUDES = \
-I$(top_srcdir)/src \
$(NULL)

AM_CFLAGS = \
@GLIB2_CFLAGS@ \
@DBUS_CFLAGS@ \
-DG_LOG_DOMAIN=\"IBUS\" \
-DPKGDATADIR=\"$(pkgdatadir)\" \
-DLIBEXECDIR=\"$(libexecdir)\" \
$(INCLUDES) \
$(NULL)
AM_LDFLAGS = \
@GLIB2_LIBS@ \
@DBUS_LIBS@ \
$(libibus) \
$(NULL)

TESTS = \
test-matchrule \
$(NULL)

noinst_PROGRAMS = $(TESTS)
bin_PROGRAMS = ibus-daemon
ibus_daemon_DEPENDENCIES = \
$(libibus) \
$(NULL)
ibus_daemon_SOURCES = \
main.c \
dbusimpl.c \
dbusimpl.h \
ibusimpl.c \
ibusimpl.h \
inputcontext.c \
inputcontext.h \
engineproxy.c \
engineproxy.h \
panelproxy.c \
panelproxy.h \
factoryproxy.c \
factoryproxy.h \
server.c \
server.h \
connection.c \
connection.h \
matchrule.c \
matchrule.h \
registry.c \
registry.h \
$(NULL)
ibus_daemon_CFLAGS = \
$(AM_CFLAGS) \
$(NULL)
ibus_daemon_LDADD = \
$(AM_LDFLAGS) \
$(NULL)

test_registry_SOURCES = \
registry.c \
registry.h \
factoryproxy.c \
factoryproxy.h \
test-registry.c \
$(NULL)

test_matchrule_SOURCES = \
connection.c \
matchrule.c \
test-matchrule.c \
$(NULL)

$(libibus):
$(MAKE) -C $(top_builddir)/src

test: ibus-daemon
$(builddir)/ibus-daemon

0 comments on commit aedad1e

Please sign in to comment.