diff options
author | Peng Huang <shawn.p.huang@gmail.com> | 2009-03-30 14:47:09 +0800 |
---|---|---|
committer | Peng Huang <shawn.p.huang@gmail.com> | 2009-03-30 14:47:09 +0800 |
commit | 0a16fb72e94db3115796db65afff10aad141371b (patch) | |
tree | 5c0f689ee2c32ca0660f5d0acac4a222ca2843cd /src | |
parent | aab43511420f04c37d96c39b6b807fe799036b9c (diff) | |
download | ibus-0a16fb72e94db3115796db65afff10aad141371b.tar.gz ibus-0a16fb72e94db3115796db65afff10aad141371b.tar.xz ibus-0a16fb72e94db3115796db65afff10aad141371b.zip |
Fix problem when create socket address.
Diffstat (limited to 'src')
-rw-r--r-- | src/ibusshare.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/ibusshare.c b/src/ibusshare.c index c8f37a8..c7aa1fe 100644 --- a/src/ibusshare.c +++ b/src/ibusshare.c @@ -24,14 +24,14 @@ #include <pwd.h> #include "ibusshare.h" -static gchar *display = NULL; +static gchar *_display = NULL; void ibus_set_display (const gchar *display) { - if (display != NULL) - g_free (display); - display = g_strdup (display); + if (_display != NULL) + g_free (_display); + _display = g_strdup (display); } const gchar * @@ -74,15 +74,19 @@ ibus_get_socket_path (void) static gchar *path = NULL; if (path == NULL) { - gchar *hostname = ""; + gchar *hostname = "unix"; + gchar *display; gchar *displaynumber = "0"; gchar *screennumber = "0"; const gchar *username = NULL; gchar *p; - if (display == NULL) { + if (_display == NULL) { display = g_strdup (g_getenv ("DISPLAY")); } + else { + display = g_strdup (_display); + } if (display == NULL) { g_warning ("DISPLAY is empty! We use default DISPLAY (:0.0)"); @@ -115,10 +119,9 @@ ibus_get_socket_path (void) path = g_strdup_printf ( "/tmp/ibus-%s/ibus-%s-%s", username, hostname, displaynumber); - + g_free (display); } return path; - } const gchar * |