Add $IBUS_SESSION_ID in socket path.
This commit is contained in:
Родитель
25ffd2b7f1
Коммит
e61932c092
|
@ -89,7 +89,7 @@ bus_server_listen (BusServer *server)
|
|||
gchar *path;
|
||||
gboolean retval;
|
||||
|
||||
path = g_strdup_printf("/tmp/ibus-%s", ibus_get_user_name ());
|
||||
path = ibus_get_socket_folder ();
|
||||
mkdir (path, 0700);
|
||||
chmod (path, 0700);
|
||||
|
||||
|
|
|
@ -67,7 +67,12 @@ if not __username:
|
|||
if not __username:
|
||||
__username = os.getenv ("USERNAME")
|
||||
|
||||
IBUS_ADDR = "unix:path=/tmp/ibus-%s/ibus-%s-%s" % (__username, __hostname, __display_number)
|
||||
__session_id = os.getenv ("IBUS_SESSION_ID")
|
||||
|
||||
IBUS_ADDR = "unix:path=/tmp/ibus-%s%s/ibus-%s-%s" % (__username,
|
||||
"-" + __session_id if __session_id else "",
|
||||
__hostname,
|
||||
__display_number)
|
||||
# IBUS_ADDR = "tcp:host=localhost,port=7799"
|
||||
|
||||
IBUS_IFACE_IBUS = "org.freedesktop.IBus"
|
||||
|
|
|
@ -220,7 +220,7 @@ ibus_bus_init (IBusBus *bus)
|
|||
|
||||
ibus_bus_connect (bus);
|
||||
|
||||
path = g_strdup_printf ("/tmp/ibus-%s/", ibus_get_user_name ());
|
||||
path = ibus_get_socket_folder ();
|
||||
file = g_file_new_for_path (path);
|
||||
priv->monitor = g_file_monitor_directory (file, 0, NULL, NULL);
|
||||
|
||||
|
|
|
@ -68,6 +68,31 @@ ibus_get_user_name (void)
|
|||
return username;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
ibus_get_session_id (void)
|
||||
{
|
||||
return g_getenv("IBUS_SESSION_ID");
|
||||
}
|
||||
|
||||
const gchar *
|
||||
ibus_get_socket_folder (void)
|
||||
{
|
||||
static gchar *folder = NULL;
|
||||
|
||||
if (folder == NULL) {
|
||||
const gchar *session = ibus_get_session_id ();
|
||||
if (session && session[0] != '\0') {
|
||||
folder = g_strdup_printf ("/tmp/ibus-%s-%s",
|
||||
ibus_get_user_name (), session);
|
||||
}
|
||||
else {
|
||||
folder = g_strdup_printf ("/tmp/ibus-%s",
|
||||
ibus_get_user_name ());
|
||||
}
|
||||
}
|
||||
return folder;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
ibus_get_socket_path (void)
|
||||
{
|
||||
|
|
|
@ -49,6 +49,7 @@ void ibus_set_display (const gchar *display);
|
|||
const gchar *ibus_get_address (void);
|
||||
const gchar *ibus_get_user_name (void);
|
||||
const gchar *ibus_get_socket_path (void);
|
||||
const gchar *ibus_get_socket_folder (void);
|
||||
|
||||
const gchar *ibus_keyval_name (guint keyval);
|
||||
guint ibus_keyval_from_name (const gchar *keyval_name);
|
||||
|
|
Загрузка…
Ссылка в новой задаче