IBUS does not need a connection to the DBUS session bus

This commit is contained in:
Kovid Goyal 2018-07-09 10:48:00 +05:30
parent 26a6d6bef9
commit 3a4b614ae0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
7 changed files with 7 additions and 19 deletions

9
glfw/dbus_glfw.c vendored
View File

@ -42,15 +42,6 @@ report_error(DBusError *err, const char *fmt, ...) {
GLFWbool
glfw_dbus_init(_GLFWDBUSData *dbus) {
DBusError err;
if (!dbus->session_conn) {
dbus_error_init(&err);
dbus->session_conn = dbus_bus_get_private(DBUS_BUS_SESSION, &err);
if (dbus_error_is_set(&err)) {
report_error(&err, "Failed to connect to DBUS session bus");
return GLFW_FALSE;
}
}
return GLFW_TRUE;
}

5
glfw/ibus_glfw.c vendored
View File

@ -193,12 +193,9 @@ setup_connection(_GLFWIBUSData *ibus) {
void
glfw_connect_to_ibus(_GLFWIBUSData *ibus, _GLFWDBUSData *dbus) {
glfw_connect_to_ibus(_GLFWIBUSData *ibus) {
if (ibus->inited) return;
if (!has_env_var("XMODIFIERS", "@im=ibus") && !has_env_var("GTK_IM_MODULE", "ibus") && !has_env_var("QT_IM_MODULE", "ibus")) return;
if (!glfw_dbus_init(dbus)) {
_glfwInputError(GLFW_PLATFORM_ERROR, "Cannot connect to IBUS as connection to DBUS session bus failed");
}
ibus->inited = GLFW_TRUE;
setup_connection(ibus);
}

2
glfw/ibus_glfw.h vendored
View File

@ -36,6 +36,6 @@ typedef struct {
const char *input_ctx_path, *address_file_name, *address;
} _GLFWIBUSData;
void glfw_connect_to_ibus(_GLFWIBUSData *ibus, _GLFWDBUSData *dbus);
void glfw_connect_to_ibus(_GLFWIBUSData *ibus);
void glfw_ibus_terminate(_GLFWIBUSData *ibus);
void glfw_ibus_set_focused(_GLFWIBUSData *ibus, GLFWbool focused);

2
glfw/wl_init.c vendored
View File

@ -669,7 +669,7 @@ int _glfwPlatformInit(void)
_glfw.wl.registry = wl_display_get_registry(_glfw.wl.display);
wl_registry_add_listener(_glfw.wl.registry, &registryListener, NULL);
if (!glfw_xkb_create_context(&_glfw.wl.xkb, &_glfw.wl.dbus)) return GLFW_FALSE;
if (!glfw_xkb_create_context(&_glfw.wl.xkb)) return GLFW_FALSE;
// Sync so we got all registry objects
wl_display_roundtrip(_glfw.wl.display);

2
glfw/x11_init.c vendored
View File

@ -378,7 +378,7 @@ static GLFWbool initExtensions(void)
}
if (!glfw_xkb_set_x11_events_mask()) return GLFW_FALSE;
if (!glfw_xkb_create_context(&_glfw.x11.xkb, &_glfw.x11.dbus)) return GLFW_FALSE;
if (!glfw_xkb_create_context(&_glfw.x11.xkb)) return GLFW_FALSE;
if (!glfw_xkb_update_x11_keyboard_id(&_glfw.x11.xkb)) return GLFW_FALSE;
if (!glfw_xkb_compile_keymap(&_glfw.x11.xkb, NULL)) return GLFW_FALSE;

4
glfw/xkb_glfw.c vendored
View File

@ -204,7 +204,7 @@ glfw_xkb_release(_GLFWXKBData *xkb) {
}
GLFWbool
glfw_xkb_create_context(_GLFWXKBData *xkb, _GLFWDBUSData *dbus) {
glfw_xkb_create_context(_GLFWXKBData *xkb) {
xkb->context = xkb_context_new(0);
if (!xkb->context)
{
@ -212,7 +212,7 @@ glfw_xkb_create_context(_GLFWXKBData *xkb, _GLFWDBUSData *dbus) {
"Failed to initialize XKB context");
return GLFW_FALSE;
}
glfw_connect_to_ibus(&xkb->ibus, dbus);
glfw_connect_to_ibus(&xkb->ibus);
return GLFW_TRUE;
}

2
glfw/xkb_glfw.h vendored
View File

@ -79,7 +79,7 @@ GLFWbool glfw_xkb_update_x11_keyboard_id(_GLFWXKBData *xkb);
#endif
void glfw_xkb_release(_GLFWXKBData *xkb);
GLFWbool glfw_xkb_create_context(_GLFWXKBData *xkb, _GLFWDBUSData *dbus);
GLFWbool glfw_xkb_create_context(_GLFWXKBData *xkb);
GLFWbool glfw_xkb_compile_keymap(_GLFWXKBData *xkb, const char *map_str);
void glfw_xkb_update_modifiers(_GLFWXKBData *xkb, xkb_mod_mask_t depressed, xkb_mod_mask_t latched, xkb_mod_mask_t locked, xkb_layout_index_t base_group, xkb_layout_index_t latched_group, xkb_layout_index_t locked_group);
GLFWbool glfw_xkb_should_repeat(_GLFWXKBData *xkb, xkb_keycode_t scancode);