Reuse window.

This commit is contained in:
Daiki Ueno
2011-02-24 14:43:13 +09:00
parent 3b77502b97
commit 6587f00c2a

View File

@ -181,9 +181,6 @@ update_widget (ServerContext *context)
if (context->widget) if (context->widget)
gtk_widget_destroy (context->widget); gtk_widget_destroy (context->widget);
if (context->window)
gtk_widget_destroy (context->window);
eek_element_get_bounds (EEK_ELEMENT(context->keyboard), &bounds); eek_element_get_bounds (EEK_ELEMENT(context->keyboard), &bounds);
#if HAVE_CLUTTER_GTK #if HAVE_CLUTTER_GTK
context->widget = gtk_clutter_embed_new (); context->widget = gtk_clutter_embed_new ();
@ -205,13 +202,13 @@ update_widget (ServerContext *context)
#endif #endif
gtk_widget_set_size_request (context->widget, bounds.width, bounds.height); gtk_widget_set_size_request (context->widget, bounds.width, bounds.height);
if (!context->window) {
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 = 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_widget_set_can_focus (context->window, FALSE); gtk_widget_set_can_focus (context->window, FALSE);
g_object_set (G_OBJECT(context->window), "accept_focus", FALSE, NULL); g_object_set (G_OBJECT(context->window), "accept_focus", FALSE, NULL);
@ -226,6 +223,8 @@ update_widget (ServerContext *context)
gtk_window_move (GTK_WINDOW(context->window), gtk_window_move (GTK_WINDOW(context->window),
MAX(rect.width - 20 - bounds.width, 0), MAX(rect.width - 20 - bounds.width, 0),
MAX(rect.height - 40 - bounds.height, 0)); MAX(rect.height - 40 - bounds.height, 0));
}
gtk_container_add (GTK_CONTAINER(context->window), context->widget);
} }
static void static void