return TRUE;
}
+static void
+get_padding_and_border (GtkWidget *widget,
+ GtkBorder *border)
+{
+ GtkStyleContext *context;
+ GtkStateFlags state;
+ GtkBorder tmp;
+
+ context = gtk_widget_get_style_context (widget);
+ state = gtk_widget_get_state_flags (widget);
+
+ gtk_style_context_get_padding (context, state, border);
+ gtk_style_context_get_border (context, state, &tmp);
+ border->top += tmp.top;
+ border->right += tmp.right;
+ border->bottom += tmp.bottom;
+ border->left += tmp.left;
+}
+
static void
gtk_bubble_window_get_preferred_width (GtkWidget *widget,
gint *minimum_width,
GtkBubbleWindowPrivate *priv;
GtkWidget *child;
gint min, nat;
+ GtkBorder border;
priv = GTK_BUBBLE_WINDOW (widget)->priv;
child = gtk_bin_get_child (GTK_BIN (widget));
if (child)
gtk_widget_get_preferred_width (child, &min, &nat);
+ get_padding_and_border (widget, &border);
+ min += border.left + border.right;
+ nat += border.left + border.right;
+
if (!POS_IS_VERTICAL (priv->final_position))
{
min += TAIL_HEIGHT;
GtkBubbleWindowPrivate *priv;
GtkWidget *child;
gint min, nat;
+ GtkBorder border;
priv = GTK_BUBBLE_WINDOW (widget)->priv;
child = gtk_bin_get_child (GTK_BIN (widget));
min = nat = 0;
if (child)
- gtk_widget_get_preferred_height (child, &min, &nat);
+ gtk_widget_get_preferred_height (child, &min, &nat);
+
+ get_padding_and_border (widget, &border);
+ min += border.top + border.bottom;
+ nat += border.top + border.bottom;
if (POS_IS_VERTICAL (priv->final_position))
{
if (child)
{
GtkAllocation child_alloc;
+ GtkBorder border;
+
+ get_padding_and_border (widget, &border);
- child_alloc.x = child_alloc.y = 0;
- child_alloc.width = allocation->width;
- child_alloc.height = allocation->height;
+ child_alloc.x = border.left;
+ child_alloc.y = border.top;
+ child_alloc.width = allocation->width - border.left - border.right;
+ child_alloc.height = allocation->height - border.top - border.bottom;
if (POS_IS_VERTICAL (priv->final_position))
child_alloc.height -= TAIL_HEIGHT;