summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordchen@redhat.com <dchen@dchen.redhat.com>2009-03-03 17:47:58 +1000
committerdchen@redhat.com <dchen@dchen.redhat.com>2009-03-03 17:47:58 +1000
commite370fb079b569980e4f6cf31544d56899afd9911 (patch)
treeaaaf1f8171ceb2e9b5f0d69970e6e7a65dfc96cc
parent15d0f437874bcca2b9f8f9f1b4e10f1df37322da (diff)
parent9f58762089f0a4b5ec887cd972b4762e7e46455b (diff)
downloadibus-e370fb079b569980e4f6cf31544d56899afd9911.tar.gz
ibus-e370fb079b569980e4f6cf31544d56899afd9911.tar.xz
ibus-e370fb079b569980e4f6cf31544d56899afd9911.zip
Merge branch 'master' of git://github.com/phuang/ibus
-rw-r--r--bus/Makefile.am1
-rw-r--r--bus/main.c49
-rw-r--r--client/x11/main.c10
-rw-r--r--configure.ac3
-rw-r--r--setup/keyboardshortcut.py3
-rw-r--r--src/ibushotkey.c8
-rw-r--r--src/ibusmessage.c2
-rw-r--r--src/ibuspendingcall.c2
-rw-r--r--util/IMdkit/i18nX.c4
9 files changed, 66 insertions, 16 deletions
diff --git a/bus/Makefile.am b/bus/Makefile.am
index 526ac21..1b57a07 100644
--- a/bus/Makefile.am
+++ b/bus/Makefile.am
@@ -22,6 +22,7 @@
libibus = $(top_builddir)/src/libibus.la
INCLUDES = \
+ -I$(top_srcdir) \
-I$(top_srcdir)/src \
$(NULL)
diff --git a/bus/main.c b/bus/main.c
index 7e53144..cc4507e 100644
--- a/bus/main.c
+++ b/bus/main.c
@@ -17,9 +17,11 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+#include <config.h>
#include <unistd.h>
#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <pwd.h>
#include <stdlib.h>
#include <locale.h>
@@ -87,6 +89,49 @@ execute_cmdline (const gchar *cmdline)
return TRUE;
}
+#ifndef HAVE_DAEMON
+static void
+closeall (gint fd)
+{
+ gint fdlimit = sysconf(_SC_OPEN_MAX);
+
+ while (fd < fdlimit) {
+ close(fd++);
+ }
+}
+
+static gint
+daemon (gint nochdir, gint noclose)
+{
+ switch (fork()) {
+ case 0: break;
+ case -1: return -1;
+ default: _exit(0);
+ }
+
+ if (setsid() < 0) {
+ return -1;
+ }
+
+ switch (fork()) {
+ case 0: break;
+ case -1: return -1;
+ default: _exit(0);
+ }
+
+ if (!nochdir) {
+ chdir("/");
+ }
+
+ if (!noclose) {
+ closeall(0);
+ open("/dev/null",O_RDWR);
+ dup(0); dup(0);
+ }
+ return 0;
+}
+#endif
+
gint
main (gint argc, gchar **argv)
{
@@ -110,7 +155,7 @@ main (gint argc, gchar **argv)
/* check uid */
{
- gchar *username = ibus_get_user_name ();
+ const gchar *username = ibus_get_user_name ();
uid_t uid = getuid ();
struct passwd *pwd = getpwuid (uid);
diff --git a/client/x11/main.c b/client/x11/main.c
index 6437d50..53389a9 100644
--- a/client/x11/main.c
+++ b/client/x11/main.c
@@ -936,11 +936,11 @@ _xim_init_IMdkit ()
};
GdkWindowAttr window_attr = {
- title : "ibus-xim",
- event_mask : GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
- wclass : GDK_INPUT_OUTPUT,
- window_type : GDK_WINDOW_TOPLEVEL,
- override_redirect : 1,
+ .title = "ibus-xim",
+ .event_mask = GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
+ .wclass = GDK_INPUT_OUTPUT,
+ .window_type = GDK_WINDOW_TOPLEVEL,
+ .override_redirect = 1,
};
XIMStyles styles;
diff --git a/configure.ac b/configure.ac
index c40d8b0..2b6f0d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,6 +61,9 @@ AC_SUBST(LT_VERSION_INFO)
# check inotify
AC_CHECK_HEADERS([sys/inotify.h])
+# check funcs
+AC_CHECK_FUNCS(daemon)
+
# check glib2
AM_PATH_GLIB_2_0
PKG_CHECK_MODULES(GLIB2, [
diff --git a/setup/keyboardshortcut.py b/setup/keyboardshortcut.py
index c30dbcc..a9e2233 100644
--- a/setup/keyboardshortcut.py
+++ b/setup/keyboardshortcut.py
@@ -125,7 +125,6 @@ class KeyboardShortcutSelection(gtk.VBox):
model.clear()
for shortcut in shortcuts:
model.insert(0, (shortcut,))
- # self.__shortcut_view.set_model(model)
def get_shortcuts(self):
model = self.__shortcut_view.get_model()
@@ -133,6 +132,8 @@ class KeyboardShortcutSelection(gtk.VBox):
def add_shortcut(self, shortcut):
model = self.__shortcut_view.get_model()
+ if len(model) >= 6:
+ return
model.insert(-1, (shortcut,))
def __get_shortcut_from_buttons(self):
diff --git a/src/ibushotkey.c b/src/ibushotkey.c
index 81e506c..0f1b314 100644
--- a/src/ibushotkey.c
+++ b/src/ibushotkey.c
@@ -390,8 +390,8 @@ ibus_hotkey_profile_remove_hotkey (IBusHotkeyProfile *profile,
priv = IBUS_HOTKEY_PROFILE_GET_PRIVATE (profile);
IBusHotkey hotkey = {
- keyval : keyval,
- modifiers : modifiers
+ .keyval = keyval,
+ .modifiers = modifiers
};
IBusHotkey *p1;
@@ -465,8 +465,8 @@ ibus_hotkey_profile_filter_key_event (IBusHotkeyProfile *profile,
priv = IBUS_HOTKEY_PROFILE_GET_PRIVATE (profile);
IBusHotkey hotkey = {
- keyval : keyval,
- modifiers : modifiers & priv->mask,
+ .keyval = keyval,
+ .modifiers = modifiers & priv->mask,
};
GQuark event = (GQuark) GPOINTER_TO_UINT (g_tree_lookup (priv->hotkeys, &hotkey));
diff --git a/src/ibusmessage.c b/src/ibusmessage.c
index 0541778..829a304 100644
--- a/src/ibusmessage.c
+++ b/src/ibusmessage.c
@@ -261,7 +261,7 @@ void
ibus_message_set_no_reply (IBusMessage *message,
gboolean no_reply)
{
- return dbus_message_set_no_reply (message, no_reply);
+ dbus_message_set_no_reply (message, no_reply);
}
gboolean
diff --git a/src/ibuspendingcall.c b/src/ibuspendingcall.c
index 2812dbf..e4b1053 100644
--- a/src/ibuspendingcall.c
+++ b/src/ibuspendingcall.c
@@ -61,7 +61,7 @@ ibus_pending_call_steal_reply (IBusPendingCall *pending)
void
ibus_pending_call_block (IBusPendingCall *pending)
{
- return dbus_pending_call_block (pending);
+ dbus_pending_call_block (pending);
}
void
diff --git a/util/IMdkit/i18nX.c b/util/IMdkit/i18nX.c
index a55dc6d..0ae92d2 100644
--- a/util/IMdkit/i18nX.c
+++ b/util/IMdkit/i18nX.c
@@ -144,7 +144,7 @@ static unsigned char *ReadXIMMessage (XIMS ims,
get_length = LONG_MAX;
get_length /= 4;
if (get_length == 0) {
- fprintf(stderr, "%s: invalid length 0\n", __FUNCTION__);
+ fprintf(stderr, "%s: invalid length 0\n", __func__);
return NULL;
}
return_code = XGetWindowProperty (i18n_core->address.dpy,
@@ -178,7 +178,7 @@ static unsigned char *ReadXIMMessage (XIMS ims,
break;
default:
fprintf(stderr, "%s: unknown property return format: %d\n",
- __FUNCTION__, actual_format_ret);
+ __func__, actual_format_ret);
XFree(prop);
client->property_offset = 0;
return NULL;