From e4147f14afecc95db90430143d672512a9e92bdb Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 13 Apr 2015 12:12:00 -0400 Subject: [PATCH] Fixed issues in the GTK+ uiParent change. --- new/newcontrol_unix.c | 2 +- new/parent_unix.c | 20 ++++++++++---------- new/tab_unix.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/new/newcontrol_unix.c b/new/newcontrol_unix.c index c56ef8d..221548c 100644 --- a/new/newcontrol_unix.c +++ b/new/newcontrol_unix.c @@ -33,7 +33,7 @@ static void singleSetParent(uiControl *c, uiParent *parent) singleWidget *s = (singleWidget *) (c->internal); s->parent = parent; - gtk_container_add(GTK_CONTAINER(s->parent), s->immediate); + gtk_container_add(GTK_CONTAINER(uiParentHandle(s->parent)), s->immediate); uiParentUpdate(s->parent); } diff --git a/new/parent_unix.c b/new/parent_unix.c index f9c8db1..54d5d06 100644 --- a/new/parent_unix.c +++ b/new/parent_unix.c @@ -34,7 +34,7 @@ static void uipParent_init(uipParent *p) if (options.debugLogAllocations) fprintf(stderr, "%p alloc uipParent\n", p); p->children = g_ptr_array_new(); - gtk_widget_set_has_window(GTK_WIDGET(c), FALSE); + gtk_widget_set_has_window(GTK_WIDGET(p), FALSE); } // instead of having GtkContainer itself unref all our controls, we'll run our own uiControlDestroy() functions for child, which will do that and more @@ -44,11 +44,11 @@ static void uipParent_dispose(GObject *obj) uipParent *p = uipParent(obj); if (p->children != NULL) { - g_ptr_array_unref(c->children); + g_ptr_array_unref(p->children); p->children = NULL; } if (p->child != NULL) { - uiControlDestroy(c->child); + uiControlDestroy(p->child); p->child = NULL; } G_OBJECT_CLASS(uipParent_parent_class)->dispose(obj); @@ -65,7 +65,7 @@ static void uipParent_add(GtkContainer *container, GtkWidget *widget) { uipParent *p = uipParent(container); - gtk_widget_set_parent(widget, GTK_WIDGET(c)); + gtk_widget_set_parent(widget, GTK_WIDGET(p)); if (p->children != NULL) g_ptr_array_add(p->children, widget); } @@ -88,8 +88,8 @@ static void uipParent_size_allocate(GtkWidget *widget, GtkAllocation *allocation uiSizing d; intmax_t x, y, width, height; - gtk_widget_set_allocation(GTK_WIDGET(c), allocation); - if (c->child == NULL) + gtk_widget_set_allocation(GTK_WIDGET(p), allocation); + if (p->child == NULL) return; x = allocation->x + p->marginLeft; y = allocation->y + p->marginTop; @@ -97,7 +97,7 @@ static void uipParent_size_allocate(GtkWidget *widget, GtkAllocation *allocation height = allocation->height - (p->marginTop + p->marginBottom); d.xPadding = gtkXPadding; d.yPadding = gtkYPadding; - uiControlResize(c->child, x, y, width, height, &d); + uiControlResize(p->child, x, y, width, height, &d); } struct forall { @@ -120,7 +120,7 @@ static void uipParent_forall(GtkContainer *container, gboolean includeInternals, s.callback = callback; s.data = data; if (p->children != NULL) - g_ptr_array_foreach(c->children, doforall, &s); + g_ptr_array_foreach(p->children, doforall, &s); } static void uipParent_class_init(uipParentClass *class) @@ -163,7 +163,7 @@ static void parentUpdate(uiParent *p) { uipParent *pp = uipParent(p->Internal); - gtk_queue_resize(GTK_WIDGET(pp)); + gtk_widget_queue_resize(GTK_WIDGET(pp)); } uiParent *uiNewParent(uintptr_t osParent) @@ -178,6 +178,6 @@ uiParent *uiNewParent(uintptr_t osParent) p->Update = parentUpdate; gtk_container_add(GTK_CONTAINER(osParent), GTK_WIDGET(p->Internal)); // and make it visible by default - gtk_widget_show_all(GTK_WIDGET(p->internal)); + gtk_widget_show_all(GTK_WIDGET(p->Internal)); return p; } diff --git a/new/tab_unix.c b/new/tab_unix.c index f995fff..dd69e4c 100644 --- a/new/tab_unix.c +++ b/new/tab_unix.c @@ -51,7 +51,7 @@ void uiTabAddPage(uiControl *c, const char *name, uiControl *child) content = uiNewParent((uintptr_t) notebook); uiParentSetChild(content, child); uiParentUpdate(content); - gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(notebook), container, name); + gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(notebook), GTK_WIDGET(uiParentHandle(content)), name); t->pages[t->len] = content; t->len++;