libibus = $(top_builddir)/src/libibus.la
INCLUDES = \
+ -I$(top_srcdir) \
-I$(top_srcdir)/src \
$(NULL)
* 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>
return TRUE;
}
+#ifndef HAVE_DAEMON
+void closeall(int fd)
+{
+ int fdlimit = sysconf(_SC_OPEN_MAX);
+
+ while (fd < fdlimit)
+ close(fd++);
+}
+
+int daemon(int nochdir, int 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)
{
/* check uid */
{
- gchar *username = ibus_get_user_name ();
+ const gchar *username = ibus_get_user_name ();
uid_t uid = getuid ();
struct passwd *pwd = getpwuid (uid);
};
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;
# 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, [
priv = IBUS_HOTKEY_PROFILE_GET_PRIVATE (profile);
IBusHotkey hotkey = {
- keyval : keyval,
- modifiers : modifiers
+ .keyval = keyval,
+ .modifiers = modifiers
};
IBusHotkey *p1;
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));
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
void
ibus_pending_call_block (IBusPendingCall *pending)
{
- return dbus_pending_call_block (pending);
+ dbus_pending_call_block (pending);
}
void
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,
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;