Implement dispatch for the IBUS connection

This commit is contained in:
Kovid Goyal 2018-07-09 21:34:06 +05:30
parent 9ced447fa3
commit 78cda7aa74
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
6 changed files with 15 additions and 7 deletions

13
glfw/dbus_glfw.c vendored
View File

@ -137,8 +137,9 @@ glfw_dbus_connect_to(const char *path, const char* err_msg) {
report_error(&err, err_msg);
return NULL;
}
dbus_error_free(&err);
dbus_connection_set_exit_on_disconnect(ans, FALSE);
dbus_connection_flush(ans);
dbus_error_free(&err);
if (!dbus_bus_register(ans, &err)) {
report_error(&err, err_msg);
return NULL;
@ -159,13 +160,13 @@ glfw_dbus_connect_to(const char *path, const char* err_msg) {
return ans;
}
void
glfw_dbus_dispatch(DBusConnection *conn) {
while(dbus_connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS);
}
void
glfw_dbus_terminate(_GLFWDBUSData *dbus) {
if (dbus->session_conn) {
dbus_connection_close(dbus->session_conn);
dbus_connection_unref(dbus->session_conn);
dbus->session_conn = NULL;
}
if (dbus_data) {
dbus_data->eld = NULL;
dbus_data = NULL;

2
glfw/dbus_glfw.h vendored
View File

@ -31,7 +31,6 @@
#include "backend_utils.h"
typedef struct {
DBusConnection *session_conn;
EventLoopData* eld;
} _GLFWDBUSData;
@ -43,3 +42,4 @@ void glfw_dbus_close_connection(DBusConnection *conn);
GLFWbool glfw_dbus_call_void_method(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...);
GLFWbool
glfw_dbus_call_method(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...);
void glfw_dbus_dispatch(DBusConnection *);

4
glfw/ibus_glfw.c vendored
View File

@ -230,6 +230,10 @@ check_connection(_GLFWIBUSData *ibus) {
}
void
glfw_ibus_dispatch(_GLFWIBUSData *ibus) {
if (ibus->conn) glfw_dbus_dispatch(ibus->conn);
}
// }}}
static void

1
glfw/ibus_glfw.h vendored
View File

@ -39,3 +39,4 @@ typedef struct {
void glfw_connect_to_ibus(_GLFWIBUSData *ibus);
void glfw_ibus_terminate(_GLFWIBUSData *ibus);
void glfw_ibus_set_focused(_GLFWIBUSData *ibus, GLFWbool focused);
void glfw_ibus_dispatch(_GLFWIBUSData *ibus);

1
glfw/wl_window.c vendored
View File

@ -721,6 +721,7 @@ handleEvents(double timeout)
{
wl_display_cancel_read(display);
}
glfw_ibus_dispatch(&_glfw.wl.xkb.ibus);
}
// Translates a GLFW standard cursor to a theme cursor name

1
glfw/x11_window.c vendored
View File

@ -60,6 +60,7 @@ static void
handleEvents(double timeout) {
int display_read_ok = pollForEvents(&_glfw.x11.eventLoopData, timeout);
if (display_read_ok) _glfwDispatchX11Events();
glfw_ibus_dispatch(&_glfw.x11.xkb.ibus);
}
static GLFWbool