Use new clutter_actor_get_resource_scale() API
Update the existing users of clutter_actor_get_resource_scale() to the new API which doesn't return a boolean value. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1287
This commit is contained in:
parent
140ab4dec1
commit
cb9842e4a4
@ -393,8 +393,7 @@ grab_window_screenshot (ClutterActor *stage,
|
|||||||
if (meta_window_get_client_type (window) == META_WINDOW_CLIENT_TYPE_WAYLAND)
|
if (meta_window_get_client_type (window) == META_WINDOW_CLIENT_TYPE_WAYLAND)
|
||||||
{
|
{
|
||||||
float resource_scale;
|
float resource_scale;
|
||||||
if (!clutter_actor_get_resource_scale (window_actor, &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (window_actor);
|
||||||
resource_scale = 1.0f;
|
|
||||||
|
|
||||||
cairo_surface_set_device_scale (priv->image, resource_scale, resource_scale);
|
cairo_surface_set_device_scale (priv->image, resource_scale, resource_scale);
|
||||||
}
|
}
|
||||||
|
@ -85,12 +85,7 @@ st_drawing_area_allocate (ClutterActor *self,
|
|||||||
int width, height;
|
int width, height;
|
||||||
float resource_scale;
|
float resource_scale;
|
||||||
|
|
||||||
if (!st_widget_get_resource_scale (ST_WIDGET (self), &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (self);
|
||||||
{
|
|
||||||
ClutterActorBox empty = CLUTTER_ACTOR_BOX_INIT_ZERO;
|
|
||||||
clutter_actor_set_allocation (self, &empty);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
clutter_actor_set_allocation (self, box);
|
clutter_actor_set_allocation (self, box);
|
||||||
st_theme_node_get_content_box (theme_node, box, &content_box);
|
st_theme_node_get_content_box (theme_node, box, &content_box);
|
||||||
@ -116,7 +111,7 @@ st_drawing_area_resource_scale_changed (StWidget *self)
|
|||||||
float resource_scale;
|
float resource_scale;
|
||||||
ClutterContent *content = clutter_actor_get_content (CLUTTER_ACTOR (self));
|
ClutterContent *content = clutter_actor_get_content (CLUTTER_ACTOR (self));
|
||||||
|
|
||||||
if (st_widget_get_resource_scale (ST_WIDGET (self), &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (self));
|
||||||
clutter_canvas_set_scale_factor (CLUTTER_CANVAS (content), resource_scale);
|
clutter_canvas_set_scale_factor (CLUTTER_CANVAS (content), resource_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,15 +210,10 @@ st_drawing_area_get_surface_size (StDrawingArea *area,
|
|||||||
content = clutter_actor_get_content (CLUTTER_ACTOR (area));
|
content = clutter_actor_get_content (CLUTTER_ACTOR (area));
|
||||||
clutter_content_get_preferred_size (content, &w, &h);
|
clutter_content_get_preferred_size (content, &w, &h);
|
||||||
|
|
||||||
if (st_widget_get_resource_scale (ST_WIDGET (area), &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (area));
|
||||||
{
|
|
||||||
w /= resource_scale;
|
w /= resource_scale;
|
||||||
h /= resource_scale;
|
h /= resource_scale;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
w = h = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (width)
|
if (width)
|
||||||
*width = ceilf (w);
|
*width = ceilf (w);
|
||||||
|
@ -425,8 +425,7 @@ st_icon_update (StIcon *icon)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!st_widget_get_resource_scale (ST_WIDGET (icon), &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (icon));
|
||||||
return;
|
|
||||||
|
|
||||||
theme_node = st_widget_peek_theme_node (ST_WIDGET (icon));
|
theme_node = st_widget_peek_theme_node (ST_WIDGET (icon));
|
||||||
if (theme_node == NULL)
|
if (theme_node == NULL)
|
||||||
|
@ -200,17 +200,16 @@ st_label_paint (ClutterActor *actor,
|
|||||||
st_widget_paint_background (ST_WIDGET (actor), paint_context);
|
st_widget_paint_background (ST_WIDGET (actor), paint_context);
|
||||||
|
|
||||||
if (shadow_spec)
|
if (shadow_spec)
|
||||||
{
|
|
||||||
float resource_scale;
|
|
||||||
|
|
||||||
if (clutter_actor_get_resource_scale (priv->label, &resource_scale))
|
|
||||||
{
|
{
|
||||||
ClutterActorBox allocation;
|
ClutterActorBox allocation;
|
||||||
float width, height;
|
float width, height;
|
||||||
|
float resource_scale;
|
||||||
|
|
||||||
clutter_actor_get_allocation_box (priv->label, &allocation);
|
clutter_actor_get_allocation_box (priv->label, &allocation);
|
||||||
clutter_actor_box_get_size (&allocation, &width, &height);
|
clutter_actor_box_get_size (&allocation, &width, &height);
|
||||||
|
|
||||||
|
resource_scale = clutter_actor_get_resource_scale (priv->label);
|
||||||
|
|
||||||
width *= resource_scale;
|
width *= resource_scale;
|
||||||
height *= resource_scale;
|
height *= resource_scale;
|
||||||
|
|
||||||
@ -240,7 +239,6 @@ st_label_paint (ClutterActor *actor,
|
|||||||
clutter_actor_get_paint_opacity (priv->label));
|
clutter_actor_get_paint_opacity (priv->label));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
clutter_actor_paint (priv->label, paint_context);
|
clutter_actor_paint (priv->label, paint_context);
|
||||||
}
|
}
|
||||||
|
@ -461,8 +461,7 @@ _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec,
|
|||||||
if (width == 0 || height == 0)
|
if (width == 0 || height == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!clutter_actor_get_resource_scale (actor, &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (actor);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
width = ceilf (width * resource_scale);
|
width = ceilf (width * resource_scale);
|
||||||
height = ceilf (height * resource_scale);
|
height = ceilf (height * resource_scale);
|
||||||
|
@ -412,8 +412,7 @@ st_widget_paint_background (StWidget *widget,
|
|||||||
float resource_scale;
|
float resource_scale;
|
||||||
guint8 opacity;
|
guint8 opacity;
|
||||||
|
|
||||||
if (!st_widget_get_resource_scale (widget, &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (widget));
|
||||||
return;
|
|
||||||
|
|
||||||
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
||||||
theme_node = st_widget_get_theme_node (widget);
|
theme_node = st_widget_get_theme_node (widget);
|
||||||
@ -1413,8 +1412,10 @@ gboolean
|
|||||||
st_widget_get_resource_scale (StWidget *widget,
|
st_widget_get_resource_scale (StWidget *widget,
|
||||||
float *resource_scale)
|
float *resource_scale)
|
||||||
{
|
{
|
||||||
return clutter_actor_get_resource_scale (CLUTTER_ACTOR (widget),
|
if (resource_scale)
|
||||||
resource_scale);
|
*resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (widget));
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user