mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-29 15:01:23 +00:00
Ensure all natives request at least a 1px wide surface
FIXME: Is this necessary? Could the surfaces just clamp to 1x1 themselves? We recently declared that surfaces can decide on whatever size they want so natives need to inspect the size they requested anyway.
This commit is contained in:
parent
3eea9f3e79
commit
f656cbdc5b
@ -129,7 +129,9 @@ gtk_drag_icon_move_resize (GtkDragIcon *icon)
|
||||
if (icon->surface)
|
||||
{
|
||||
gtk_widget_get_preferred_size (GTK_WIDGET (icon), NULL, &req);
|
||||
gdk_surface_resize (icon->surface, req.width, req.height);
|
||||
gdk_surface_resize (icon->surface,
|
||||
MAX (1, req.width),
|
||||
MAX (1, req.height));
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,8 +258,6 @@ gtk_drag_icon_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
GtkDragIcon *icon = GTK_DRAG_ICON (widget);
|
||||
|
||||
gtk_drag_icon_move_resize (icon);
|
||||
|
||||
if (icon->widget)
|
||||
gtk_widget_allocate (icon->widget, width, height, baseline, NULL);
|
||||
}
|
||||
|
@ -546,7 +546,8 @@ present_popup (GtkPopover *popover)
|
||||
layout = create_popup_layout (popover);
|
||||
gtk_widget_get_preferred_size (GTK_WIDGET (popover), NULL, &req);
|
||||
if (gdk_surface_present_popup (priv->surface,
|
||||
req.width, req.height,
|
||||
MAX (req.width, 1),
|
||||
MAX (req.height, 1),
|
||||
layout))
|
||||
update_popover_layout (popover, layout);
|
||||
}
|
||||
|
@ -125,33 +125,22 @@ create_popup_layout (GtkTooltipWindow *window)
|
||||
}
|
||||
|
||||
static void
|
||||
relayout_popup (GtkTooltipWindow *window)
|
||||
{
|
||||
GdkPopupLayout *layout;
|
||||
|
||||
if (!gtk_widget_get_visible (GTK_WIDGET (window)))
|
||||
return;
|
||||
|
||||
layout = create_popup_layout (window);
|
||||
gdk_surface_present_popup (window->surface,
|
||||
gdk_surface_get_width (window->surface),
|
||||
gdk_surface_get_height (window->surface),
|
||||
layout);
|
||||
gdk_popup_layout_unref (layout);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tooltip_window_move_resize (GtkTooltipWindow *window)
|
||||
gtk_tooltip_window_relayout (GtkTooltipWindow *window)
|
||||
{
|
||||
GtkRequisition req;
|
||||
GdkPopupLayout *layout;
|
||||
|
||||
if (window->surface)
|
||||
{
|
||||
gtk_widget_get_preferred_size (GTK_WIDGET (window), NULL, &req);
|
||||
gdk_surface_resize (window->surface, req.width, req.height);
|
||||
if (!gtk_widget_get_visible (GTK_WIDGET (window)) ||
|
||||
window->surface == NULL)
|
||||
return;
|
||||
|
||||
relayout_popup (window);
|
||||
}
|
||||
gtk_widget_get_preferred_size (GTK_WIDGET (window), NULL, &req);
|
||||
layout = create_popup_layout (window);
|
||||
gdk_surface_present_popup (window->surface,
|
||||
MAX (req.width, 1),
|
||||
MAX (req.height, 1),
|
||||
layout);
|
||||
gdk_popup_layout_unref (layout);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -164,7 +153,7 @@ gtk_tooltip_window_native_check_resize (GtkNative *native)
|
||||
gtk_widget_ensure_allocate (widget);
|
||||
else if (gtk_widget_get_visible (widget))
|
||||
{
|
||||
gtk_tooltip_window_move_resize (window);
|
||||
gtk_tooltip_window_relayout (window);
|
||||
if (window->surface)
|
||||
gtk_widget_allocate (GTK_WIDGET (window),
|
||||
gdk_surface_get_width (window->surface),
|
||||
@ -281,7 +270,7 @@ surface_transform_changed_cb (GtkWidget *widget,
|
||||
{
|
||||
GtkTooltipWindow *window = GTK_TOOLTIP_WINDOW (widget);
|
||||
|
||||
relayout_popup (window);
|
||||
gtk_tooltip_window_relayout (window);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
@ -361,8 +350,6 @@ gtk_tooltip_window_size_allocate (GtkWidget *widget,
|
||||
GtkTooltipWindow *window = GTK_TOOLTIP_WINDOW (widget);
|
||||
GtkWidget *child;
|
||||
|
||||
gtk_tooltip_window_move_resize (window);
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (window));
|
||||
|
||||
if (child)
|
||||
@ -608,6 +595,6 @@ gtk_tooltip_window_position (GtkTooltipWindow *window,
|
||||
window->dx = dx;
|
||||
window->dy = dy;
|
||||
|
||||
relayout_popup (window);
|
||||
gtk_tooltip_window_relayout (window);
|
||||
}
|
||||
|
||||
|
@ -5484,8 +5484,8 @@ gtk_window_realize (GtkWidget *widget)
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
surface = gdk_surface_new_toplevel (gtk_widget_get_display (widget),
|
||||
allocation.width,
|
||||
allocation.height);
|
||||
MAX (1, allocation.width),
|
||||
MAX (1, allocation.height));
|
||||
priv->surface = surface;
|
||||
gdk_surface_set_widget (surface, widget);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user