forked from AuroraMiddleware/gtk
gtk: Check return value of compute_bounds()
Half of these calls will completely break if anybody ever uses CSS transforms with them, but hey...
This commit is contained in:
parent
514c3679dc
commit
01f7f255b5
@ -1653,7 +1653,8 @@ gtk_container_real_set_focus_child (GtkContainer *container,
|
|||||||
0, 0, &x, &y))
|
0, 0, &x, &y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (child, child, &child_bounds);
|
if (!gtk_widget_compute_bounds (child, child, &child_bounds))
|
||||||
|
return;
|
||||||
|
|
||||||
if (vadj)
|
if (vadj)
|
||||||
gtk_adjustment_clamp_page (vadj, y, y + child_bounds.size.height);
|
gtk_adjustment_clamp_page (vadj, y, y + child_bounds.size.height);
|
||||||
|
@ -2889,18 +2889,16 @@ gtk_entry_get_icon_area (GtkEntry *entry,
|
|||||||
{
|
{
|
||||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||||
EntryIconInfo *icon_info;
|
EntryIconInfo *icon_info;
|
||||||
|
graphene_rect_t r;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_ENTRY (entry));
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
||||||
g_return_if_fail (icon_area != NULL);
|
g_return_if_fail (icon_area != NULL);
|
||||||
|
|
||||||
icon_info = priv->icons[icon_pos];
|
icon_info = priv->icons[icon_pos];
|
||||||
|
|
||||||
if (icon_info)
|
if (icon_info &&
|
||||||
|
gtk_widget_compute_bounds (icon_info->widget, GTK_WIDGET (entry), &r))
|
||||||
{
|
{
|
||||||
graphene_rect_t r;
|
|
||||||
|
|
||||||
gtk_widget_compute_bounds (icon_info->widget, GTK_WIDGET (entry), &r);
|
|
||||||
|
|
||||||
*icon_area = (GdkRectangle){
|
*icon_area = (GdkRectangle){
|
||||||
floorf (r.origin.x),
|
floorf (r.origin.x),
|
||||||
floorf (r.origin.y),
|
floorf (r.origin.y),
|
||||||
|
@ -284,13 +284,19 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
|
|||||||
|
|
||||||
g_array_append_val (backlog_array, *time_coord);
|
g_array_append_val (backlog_array, *time_coord);
|
||||||
time_coord = &g_array_index (backlog_array, GdkTimeCoord, backlog_array->len - 1);
|
time_coord = &g_array_index (backlog_array, GdkTimeCoord, backlog_array->len - 1);
|
||||||
gtk_widget_compute_point (gtk_get_event_widget (event),
|
if (gtk_widget_compute_point (gtk_get_event_widget (event),
|
||||||
gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)),
|
gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)),
|
||||||
&GRAPHENE_POINT_INIT (time_coord->axes[GDK_AXIS_X],
|
&GRAPHENE_POINT_INIT (time_coord->axes[GDK_AXIS_X],
|
||||||
time_coord->axes[GDK_AXIS_Y]),
|
time_coord->axes[GDK_AXIS_Y]),
|
||||||
&p);
|
&p))
|
||||||
time_coord->axes[GDK_AXIS_X] = p.x;
|
{
|
||||||
time_coord->axes[GDK_AXIS_Y] = p.y;
|
time_coord->axes[GDK_AXIS_X] = p.x;
|
||||||
|
time_coord->axes[GDK_AXIS_Y] = p.y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_array_set_size (backlog_array, backlog_array->len - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*n_elems = backlog_array->len;
|
*n_elems = backlog_array->len;
|
||||||
|
@ -1443,7 +1443,9 @@ ensure_row_visible (GtkListBox *box,
|
|||||||
if (!priv->adjustment)
|
if (!priv->adjustment)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (GTK_WIDGET (row), GTK_WIDGET (box), &rect);
|
if (!gtk_widget_compute_bounds (GTK_WIDGET (row), GTK_WIDGET (box), &rect))
|
||||||
|
return;
|
||||||
|
|
||||||
y = rect.origin.y;
|
y = rect.origin.y;
|
||||||
height = rect.size.height;
|
height = rect.size.height;
|
||||||
|
|
||||||
@ -1451,9 +1453,11 @@ ensure_row_visible (GtkListBox *box,
|
|||||||
header = ROW_PRIV (row)->header;
|
header = ROW_PRIV (row)->header;
|
||||||
if (GTK_IS_WIDGET (header) && gtk_widget_is_drawable (header))
|
if (GTK_IS_WIDGET (header) && gtk_widget_is_drawable (header))
|
||||||
{
|
{
|
||||||
gtk_widget_compute_bounds (header, GTK_WIDGET (box), &rect);
|
if (gtk_widget_compute_bounds (header, GTK_WIDGET (box), &rect))
|
||||||
y = rect.origin.y;
|
{
|
||||||
height += rect.size.height;
|
y = rect.origin.y;
|
||||||
|
height += rect.size.height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_adjustment_clamp_page (priv->adjustment, y, y + height);
|
gtk_adjustment_clamp_page (priv->adjustment, y, y + height);
|
||||||
|
@ -2812,7 +2812,9 @@ definitely_within_item (GtkMenu *menu,
|
|||||||
int w, h;
|
int w, h;
|
||||||
graphene_rect_t bounds;
|
graphene_rect_t bounds;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (widget, GTK_WIDGET (menu), &bounds);
|
if (!gtk_widget_compute_bounds (widget, GTK_WIDGET (menu), &bounds))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
w = bounds.size.width;
|
w = bounds.size.width;
|
||||||
h = bounds.size.height;
|
h = bounds.size.height;
|
||||||
|
|
||||||
|
@ -1628,10 +1628,9 @@ gtk_notebook_get_tab_area_position (GtkNotebook *notebook,
|
|||||||
|
|
||||||
if (priv->show_tabs && gtk_notebook_has_current_page (notebook))
|
if (priv->show_tabs && gtk_notebook_has_current_page (notebook))
|
||||||
{
|
{
|
||||||
gtk_widget_compute_bounds (priv->header_widget,
|
return gtk_widget_compute_bounds (priv->header_widget,
|
||||||
GTK_WIDGET (notebook),
|
GTK_WIDGET (notebook),
|
||||||
rectangle);
|
rectangle);
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2094,9 +2093,10 @@ gtk_notebook_get_arrow (GtkNotebook *notebook,
|
|||||||
if (priv->arrow_widget[i] == NULL)
|
if (priv->arrow_widget[i] == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->arrow_widget[i],
|
if (!gtk_widget_compute_bounds (priv->arrow_widget[i],
|
||||||
GTK_WIDGET (notebook),
|
GTK_WIDGET (notebook),
|
||||||
&arrow_bounds);
|
&arrow_bounds))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (graphene_rect_contains_point (&arrow_bounds,
|
if (graphene_rect_contains_point (&arrow_bounds,
|
||||||
&(graphene_point_t){x, y}))
|
&(graphene_point_t){x, y}))
|
||||||
@ -2184,7 +2184,8 @@ in_tabs (GtkNotebook *notebook,
|
|||||||
GtkNotebookPrivate *priv = notebook->priv;
|
GtkNotebookPrivate *priv = notebook->priv;
|
||||||
graphene_rect_t tabs_bounds;
|
graphene_rect_t tabs_bounds;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->tabs_widget, GTK_WIDGET (notebook), &tabs_bounds);
|
if (!gtk_widget_compute_bounds (priv->tabs_widget, GTK_WIDGET (notebook), &tabs_bounds))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
return graphene_rect_contains_point (&tabs_bounds,
|
return graphene_rect_contains_point (&tabs_bounds,
|
||||||
&(graphene_point_t){x, y});
|
&(graphene_point_t){x, y});
|
||||||
@ -2208,8 +2209,8 @@ get_tab_at_pos (GtkNotebook *notebook,
|
|||||||
if (!gtk_notebook_page_tab_label_is_visible (page))
|
if (!gtk_notebook_page_tab_label_is_visible (page))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &bounds);
|
if (!gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &bounds))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (graphene_rect_contains_point (&bounds, &(graphene_point_t){x, y}))
|
if (graphene_rect_contains_point (&bounds, &(graphene_point_t){x, y}))
|
||||||
return children;
|
return children;
|
||||||
@ -2285,10 +2286,14 @@ gtk_notebook_gesture_pressed (GtkGestureMultiPress *gesture,
|
|||||||
priv->drag_begin_x = priv->mouse_x;
|
priv->drag_begin_x = priv->mouse_x;
|
||||||
priv->drag_begin_y = priv->mouse_y;
|
priv->drag_begin_y = priv->mouse_y;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &tab_bounds);
|
/* tab bounds get set to empty, which is fine */
|
||||||
|
priv->drag_offset_x = priv->drag_begin_x;
|
||||||
priv->drag_offset_x = priv->drag_begin_x - tab_bounds.origin.x;
|
priv->drag_offset_y = priv->drag_begin_y;
|
||||||
priv->drag_offset_y = priv->drag_begin_y - tab_bounds.origin.y;
|
if (gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &tab_bounds))
|
||||||
|
{
|
||||||
|
priv->drag_offset_x -= tab_bounds.origin.x;
|
||||||
|
priv->drag_offset_y -= tab_bounds.origin.y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2373,10 +2378,9 @@ get_drop_position (GtkNotebook *notebook)
|
|||||||
y = priv->mouse_y;
|
y = priv->mouse_y;
|
||||||
|
|
||||||
is_rtl = gtk_widget_get_direction ((GtkWidget *) notebook) == GTK_TEXT_DIR_RTL;
|
is_rtl = gtk_widget_get_direction ((GtkWidget *) notebook) == GTK_TEXT_DIR_RTL;
|
||||||
children = priv->children;
|
|
||||||
last_child = NULL;
|
last_child = NULL;
|
||||||
|
|
||||||
while (children)
|
for (children = priv->children; children; children = children->next)
|
||||||
{
|
{
|
||||||
page = children->data;
|
page = children->data;
|
||||||
|
|
||||||
@ -2387,7 +2391,8 @@ get_drop_position (GtkNotebook *notebook)
|
|||||||
{
|
{
|
||||||
graphene_rect_t tab_bounds;
|
graphene_rect_t tab_bounds;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &tab_bounds);
|
if (!gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &tab_bounds))
|
||||||
|
continue;
|
||||||
|
|
||||||
switch (priv->tab_pos)
|
switch (priv->tab_pos)
|
||||||
{
|
{
|
||||||
@ -2418,8 +2423,6 @@ get_drop_position (GtkNotebook *notebook)
|
|||||||
|
|
||||||
last_child = children->next;
|
last_child = children->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
children = children->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return last_child;
|
return last_child;
|
||||||
@ -2895,10 +2898,10 @@ gtk_notebook_drag_begin (GtkWidget *widget,
|
|||||||
gtk_widget_unparent (tab_label);
|
gtk_widget_unparent (tab_label);
|
||||||
|
|
||||||
priv->dnd_child = tab_label;
|
priv->dnd_child = tab_label;
|
||||||
gtk_widget_compute_bounds (priv->dnd_child, priv->dnd_child, &bounds);
|
if (gtk_widget_compute_bounds (priv->dnd_child, priv->dnd_child, &bounds))
|
||||||
gtk_widget_set_size_request (priv->dnd_child,
|
gtk_widget_set_size_request (priv->dnd_child,
|
||||||
ceilf (bounds.size.width),
|
ceilf (bounds.size.width),
|
||||||
ceilf (bounds.size.height));
|
ceilf (bounds.size.height));
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->dnd_child), "background");
|
gtk_style_context_add_class (gtk_widget_get_style_context (priv->dnd_child), "background");
|
||||||
|
|
||||||
@ -4933,7 +4936,8 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->cur_page->tab_widget, priv->cur_page->tab_widget, &drag_bounds);
|
if (!gtk_widget_compute_bounds (priv->cur_page->tab_widget, priv->cur_page->tab_widget, &drag_bounds))
|
||||||
|
graphene_rect_init_from_rect (&drag_bounds, graphene_rect_zero ());
|
||||||
|
|
||||||
left_x = CLAMP (priv->mouse_x - priv->drag_offset_x,
|
left_x = CLAMP (priv->mouse_x - priv->drag_offset_x,
|
||||||
allocation->x, allocation->x + allocation->width - drag_bounds.size.width);
|
allocation->x, allocation->x + allocation->width - drag_bounds.size.width);
|
||||||
|
@ -293,7 +293,8 @@ get_handle_area (GtkPaned *paned,
|
|||||||
GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
|
GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
|
||||||
int extra = 0;
|
int extra = 0;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->handle_widget, GTK_WIDGET (paned), area);
|
if (!gtk_widget_compute_bounds (priv->handle_widget, GTK_WIDGET (paned), area))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!gtk_paned_get_wide_handle (paned))
|
if (!gtk_paned_get_wide_handle (paned))
|
||||||
extra = HANDLE_EXTRA_SIZE;
|
extra = HANDLE_EXTRA_SIZE;
|
||||||
|
@ -338,9 +338,8 @@ gesture_released (GtkGestureMultiPress *gesture,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (popover));
|
child = gtk_bin_get_child (GTK_BIN (popover));
|
||||||
gtk_widget_compute_bounds (child, GTK_WIDGET (popover), &child_bounds);
|
if (!gtk_widget_compute_bounds (child, GTK_WIDGET (popover), &child_bounds) ||
|
||||||
|
!graphene_rect_contains_point (&child_bounds,
|
||||||
if (!graphene_rect_contains_point (&child_bounds,
|
|
||||||
&(graphene_point_t){x, y}))
|
&(graphene_point_t){x, y}))
|
||||||
gtk_popover_popdown (popover);
|
gtk_popover_popdown (popover);
|
||||||
}
|
}
|
||||||
@ -2147,7 +2146,8 @@ gtk_popover_get_pointing_to (GtkPopover *popover,
|
|||||||
{
|
{
|
||||||
graphene_rect_t r;
|
graphene_rect_t r;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->widget, priv->widget, &r);
|
if (!gtk_widget_compute_bounds (priv->widget, priv->widget, &r))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
rect->x = floorf (r.origin.x);
|
rect->x = floorf (r.origin.x);
|
||||||
rect->y = floorf (r.origin.y);
|
rect->y = floorf (r.origin.y);
|
||||||
|
@ -920,14 +920,19 @@ gtk_range_get_range_rect (GtkRange *range,
|
|||||||
g_return_if_fail (GTK_IS_RANGE (range));
|
g_return_if_fail (GTK_IS_RANGE (range));
|
||||||
g_return_if_fail (range_rect != NULL);
|
g_return_if_fail (range_rect != NULL);
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->trough_widget, GTK_WIDGET (range), &r);
|
if (!gtk_widget_compute_bounds (priv->trough_widget, GTK_WIDGET (range), &r))
|
||||||
|
{
|
||||||
*range_rect = (GdkRectangle) {
|
*range_rect = (GdkRectangle) { 0, 0, 0, 0 };
|
||||||
floorf (r.origin.x),
|
}
|
||||||
floorf (r.origin.y),
|
else
|
||||||
ceilf (r.size.width),
|
{
|
||||||
ceilf (r.size.height),
|
*range_rect = (GdkRectangle) {
|
||||||
};
|
floorf (r.origin.x),
|
||||||
|
floorf (r.origin.y),
|
||||||
|
ceilf (r.size.width),
|
||||||
|
ceilf (r.size.height),
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -953,7 +958,14 @@ gtk_range_get_slider_range (GtkRange *range,
|
|||||||
|
|
||||||
g_return_if_fail (GTK_IS_RANGE (range));
|
g_return_if_fail (GTK_IS_RANGE (range));
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->slider_widget, GTK_WIDGET (range), &slider_bounds);
|
if (!gtk_widget_compute_bounds (priv->slider_widget, GTK_WIDGET (range), &slider_bounds))
|
||||||
|
{
|
||||||
|
if (slider_start)
|
||||||
|
*slider_start = 0;
|
||||||
|
if (slider_end)
|
||||||
|
*slider_end = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
||||||
{
|
{
|
||||||
@ -1745,7 +1757,8 @@ coord_to_value (GtkRange *range,
|
|||||||
gint slider_length;
|
gint slider_length;
|
||||||
graphene_rect_t slider_bounds;
|
graphene_rect_t slider_bounds;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->slider_widget, priv->slider_widget, &slider_bounds);
|
if (!gtk_widget_compute_bounds (priv->slider_widget, priv->slider_widget, &slider_bounds))
|
||||||
|
graphene_rect_init (&slider_bounds, 0, 0, gtk_widget_get_width (priv->trough_widget), gtk_widget_get_height (priv->trough_widget));
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
@ -1804,7 +1817,8 @@ gtk_range_key_controller_key_pressed (GtkEventControllerKey *controller,
|
|||||||
{
|
{
|
||||||
graphene_rect_t slider_bounds;
|
graphene_rect_t slider_bounds;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->slider_widget, priv->trough_widget, &slider_bounds);
|
if (!gtk_widget_compute_bounds (priv->slider_widget, priv->trough_widget, &slider_bounds))
|
||||||
|
return GDK_EVENT_STOP;
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
||||||
priv->slide_initial_slider_position = slider_bounds.origin.y;
|
priv->slide_initial_slider_position = slider_bounds.origin.y;
|
||||||
@ -1877,7 +1891,6 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
|
|||||||
guint button;
|
guint button;
|
||||||
GdkModifierType state_mask;
|
GdkModifierType state_mask;
|
||||||
GtkWidget *mouse_location;
|
GtkWidget *mouse_location;
|
||||||
graphene_rect_t slider_bounds;
|
|
||||||
|
|
||||||
if (!gtk_widget_has_focus (widget))
|
if (!gtk_widget_has_focus (widget))
|
||||||
gtk_widget_grab_focus (widget);
|
gtk_widget_grab_focus (widget);
|
||||||
@ -1891,8 +1904,6 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
|
|||||||
source_device = gdk_event_get_source_device ((GdkEvent *) event);
|
source_device = gdk_event_get_source_device ((GdkEvent *) event);
|
||||||
source = gdk_device_get_source (source_device);
|
source = gdk_device_get_source (source_device);
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->slider_widget, priv->slider_widget, &slider_bounds);
|
|
||||||
|
|
||||||
g_object_get (gtk_widget_get_settings (widget),
|
g_object_get (gtk_widget_get_settings (widget),
|
||||||
"gtk-primary-button-warps-slider", &primary_warps,
|
"gtk-primary-button-warps-slider", &primary_warps,
|
||||||
NULL);
|
NULL);
|
||||||
@ -1931,13 +1942,15 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
|
|||||||
(!primary_warps && button == GDK_BUTTON_MIDDLE)))
|
(!primary_warps && button == GDK_BUTTON_MIDDLE)))
|
||||||
{
|
{
|
||||||
int slider_range_x, slider_range_y;
|
int slider_range_x, slider_range_y;
|
||||||
|
graphene_rect_t slider_bounds;
|
||||||
|
|
||||||
gtk_widget_translate_coordinates (priv->trough_widget, widget,
|
gtk_widget_translate_coordinates (priv->trough_widget, widget,
|
||||||
priv->slider_x, priv->slider_y,
|
priv->slider_x, priv->slider_y,
|
||||||
&slider_range_x, &slider_range_y);
|
&slider_range_x, &slider_range_y);
|
||||||
|
|
||||||
/* If we aren't fixed, center on the slider. I.e. if this is not a scale... */
|
/* If we aren't fixed, center on the slider. I.e. if this is not a scale... */
|
||||||
if (!priv->slider_size_fixed)
|
if (!priv->slider_size_fixed &&
|
||||||
|
gtk_widget_compute_bounds (priv->slider_widget, priv->slider_widget, &slider_bounds))
|
||||||
{
|
{
|
||||||
slider_range_x += (slider_bounds.size.width / 2);
|
slider_range_x += (slider_bounds.size.width / 2);
|
||||||
slider_range_y += (slider_bounds.size.height / 2);
|
slider_range_y += (slider_bounds.size.height / 2);
|
||||||
@ -2012,6 +2025,7 @@ update_slider_position (GtkRange *range,
|
|||||||
gint mouse_y)
|
gint mouse_y)
|
||||||
{
|
{
|
||||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||||
|
graphene_rect_t trough_bounds;
|
||||||
gdouble delta;
|
gdouble delta;
|
||||||
gdouble c;
|
gdouble c;
|
||||||
gdouble new_value;
|
gdouble new_value;
|
||||||
@ -2025,17 +2039,15 @@ update_slider_position (GtkRange *range,
|
|||||||
gtk_widget_translate_coordinates (GTK_WIDGET (range), priv->trough_widget,
|
gtk_widget_translate_coordinates (GTK_WIDGET (range), priv->trough_widget,
|
||||||
mouse_x, mouse_y, &mouse_x, &mouse_y);
|
mouse_x, mouse_y, &mouse_x, &mouse_y);
|
||||||
|
|
||||||
if (priv->zoom)
|
if (priv->zoom &&
|
||||||
|
gtk_widget_compute_bounds (priv->trough_widget, priv->trough_widget, &trough_bounds))
|
||||||
{
|
{
|
||||||
graphene_rect_t trough_bounds;
|
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->trough_widget, priv->trough_widget, &trough_bounds);
|
|
||||||
|
|
||||||
zoom = MIN(1.0, (priv->orientation == GTK_ORIENTATION_VERTICAL ?
|
zoom = MIN(1.0, (priv->orientation == GTK_ORIENTATION_VERTICAL ?
|
||||||
trough_bounds.size.height : trough_bounds.size.width) /
|
trough_bounds.size.height : trough_bounds.size.width) /
|
||||||
(gtk_adjustment_get_upper (priv->adjustment) -
|
(gtk_adjustment_get_upper (priv->adjustment) -
|
||||||
gtk_adjustment_get_lower (priv->adjustment) -
|
gtk_adjustment_get_lower (priv->adjustment) -
|
||||||
gtk_adjustment_get_page_size (priv->adjustment)));
|
gtk_adjustment_get_page_size (priv->adjustment)));
|
||||||
|
|
||||||
/* the above is ineffective for scales, so just set a zoom factor */
|
/* the above is ineffective for scales, so just set a zoom factor */
|
||||||
if (zoom == 1.0)
|
if (zoom == 1.0)
|
||||||
zoom = 0.25;
|
zoom = 0.25;
|
||||||
@ -2048,7 +2060,8 @@ update_slider_position (GtkRange *range,
|
|||||||
{
|
{
|
||||||
graphene_rect_t slider_bounds;
|
graphene_rect_t slider_bounds;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->slider_widget, GTK_WIDGET (range), &slider_bounds);
|
if (!gtk_widget_compute_bounds (priv->slider_widget, GTK_WIDGET (range), &slider_bounds))
|
||||||
|
graphene_rect_init (&slider_bounds, 0, 0, 0, 0);
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
||||||
priv->slide_initial_slider_position = (zoom * (mouse_y - priv->slide_initial_coordinate_delta) - slider_bounds.origin.y) / (zoom - 1.0);
|
priv->slide_initial_slider_position = (zoom * (mouse_y - priv->slide_initial_coordinate_delta) - slider_bounds.origin.y) / (zoom - 1.0);
|
||||||
|
@ -336,7 +336,8 @@ gtk_scale_allocate_value (GtkScale *scale)
|
|||||||
range_height = gtk_widget_get_height (widget);
|
range_height = gtk_widget_get_height (widget);
|
||||||
|
|
||||||
slider_widget = gtk_range_get_slider_widget (range);
|
slider_widget = gtk_range_get_slider_widget (range);
|
||||||
gtk_widget_compute_bounds (slider_widget, widget, &slider_bounds);
|
if (!gtk_widget_compute_bounds (slider_widget, widget, &slider_bounds))
|
||||||
|
graphene_rect_init (&slider_bounds, 0, 0, gtk_widget_get_width (widget), gtk_widget_get_height (widget));
|
||||||
|
|
||||||
gtk_widget_measure (priv->value_widget,
|
gtk_widget_measure (priv->value_widget,
|
||||||
GTK_ORIENTATION_HORIZONTAL, -1,
|
GTK_ORIENTATION_HORIZONTAL, -1,
|
||||||
@ -1519,7 +1520,8 @@ gtk_scale_real_get_layout_offsets (GtkScale *scale,
|
|||||||
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
|
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
|
||||||
graphene_rect_t value_bounds;
|
graphene_rect_t value_bounds;
|
||||||
|
|
||||||
if (!priv->value_widget)
|
if (!priv->value_widget ||
|
||||||
|
!gtk_widget_compute_bounds (priv->value_widget, GTK_WIDGET (scale), &value_bounds))
|
||||||
{
|
{
|
||||||
*x = 0;
|
*x = 0;
|
||||||
*y = 0;
|
*y = 0;
|
||||||
@ -1527,7 +1529,6 @@ gtk_scale_real_get_layout_offsets (GtkScale *scale,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->value_widget, GTK_WIDGET (scale), &value_bounds);
|
|
||||||
|
|
||||||
*x = value_bounds.origin.x;
|
*x = value_bounds.origin.x;
|
||||||
*y = value_bounds.origin.y;
|
*y = value_bounds.origin.y;
|
||||||
|
@ -1046,7 +1046,8 @@ coords_close_to_indicator (GtkScrolledWindow *sw,
|
|||||||
graphene_rect_t indicator_bounds;
|
graphene_rect_t indicator_bounds;
|
||||||
gint distance;
|
gint distance;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (indicator->scrollbar, GTK_WIDGET (sw), &indicator_bounds);
|
if (!gtk_widget_compute_bounds (indicator->scrollbar, GTK_WIDGET (sw), &indicator_bounds))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (indicator->over)
|
if (indicator->over)
|
||||||
distance = INDICATOR_FAR_DISTANCE;
|
distance = INDICATOR_FAR_DISTANCE;
|
||||||
|
@ -191,7 +191,9 @@ gtk_switch_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
|
|||||||
GtkSwitchPrivate *priv = gtk_switch_get_instance_private (sw);
|
GtkSwitchPrivate *priv = gtk_switch_get_instance_private (sw);
|
||||||
graphene_rect_t switch_bounds;
|
graphene_rect_t switch_bounds;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (GTK_WIDGET (sw), GTK_WIDGET (sw), &switch_bounds);
|
if (!gtk_widget_compute_bounds (GTK_WIDGET (sw), GTK_WIDGET (sw), &switch_bounds))
|
||||||
|
return;
|
||||||
|
|
||||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
||||||
|
|
||||||
/* If the press didn't happen in the draggable handle,
|
/* If the press didn't happen in the draggable handle,
|
||||||
|
@ -585,11 +585,17 @@ gtk_tooltip_position (GtkTooltip *tooltip,
|
|||||||
tooltip->tooltip_widget = new_tooltip_widget;
|
tooltip->tooltip_widget = new_tooltip_widget;
|
||||||
|
|
||||||
toplevel = _gtk_widget_get_toplevel (new_tooltip_widget);
|
toplevel = _gtk_widget_get_toplevel (new_tooltip_widget);
|
||||||
gtk_widget_compute_bounds (new_tooltip_widget, toplevel, &anchor_bounds);
|
if (gtk_widget_compute_bounds (new_tooltip_widget, toplevel, &anchor_bounds))
|
||||||
anchor_rect = (GdkRectangle) {
|
{
|
||||||
floorf (anchor_bounds.origin.x), floorf (anchor_bounds.origin.y),
|
anchor_rect = (GdkRectangle) {
|
||||||
ceilf (anchor_bounds.size.width), ceilf (anchor_bounds.size.height)
|
floorf (anchor_bounds.origin.x), floorf (anchor_bounds.origin.y),
|
||||||
};
|
ceilf (anchor_bounds.size.width), ceilf (anchor_bounds.size.height)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
anchor_rect = (GdkRectangle) { 0, 0, 0, 0 };
|
||||||
|
}
|
||||||
|
|
||||||
settings = gtk_settings_get_for_display (display);
|
settings = gtk_settings_get_for_display (display);
|
||||||
g_object_get (settings,
|
g_object_get (settings,
|
||||||
|
@ -3060,7 +3060,8 @@ _gtk_tree_view_column_coords_in_resize_rect (GtkTreeViewColumn *column,
|
|||||||
!priv->visible)
|
!priv->visible)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (priv->button, priv->tree_view, &button_bounds);
|
if (!gtk_widget_compute_bounds (priv->button, priv->tree_view, &button_bounds))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (gtk_widget_get_direction (priv->tree_view) == GTK_TEXT_DIR_LTR)
|
if (gtk_widget_get_direction (priv->tree_view) == GTK_TEXT_DIR_LTR)
|
||||||
button_bounds.origin.x += button_bounds.size.width - TREE_VIEW_DRAG_WIDTH;
|
button_bounds.origin.x += button_bounds.size.width - TREE_VIEW_DRAG_WIDTH;
|
||||||
|
@ -2544,10 +2544,11 @@ _gtk_widget_emulate_press (GtkWidget *widget,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
gdk_event_get_coords (event, &x, &y);
|
gdk_event_get_coords (event, &x, &y);
|
||||||
gtk_widget_compute_point (event_widget,
|
if (!gtk_widget_compute_point (event_widget,
|
||||||
gtk_widget_get_toplevel (event_widget),
|
gtk_widget_get_toplevel (event_widget),
|
||||||
&GRAPHENE_POINT_INIT (x, y),
|
&GRAPHENE_POINT_INIT (x, y),
|
||||||
&p);
|
&p))
|
||||||
|
return;
|
||||||
|
|
||||||
if (event->any.type == GDK_TOUCH_BEGIN ||
|
if (event->any.type == GDK_TOUCH_BEGIN ||
|
||||||
event->any.type == GDK_TOUCH_UPDATE ||
|
event->any.type == GDK_TOUCH_UPDATE ||
|
||||||
@ -3863,13 +3864,19 @@ gtk_widget_get_surface_allocation (GtkWidget *widget,
|
|||||||
|
|
||||||
g_assert (GTK_IS_WINDOW (parent) || GTK_IS_POPOVER (parent));
|
g_assert (GTK_IS_WINDOW (parent) || GTK_IS_POPOVER (parent));
|
||||||
|
|
||||||
gtk_widget_compute_bounds (widget, parent, &bounds);
|
if (gtk_widget_compute_bounds (widget, parent, &bounds))
|
||||||
*allocation = (GtkAllocation){
|
{
|
||||||
floorf (bounds.origin.x),
|
*allocation = (GtkAllocation){
|
||||||
floorf (bounds.origin.y),
|
floorf (bounds.origin.x),
|
||||||
ceilf (bounds.size.width),
|
floorf (bounds.origin.y),
|
||||||
ceilf (bounds.size.height)
|
ceilf (bounds.size.width),
|
||||||
};
|
ceilf (bounds.size.height)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*allocation = (GtkAllocation) { 0, 0, 0, 0 };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -5120,9 +5127,9 @@ _gtk_widget_run_controllers (GtkWidget *widget,
|
|||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
translate_event_coordinates (GdkEvent *event,
|
translate_event_coordinates (GdkEvent *event,
|
||||||
GtkWidget *widget);
|
GtkWidget *widget);
|
||||||
gboolean
|
gboolean
|
||||||
_gtk_widget_captured_event (GtkWidget *widget,
|
_gtk_widget_captured_event (GtkWidget *widget,
|
||||||
const GdkEvent *event)
|
const GdkEvent *event)
|
||||||
@ -5138,7 +5145,11 @@ _gtk_widget_captured_event (GtkWidget *widget,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
event_copy = gdk_event_copy (event);
|
event_copy = gdk_event_copy (event);
|
||||||
translate_event_coordinates (event_copy, widget);
|
if (!translate_event_coordinates (event_copy, widget))
|
||||||
|
{
|
||||||
|
g_object_unref (event_copy);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return_val = _gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_CAPTURE);
|
return_val = _gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_CAPTURE);
|
||||||
|
|
||||||
@ -5196,7 +5207,7 @@ event_surface_is_still_viewable (const GdkEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
translate_event_coordinates (GdkEvent *event,
|
translate_event_coordinates (GdkEvent *event,
|
||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
{
|
{
|
||||||
@ -5205,16 +5216,19 @@ translate_event_coordinates (GdkEvent *event,
|
|||||||
graphene_point_t p;
|
graphene_point_t p;
|
||||||
|
|
||||||
if (!gdk_event_get_coords (event, &x, &y))
|
if (!gdk_event_get_coords (event, &x, &y))
|
||||||
return;
|
return TRUE;
|
||||||
|
|
||||||
event_widget = gtk_get_event_widget (event);
|
event_widget = gtk_get_event_widget (event);
|
||||||
|
|
||||||
gtk_widget_compute_point (event_widget,
|
if (!gtk_widget_compute_point (event_widget,
|
||||||
widget,
|
widget,
|
||||||
&GRAPHENE_POINT_INIT (x, y),
|
&GRAPHENE_POINT_INIT (x, y),
|
||||||
&p);
|
&p))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
gdk_event_set_coords (event, p.x, p.y);
|
gdk_event_set_coords (event, p.x, p.y);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -5237,7 +5251,11 @@ gtk_widget_event_internal (GtkWidget *widget,
|
|||||||
|
|
||||||
event_copy = gdk_event_copy (event);
|
event_copy = gdk_event_copy (event);
|
||||||
|
|
||||||
translate_event_coordinates (event_copy, widget);
|
if (!translate_event_coordinates (event_copy, widget))
|
||||||
|
{
|
||||||
|
g_object_unref (event_copy);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (widget == gtk_get_event_target (event_copy))
|
if (widget == gtk_get_event_target (event_copy))
|
||||||
return_val |= _gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_TARGET);
|
return_val |= _gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_TARGET);
|
||||||
|
@ -80,8 +80,9 @@ tab_sort_func (gconstpointer a,
|
|||||||
GtkTextDirection text_direction = GPOINTER_TO_INT (user_data);
|
GtkTextDirection text_direction = GPOINTER_TO_INT (user_data);
|
||||||
float y1, y2;
|
float y1, y2;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (child1, gtk_widget_get_parent (child1), &child_bounds1);
|
if (!gtk_widget_compute_bounds (child1, gtk_widget_get_parent (child1), &child_bounds1) ||
|
||||||
gtk_widget_compute_bounds (child2, gtk_widget_get_parent (child2), &child_bounds2);
|
!gtk_widget_compute_bounds (child2, gtk_widget_get_parent (child2), &child_bounds2))
|
||||||
|
return 0;
|
||||||
|
|
||||||
y1 = child_bounds1.origin.y + (child_bounds1.size.height / 2.0f);
|
y1 = child_bounds1.origin.y + (child_bounds1.size.height / 2.0f);
|
||||||
y2 = child_bounds2.origin.y + (child_bounds2.size.height / 2.0f);
|
y2 = child_bounds2.origin.y + (child_bounds2.size.height / 2.0f);
|
||||||
@ -178,8 +179,9 @@ axis_compare (gconstpointer a,
|
|||||||
int start1, end1;
|
int start1, end1;
|
||||||
int start2, end2;
|
int start2, end2;
|
||||||
|
|
||||||
gtk_widget_compute_bounds (*((GtkWidget **)a), compare->widget, &bounds1);
|
if (!gtk_widget_compute_bounds (*((GtkWidget **)a), compare->widget, &bounds1) ||
|
||||||
gtk_widget_compute_bounds (*((GtkWidget **)b), compare->widget, &bounds2);
|
!gtk_widget_compute_bounds (*((GtkWidget **)b), compare->widget, &bounds2))
|
||||||
|
return 0;
|
||||||
|
|
||||||
get_axis_info (&bounds1, compare->axis, &start1, &end1);
|
get_axis_info (&bounds1, compare->axis, &start1, &end1);
|
||||||
get_axis_info (&bounds2, compare->axis, &start2, &end2);
|
get_axis_info (&bounds2, compare->axis, &start2, &end2);
|
||||||
@ -278,7 +280,8 @@ focus_sort_left_right (GtkWidget *widget,
|
|||||||
graphene_rect_t old_focus_bounds;
|
graphene_rect_t old_focus_bounds;
|
||||||
|
|
||||||
parent = gtk_widget_get_parent (widget);
|
parent = gtk_widget_get_parent (widget);
|
||||||
gtk_widget_compute_bounds (widget, parent ? parent : widget, &bounds);
|
if (!gtk_widget_compute_bounds (widget, parent ? parent : widget, &bounds))
|
||||||
|
graphene_rect_init (&bounds, 0, 0, 0, 0);
|
||||||
|
|
||||||
if (old_focus_coords (widget, &old_focus_bounds))
|
if (old_focus_coords (widget, &old_focus_bounds))
|
||||||
{
|
{
|
||||||
@ -379,7 +382,8 @@ focus_sort_up_down (GtkWidget *widget,
|
|||||||
graphene_rect_t old_focus_bounds;
|
graphene_rect_t old_focus_bounds;
|
||||||
|
|
||||||
parent = gtk_widget_get_parent (widget);
|
parent = gtk_widget_get_parent (widget);
|
||||||
gtk_widget_compute_bounds (widget, parent ? parent : widget, &bounds);
|
if (!gtk_widget_compute_bounds (widget, parent ? parent : widget, &bounds))
|
||||||
|
graphene_rect_init (&bounds, 0, 0, 0, 0);
|
||||||
|
|
||||||
if (old_focus_coords (widget, &old_focus_bounds))
|
if (old_focus_coords (widget, &old_focus_bounds))
|
||||||
{
|
{
|
||||||
|
@ -96,11 +96,17 @@ gtk_widget_paintable_paintable_snapshot (GdkPaintable *paintable,
|
|||||||
|
|
||||||
gtk_snapshot_push_clip (snapshot,
|
gtk_snapshot_push_clip (snapshot,
|
||||||
&GRAPHENE_RECT_INIT(0, 0, width, height));
|
&GRAPHENE_RECT_INIT(0, 0, width, height));
|
||||||
gtk_widget_compute_bounds (self->widget, self->widget, &bounds);
|
if (gtk_widget_compute_bounds (self->widget, self->widget, &bounds))
|
||||||
graphene_matrix_init_from_2d (&transform,
|
{
|
||||||
width / bounds.size.width, 0.0,
|
graphene_matrix_init_from_2d (&transform,
|
||||||
0.0, height / bounds.size.height,
|
width / bounds.size.width, 0.0,
|
||||||
bounds.origin.x, bounds.origin.y);
|
0.0, height / bounds.size.height,
|
||||||
|
bounds.origin.x, bounds.origin.y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
graphene_matrix_init_identity (&transform);
|
||||||
|
}
|
||||||
gtk_snapshot_push_transform (snapshot, &transform);
|
gtk_snapshot_push_transform (snapshot, &transform);
|
||||||
|
|
||||||
gtk_widget_snapshot (self->widget, snapshot);
|
gtk_widget_snapshot (self->widget, snapshot);
|
||||||
@ -269,7 +275,8 @@ gtk_widget_paintable_snapshot_widget (GtkWidgetPaintable *self)
|
|||||||
if (self->widget == NULL)
|
if (self->widget == NULL)
|
||||||
return gdk_paintable_new_empty (0, 0);
|
return gdk_paintable_new_empty (0, 0);
|
||||||
|
|
||||||
gtk_widget_compute_bounds (self->widget, self->widget, &bounds);
|
if (!gtk_widget_compute_bounds (self->widget, self->widget, &bounds))
|
||||||
|
return gdk_paintable_new_empty (0, 0);
|
||||||
|
|
||||||
if (self->widget->priv->render_node == NULL)
|
if (self->widget->priv->render_node == NULL)
|
||||||
return gdk_paintable_new_empty (bounds.size.width, bounds.size.height);
|
return gdk_paintable_new_empty (bounds.size.width, bounds.size.height);
|
||||||
|
@ -158,6 +158,7 @@ gtk_fps_overlay_snapshot (GtkInspectorOverlay *overlay,
|
|||||||
double fps;
|
double fps;
|
||||||
char *fps_string;
|
char *fps_string;
|
||||||
graphene_rect_t bounds;
|
graphene_rect_t bounds;
|
||||||
|
gboolean has_bounds;
|
||||||
int width, height;
|
int width, height;
|
||||||
double overlay_opacity;
|
double overlay_opacity;
|
||||||
|
|
||||||
@ -202,20 +203,20 @@ gtk_fps_overlay_snapshot (GtkInspectorOverlay *overlay,
|
|||||||
if (GTK_IS_WINDOW (widget))
|
if (GTK_IS_WINDOW (widget))
|
||||||
{
|
{
|
||||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
||||||
if (child)
|
if (!child ||
|
||||||
gtk_widget_compute_bounds (child, widget, &bounds);
|
!gtk_widget_compute_bounds (child, widget, &bounds))
|
||||||
else
|
has_bounds = gtk_widget_compute_bounds (widget, widget, &bounds);
|
||||||
gtk_widget_compute_bounds (widget, widget, &bounds);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_widget_compute_bounds (widget, widget, &bounds);
|
has_bounds = gtk_widget_compute_bounds (widget, widget, &bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
layout = gtk_widget_create_pango_layout (widget, fps_string);
|
layout = gtk_widget_create_pango_layout (widget, fps_string);
|
||||||
pango_layout_get_pixel_size (layout, &width, &height);
|
pango_layout_get_pixel_size (layout, &width, &height);
|
||||||
|
|
||||||
gtk_snapshot_offset (snapshot, bounds.origin.x + bounds.size.width - width, bounds.origin.y);
|
if (has_bounds)
|
||||||
|
gtk_snapshot_offset (snapshot, bounds.origin.x + bounds.size.width - width, bounds.origin.y);
|
||||||
if (overlay_opacity < 1.0)
|
if (overlay_opacity < 1.0)
|
||||||
gtk_snapshot_push_opacity (snapshot, overlay_opacity);
|
gtk_snapshot_push_opacity (snapshot, overlay_opacity);
|
||||||
gtk_snapshot_append_color (snapshot,
|
gtk_snapshot_append_color (snapshot,
|
||||||
@ -226,7 +227,8 @@ gtk_fps_overlay_snapshot (GtkInspectorOverlay *overlay,
|
|||||||
&(GdkRGBA) { 1, 1, 1, 1 });
|
&(GdkRGBA) { 1, 1, 1, 1 });
|
||||||
if (overlay_opacity < 1.0)
|
if (overlay_opacity < 1.0)
|
||||||
gtk_snapshot_pop (snapshot);
|
gtk_snapshot_pop (snapshot);
|
||||||
gtk_snapshot_offset (snapshot, - bounds.origin.x - bounds.size.width + width, - bounds.origin.y);
|
if (has_bounds)
|
||||||
|
gtk_snapshot_offset (snapshot, - bounds.origin.x - bounds.size.width + width, - bounds.origin.y);
|
||||||
g_free (fps_string);
|
g_free (fps_string);
|
||||||
|
|
||||||
gtk_widget_add_tick_callback (widget, gtk_fps_overlay_force_redraw, NULL, NULL);
|
gtk_widget_add_tick_callback (widget, gtk_fps_overlay_force_redraw, NULL, NULL);
|
||||||
|
@ -153,10 +153,10 @@ gtk_transform_tester_snapshot (GtkWidget *widget,
|
|||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_transform_tester_parent_class)->snapshot (widget, snapshot);
|
GTK_WIDGET_CLASS (gtk_transform_tester_parent_class)->snapshot (widget, snapshot);
|
||||||
|
|
||||||
if (!do_picking)
|
if (!do_picking ||
|
||||||
|
!gtk_widget_compute_bounds (self->test_widget, widget, &child_bounds) ||
|
||||||
|
!gtk_widget_compute_bounds (self->test_widget, self->test_widget, &self_bounds))
|
||||||
return;
|
return;
|
||||||
gtk_widget_compute_bounds (self->test_widget, widget, &child_bounds);
|
|
||||||
gtk_widget_compute_bounds (self->test_widget, self->test_widget, &self_bounds);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
const struct {
|
const struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user