app: undeprecation in GimpOverlayBox

and some size negotiation changes that have no effect at all, just
some hacking in the direction of making it a general-purpose
container, for whatever reason.
This commit is contained in:
Michael Natterer 2018-05-23 00:42:41 +02:00
parent 9647afc7e0
commit d86dc8a5b4
3 changed files with 53 additions and 24 deletions

View File

@ -169,9 +169,6 @@ gimp_overlay_box_realize (GtkWidget *widget)
G_CALLBACK (gimp_overlay_box_pick_embedded_child),
widget);
gtk_style_context_set_background (gtk_widget_get_style_context (widget),
gtk_widget_get_window (widget));
for (list = box->children; list; list = g_list_next (list))
gimp_overlay_child_realize (box, list->data);
}
@ -196,11 +193,27 @@ gimp_overlay_box_get_preferred_width (GtkWidget *widget,
GimpOverlayBox *box = GIMP_OVERLAY_BOX (widget);
GList *list;
*minimum_width = *natural_width =
2 * gtk_container_get_border_width (GTK_CONTAINER (widget)) + 1;
*minimum_width = *natural_width = 0;
for (list = box->children; list; list = g_list_next (list))
gimp_overlay_child_get_preferred_width (box, list->data);
{
gint minimum;
gint natural;
gimp_overlay_child_get_preferred_width (box, list->data,
&minimum, &natural);
*minimum_width = MAX (*minimum_width, minimum);
*natural_width = MAX (*natural_width, natural);
}
*minimum_width = 0;
*minimum_width +=
2 * gtk_container_get_border_width (GTK_CONTAINER (widget)) + 1;
*natural_width +=
2 * gtk_container_get_border_width (GTK_CONTAINER (widget)) + 1;
}
static void
@ -211,11 +224,27 @@ gimp_overlay_box_get_preferred_height (GtkWidget *widget,
GimpOverlayBox *box = GIMP_OVERLAY_BOX (widget);
GList *list;
*minimum_height = *natural_height =
2 * gtk_container_get_border_width (GTK_CONTAINER (widget)) + 1;
*minimum_height = *natural_height = 0;
for (list = box->children; list; list = g_list_next (list))
gimp_overlay_child_get_preferred_height (box, list->data);
{
gint minimum;
gint natural;
gimp_overlay_child_get_preferred_height (box, list->data,
&minimum, &natural);
*minimum_height = MAX (*minimum_height, minimum);
*natural_height = MAX (*natural_height, natural);
}
*minimum_height = 0;
*minimum_height +=
2 * gtk_container_get_border_width (GTK_CONTAINER (widget)) + 1;
*natural_height +=
2 * gtk_container_get_border_width (GTK_CONTAINER (widget)) + 1;
}
static void

View File

@ -178,7 +178,7 @@ gimp_overlay_child_realize (GimpOverlayBox *box,
GDK_WA_VISUAL |
GDK_WA_CURSOR);
child->window = gdk_window_new (gtk_widget_get_root_window (widget),
child->window = gdk_window_new (gdk_screen_get_root_window (screen),
&attributes, attributes_mask);
gdk_window_set_user_data (child->window, widget);
gtk_widget_set_parent_window (child->widget, child->window);
@ -194,8 +194,6 @@ gimp_overlay_child_realize (GimpOverlayBox *box,
G_CALLBACK (gimp_overlay_child_to_embedder),
child);
gtk_style_context_set_background (gtk_widget_get_style_context (widget),
child->window);
gdk_window_show (child->window);
}
@ -214,28 +212,26 @@ gimp_overlay_child_unrealize (GimpOverlayBox *box,
void
gimp_overlay_child_get_preferred_width (GimpOverlayBox *box,
GimpOverlayChild *child)
GimpOverlayChild *child,
gint *minimum,
gint *natural)
{
gint minimum;
gint natural;
g_return_if_fail (GIMP_IS_OVERLAY_BOX (box));
g_return_if_fail (child != NULL);
gtk_widget_get_preferred_width (child->widget, &minimum, &natural);
gtk_widget_get_preferred_width (child->widget, minimum, natural);
}
void
gimp_overlay_child_get_preferred_height (GimpOverlayBox *box,
GimpOverlayChild *child)
GimpOverlayChild *child,
gint *minimum,
gint *natural)
{
gint minimum;
gint natural;
g_return_if_fail (GIMP_IS_OVERLAY_BOX (box));
g_return_if_fail (child != NULL);
gtk_widget_get_preferred_height (child->widget, &minimum, &natural);
gtk_widget_get_preferred_height (child->widget, minimum, natural);
}
void

View File

@ -60,9 +60,13 @@ void gimp_overlay_child_realize (GimpOverlayBox *bo
void gimp_overlay_child_unrealize (GimpOverlayBox *box,
GimpOverlayChild *child);
void gimp_overlay_child_get_preferred_width (GimpOverlayBox *box,
GimpOverlayChild *child);
GimpOverlayChild *child,
gint *minimum,
gint *natural);
void gimp_overlay_child_get_preferred_height (GimpOverlayBox *box,
GimpOverlayChild *child);
GimpOverlayChild *child,
gint *minimum,
gint *natural);
void gimp_overlay_child_size_allocate (GimpOverlayBox *box,
GimpOverlayChild *child);
gboolean gimp_overlay_child_draw (GimpOverlayBox *box,