Avoid to send KeyboardVisibilityChanged on SetKeyboard and SetGroup.

This commit is contained in:
Daiki Ueno
2011-02-23 14:51:25 +09:00
parent 6747e07166
commit 50895d08e1
4 changed files with 15 additions and 2 deletions

View File

@ -93,6 +93,7 @@ struct _ServerContext {
gulong key_pressed_handler; gulong key_pressed_handler;
gulong key_released_handler; gulong key_released_handler;
gulong notify_visible_handler;
}; };
struct _ServerContextClass { struct _ServerContextClass {
@ -207,6 +208,7 @@ update_widget (ServerContext *context)
context->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); context->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (context->window, "destroy", g_signal_connect (context->window, "destroy",
G_CALLBACK(on_destroy), context); G_CALLBACK(on_destroy), context);
context->notify_visible_handler =
g_signal_connect (context->window, "notify::visible", g_signal_connect (context->window, "notify::visible",
G_CALLBACK(on_notify_visible), context); G_CALLBACK(on_notify_visible), context);
gtk_container_add (GTK_CONTAINER(context->window), context->widget); gtk_container_add (GTK_CONTAINER(context->window), context->widget);
@ -471,9 +473,14 @@ handle_method_call (GDBusConnection *connection,
if (context->window) { if (context->window) {
gboolean was_visible = gtk_widget_get_visible (context->window); gboolean was_visible = gtk_widget_get_visible (context->window);
/* avoid to send KeyboardVisibilityChanged */
g_signal_handler_block (context->window,
context->notify_visible_handler);
update_widget (context); update_widget (context);
if (was_visible) if (was_visible)
gtk_widget_show_all (context->window); gtk_widget_show_all (context->window);
g_signal_handler_unblock (context->window,
context->notify_visible_handler);
} }
g_dbus_method_invocation_return_value (invocation, NULL); g_dbus_method_invocation_return_value (invocation, NULL);
@ -496,9 +503,15 @@ handle_method_call (GDBusConnection *connection,
if (context->window) { if (context->window) {
gboolean was_visible = gtk_widget_get_visible (context->window); gboolean was_visible = gtk_widget_get_visible (context->window);
/* avoid to send KeyboardVisibilityChanged */
g_signal_handler_block (context->window,
context->notify_visible_handler);
update_widget (context); update_widget (context);
if (was_visible) if (was_visible)
gtk_widget_show_all (context->window); gtk_widget_show_all (context->window);
g_signal_handler_unblock (context->window,
context->notify_visible_handler);
} }
g_dbus_method_invocation_return_value (invocation, NULL); g_dbus_method_invocation_return_value (invocation, NULL);