Merge branch 'matthiasc/for-master' into 'master'

window: Remove some dead code

Closes #2726 and #2724

See merge request GNOME/gtk!1862
This commit is contained in:
Matthias Clasen
2020-05-10 00:36:49 +00:00
5 changed files with 44 additions and 17 deletions

View File

@@ -2265,7 +2265,7 @@ render_node_print (Printer *p,
if (glyphs[i].glyph == ascii->glyphs[j].glyph &&
glyphs[i].geometry.width == ascii->glyphs[j].geometry.width &&
glyphs[i].geometry.x_offset == 0 &&
glyphs[i].geometry.x_offset == 0 &&
glyphs[i].geometry.y_offset == 0 &&
glyphs[i].attr.is_cluster_start)
{
g_string_append_c (str, j + MIN_ASCII_GLYPH);

View File

@@ -1890,7 +1890,7 @@ out:
if (scheme && !supported)
gtk_widget_add_css_class (view->address_entry, GTK_STYLE_CLASS_ERROR);
else
gtk_widget_add_css_class (view->address_entry, GTK_STYLE_CLASS_ERROR);
gtk_widget_remove_css_class (view->address_entry, GTK_STYLE_CLASS_ERROR);
g_free (address);
g_free (scheme);

View File

@@ -5824,7 +5824,8 @@ gtk_widget_reposition_after (GtkWidget *widget,
/* keep this function in sync with gtk_menu_attach_to_widget()
*/
g_object_ref_sink (widget);
if (priv->parent == NULL)
g_object_ref_sink (widget);
gtk_widget_push_verify_invariants (widget);

View File

@@ -178,7 +178,6 @@ typedef struct
{
GtkWidget *child;
GtkWidget *attach_widget;
GtkWidget *default_widget;
GtkWidget *focus_widget;
GtkWindow *transient_parent;
@@ -2622,15 +2621,6 @@ gtk_window_list_toplevels (void)
return list;
}
static void
remove_attach_widget (GtkWindow *window)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
if (priv->attach_widget)
priv->attach_widget = NULL;
}
static void
gtk_window_dispose (GObject *object)
{
@@ -2655,8 +2645,6 @@ gtk_window_dispose (GObject *object)
if (priv->transient_parent)
gtk_window_set_transient_for (window, NULL);
remove_attach_widget (window);
if (priv->has_user_ref_count)
{
priv->has_user_ref_count = FALSE;
@@ -2672,7 +2660,6 @@ gtk_window_dispose (GObject *object)
g_clear_pointer (&priv->layout, gdk_toplevel_layout_unref);
gtk_window_set_focus (window, NULL);
gtk_window_set_default_widget (window, NULL);
remove_attach_widget (window);
g_clear_pointer (&priv->child, gtk_widget_unparent);
unset_titlebar (window);

View File

@@ -545,7 +545,45 @@ no_loop (void)
g_assert (gtk_widget_get_next_sibling (l2) == NULL);
}
int main (int argc, char **argv)
static void
reorder_refcount (void)
{
GtkWidget *p = gtk_label_new ("");
GtkWidget *l1 = gtk_label_new ("");
GtkWidget *l2 = gtk_label_new ("");
g_assert (g_object_is_floating (l1));
g_assert (G_OBJECT (l1)->ref_count == 1);
gtk_widget_set_parent (l1, p);
g_assert (!g_object_is_floating (l1));
g_assert (G_OBJECT (l1)->ref_count == 1);
g_assert (g_object_is_floating (l2));
g_assert (G_OBJECT (l2)->ref_count == 1);
gtk_widget_set_parent (l2, p);
g_assert (!g_object_is_floating (l2));
g_assert (G_OBJECT (l2)->ref_count == 1);
g_assert (gtk_widget_get_next_sibling (l1) == l2);
gtk_widget_insert_before (l2, p, l1);
g_assert (gtk_widget_get_prev_sibling (l1) == l2);
g_assert (G_OBJECT (l1)->ref_count == 1);
g_assert (G_OBJECT (l2)->ref_count == 1);
gtk_widget_unparent (l1);
gtk_widget_unparent (l2);
g_object_unref (g_object_ref_sink (p));
}
int
main (int argc, char **argv)
{
gtk_init ();
g_test_init (&argc, &argv, NULL);
@@ -565,6 +603,7 @@ int main (int argc, char **argv)
g_test_add_func ("/widgetorder/same-after", same_after);
g_test_add_func ("/widgetorder/same-before", same_before);
g_test_add_func ("/widgetorder/no-loop", no_loop);
g_test_add_func ("/widgetorder/reorder-refcount", reorder_refcount);
return g_test_run ();
}