st/widget: Remove get_resource_scale function

ClutterActor provides the same function, but with a different return
value. So since we already switched to the ClutterActor implementation
in our C code, we can now safely remove st_widget_get_resource_scale()
and update the JS code that's still using the old API.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1287
This commit is contained in:
Jonas Dreßler 2020-05-28 14:47:17 +02:00 committed by Jonas Ådahl
parent 1524abc947
commit d885486397
4 changed files with 3 additions and 30 deletions

View File

@ -810,8 +810,8 @@ var LoginDialog = GObject.registerClass({
return; return;
this._logoBin.destroy_all_children(); this._logoBin.destroy_all_children();
const [valid, resourceScale] = this._logoBin.get_resource_scale(); const resourceScale = this._logoBin.get_resource_scale();
if (this._logoFile && valid) { if (this._logoFile) {
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
this._logoBin.add_child(this._textureCache.load_file_async(this._logoFile, this._logoBin.add_child(this._textureCache.load_file_async(this._logoFile,
-1, -1, -1, -1,

View File

@ -60,7 +60,7 @@ class Animation extends St.Bin {
} }
_loadFile(file, width, height) { _loadFile(file, width, height) {
let [validResourceScale, resourceScale] = this.get_resource_scale(); const resourceScale = this.get_resource_scale();
let wasPlaying = this._isPlaying; let wasPlaying = this._isPlaying;
if (this._isPlaying) if (this._isPlaying)
@ -69,12 +69,6 @@ class Animation extends St.Bin {
this._isLoaded = false; this._isLoaded = false;
this.destroy_all_children(); this.destroy_all_children();
if (!validResourceScale) {
if (wasPlaying)
this.play();
return;
}
let textureCache = St.TextureCache.get_default(); let textureCache = St.TextureCache.get_default();
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
this._animations = textureCache.load_sliced_image(file, width, height, this._animations = textureCache.load_sliced_image(file, width, height,

View File

@ -1399,25 +1399,6 @@ st_widget_get_style (StWidget *actor)
return ST_WIDGET_PRIVATE (actor)->inline_style; return ST_WIDGET_PRIVATE (actor)->inline_style;
} }
/**
* st_widget_get_resource_scale:
* @widget: A #StWidget
* @resource_scale: (out): return location for the resource scale
*
* Retrieves the resource scale for this #StWidget, if available.
*
* The resource scale refers to the scale the actor should use for its resources.
*/
gboolean
st_widget_get_resource_scale (StWidget *widget,
float *resource_scale)
{
if (resource_scale)
*resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (widget));
return TRUE;
}
static void static void
st_widget_set_first_visible_child (StWidget *widget, st_widget_set_first_visible_child (StWidget *widget,
ClutterActor *actor) ClutterActor *actor)

View File

@ -134,8 +134,6 @@ StThemeNode * st_widget_peek_theme_node (StWidget *widg
GList * st_widget_get_focus_chain (StWidget *widget); GList * st_widget_get_focus_chain (StWidget *widget);
void st_widget_paint_background (StWidget *widget, void st_widget_paint_background (StWidget *widget,
ClutterPaintContext *paint_context); ClutterPaintContext *paint_context);
gboolean st_widget_get_resource_scale (StWidget *widget,
float *resource_scale);
/* debug methods */ /* debug methods */
char *st_describe_actor (ClutterActor *actor); char *st_describe_actor (ClutterActor *actor);