From 3a4b614ae00f1a9cda7f67b2547145b18e4b7116 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 9 Jul 2018 10:48:00 +0530 Subject: [PATCH] IBUS does not need a connection to the DBUS session bus --- glfw/dbus_glfw.c | 9 --------- glfw/ibus_glfw.c | 5 +---- glfw/ibus_glfw.h | 2 +- glfw/wl_init.c | 2 +- glfw/x11_init.c | 2 +- glfw/xkb_glfw.c | 4 ++-- glfw/xkb_glfw.h | 2 +- 7 files changed, 7 insertions(+), 19 deletions(-) diff --git a/glfw/dbus_glfw.c b/glfw/dbus_glfw.c index 36647eac9..955ac55f4 100644 --- a/glfw/dbus_glfw.c +++ b/glfw/dbus_glfw.c @@ -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; } diff --git a/glfw/ibus_glfw.c b/glfw/ibus_glfw.c index cd674d735..75419daf2 100644 --- a/glfw/ibus_glfw.c +++ b/glfw/ibus_glfw.c @@ -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); } diff --git a/glfw/ibus_glfw.h b/glfw/ibus_glfw.h index 7ed634faa..6e54d6452 100644 --- a/glfw/ibus_glfw.h +++ b/glfw/ibus_glfw.h @@ -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); diff --git a/glfw/wl_init.c b/glfw/wl_init.c index 4feada24a..cf4b9a496 100644 --- a/glfw/wl_init.c +++ b/glfw/wl_init.c @@ -669,7 +669,7 @@ int _glfwPlatformInit(void) _glfw.wl.registry = wl_display_get_registry(_glfw.wl.display); wl_registry_add_listener(_glfw.wl.registry, ®istryListener, 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); diff --git a/glfw/x11_init.c b/glfw/x11_init.c index 8660e9196..d2837c75e 100644 --- a/glfw/x11_init.c +++ b/glfw/x11_init.c @@ -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; diff --git a/glfw/xkb_glfw.c b/glfw/xkb_glfw.c index f9e511a8f..0f9453e8e 100644 --- a/glfw/xkb_glfw.c +++ b/glfw/xkb_glfw.c @@ -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; } diff --git a/glfw/xkb_glfw.h b/glfw/xkb_glfw.h index 1e251a88f..870e037ec 100644 --- a/glfw/xkb_glfw.h +++ b/glfw/xkb_glfw.h @@ -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);