From d88548639757c9c38726a0797d9a5fc773e8bee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Thu, 28 May 2020 14:47:17 +0200 Subject: [PATCH] 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 --- js/gdm/loginDialog.js | 4 ++-- js/ui/animation.js | 8 +------- src/st/st-widget.c | 19 ------------------- src/st/st-widget.h | 2 -- 4 files changed, 3 insertions(+), 30 deletions(-) diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index 4246b8616..46ddc51f5 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -810,8 +810,8 @@ var LoginDialog = GObject.registerClass({ return; this._logoBin.destroy_all_children(); - const [valid, resourceScale] = this._logoBin.get_resource_scale(); - if (this._logoFile && valid) { + const resourceScale = this._logoBin.get_resource_scale(); + if (this._logoFile) { let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; this._logoBin.add_child(this._textureCache.load_file_async(this._logoFile, -1, -1, diff --git a/js/ui/animation.js b/js/ui/animation.js index fa8cad932..5cb3a83c1 100644 --- a/js/ui/animation.js +++ b/js/ui/animation.js @@ -60,7 +60,7 @@ class Animation extends St.Bin { } _loadFile(file, width, height) { - let [validResourceScale, resourceScale] = this.get_resource_scale(); + const resourceScale = this.get_resource_scale(); let wasPlaying = this._isPlaying; if (this._isPlaying) @@ -69,12 +69,6 @@ class Animation extends St.Bin { this._isLoaded = false; this.destroy_all_children(); - if (!validResourceScale) { - if (wasPlaying) - this.play(); - return; - } - let textureCache = St.TextureCache.get_default(); let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; this._animations = textureCache.load_sliced_image(file, width, height, diff --git a/src/st/st-widget.c b/src/st/st-widget.c index c8bc9edef..6fd7a11a9 100644 --- a/src/st/st-widget.c +++ b/src/st/st-widget.c @@ -1399,25 +1399,6 @@ st_widget_get_style (StWidget *actor) 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 st_widget_set_first_visible_child (StWidget *widget, ClutterActor *actor) diff --git a/src/st/st-widget.h b/src/st/st-widget.h index 99644d786..9a4d28fb1 100644 --- a/src/st/st-widget.h +++ b/src/st/st-widget.h @@ -134,8 +134,6 @@ StThemeNode * st_widget_peek_theme_node (StWidget *widg GList * st_widget_get_focus_chain (StWidget *widget); void st_widget_paint_background (StWidget *widget, ClutterPaintContext *paint_context); -gboolean st_widget_get_resource_scale (StWidget *widget, - float *resource_scale); /* debug methods */ char *st_describe_actor (ClutterActor *actor);