Author: cazfi Date: Sat Mar 5 23:43:44 2016 New Revision: 32189 URL: http://svn.gna.org/viewcvs/freeciv?rev=32189&view=rev Log: Fixed "gdk_window_move_resize_internal: assertion 'GDK_IS_WINDOW (window)'" error when detaching lower part of the gtk3 or gtk3x-client window.
See bug #24474 Modified: branches/S2_6/client/gui-gtk-3.0/gui_main.c Modified: branches/S2_6/client/gui-gtk-3.0/gui_main.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/gui_main.c?rev=32189&r1=32188&r2=32189&view=diff ============================================================================== --- branches/S2_6/client/gui-gtk-3.0/gui_main.c (original) +++ branches/S2_6/client/gui-gtk-3.0/gui_main.c Sat Mar 5 23:43:44 2016 @@ -358,6 +358,7 @@ gpointer data) { static int old_width = 0, old_height = 0; + if (allocation->width != old_width || allocation->height != old_height) { chatline_scroll_to_bottom(TRUE); @@ -748,7 +749,7 @@ } /************************************************************************** - reattaches the detached widget when the user destroys it. + Reattaches the detached widget when the user destroys it. **************************************************************************/ static void tearoff_destroy(GtkWidget *w, gpointer data) { @@ -764,17 +765,18 @@ } /************************************************************************** - propagates a keypress in a tearoff back to the toplevel window. + Propagates a keypress in a tearoff back to the toplevel window. **************************************************************************/ static gboolean propagate_keypress(GtkWidget *w, GdkEventKey *ev) { gtk_widget_event(toplevel, (GdkEvent *)ev); + return FALSE; } /************************************************************************** - callback for the toggle button in the detachable widget: causes the - widget to detach or reattach. + Callback for the toggle button in the detachable widget: causes the + widget to detach or reattach. **************************************************************************/ static void tearoff_callback(GtkWidget *b, gpointer data) { @@ -782,6 +784,8 @@ GtkWidget *w; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(b))) { + GtkWidget *temp_hide; + w = gtk_window_new(GTK_WINDOW_TOPLEVEL); setup_dialog(w, toplevel); gtk_widget_set_name(w, "Freeciv"); @@ -791,11 +795,17 @@ g_signal_connect(w, "key_press_event", G_CALLBACK(propagate_keypress), NULL); - g_object_set_data(G_OBJECT(w), "parent", gtk_widget_get_parent(box)); g_object_set_data(G_OBJECT(w), "toggle", b); + temp_hide = g_object_get_data(G_OBJECT(box), "hide-over-reparent"); + if (temp_hide != NULL) { + gtk_widget_hide(temp_hide); + } gtk_widget_reparent(box, w); gtk_widget_show(w); + if (temp_hide != NULL) { + gtk_widget_show(temp_hide); + } } else { gtk_widget_destroy(gtk_widget_get_parent(box)); } @@ -1046,18 +1056,18 @@ } /************************************************************************** - do the heavy lifting for the widget setup. + Do the heavy lifting for the widget setup. **************************************************************************/ static void setup_widgets(void) { - GtkWidget *page, *ebox, *hgrid, *hgrid2, *sbox, *label; + GtkWidget *page, *ebox, *hgrid, *hgrid2, *label; GtkWidget *frame, *table, *table2, *paned, *hpaned, *sw, *text; GtkWidget *button, *view, *vgrid, *right_vbox = NULL; int i; char buf[256]; struct sprite *sprite; - GtkWidget *notebook, *statusbar; + GtkWidget *dtach_lowbox = NULL; message_buffer = gtk_text_buffer_new(NULL); @@ -1460,9 +1470,9 @@ bottom_hpaned = hpaned = paned; right_notebook = bottom_notebook = top_notebook; } else { - sbox = detached_widget_new(); - gtk_paned_pack2(GTK_PANED(paned), sbox, FALSE, TRUE); - avbox = detached_widget_fill(sbox); + dtach_lowbox = detached_widget_new(); + gtk_paned_pack2(GTK_PANED(paned), dtach_lowbox, FALSE, TRUE); + avbox = detached_widget_fill(dtach_lowbox); vgrid = gtk_grid_new(); gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid), @@ -1527,6 +1537,9 @@ gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 5); main_message_area = GTK_TEXT_VIEW(text); + if (dtach_lowbox != NULL) { + g_object_set_data(G_OBJECT(dtach_lowbox), "hide-over-reparent", main_message_area); + } chat_welcome_message(TRUE); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits