diff --git a/.gitignore b/.gitignore index 987db1ee8..e0147ae05 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ data/gnome-shell-wayland.desktop.in data/gnome-shell-extension-prefs.desktop data/gnome-shell-extension-prefs.desktop.in data/gschemas.compiled +data/perf-background.xml data/org.gnome.shell.gschema.xml data/org.gnome.shell.gschema.valid data/org.gnome.shell.evolution.calendar.gschema.xml diff --git a/data/Makefile.am b/data/Makefile.am index 1befb87c0..65f948aea 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -74,6 +74,13 @@ dist_theme_DATA = \ theme/ws-switch-arrow-up.png \ theme/ws-switch-arrow-down.png +backgrounddir = $(pkgdatadir) +background_DATA = perf-background.xml + +perf-background.xml: perf-background.xml.in + $(AM_V_GEN) sed -e "s|@datadir[@]|$(datadir)|" \ + $< > $@ || rm $@ + keysdir = @GNOME_KEYBINDINGS_KEYSDIR@ keys_in_files = 50-gnome-shell-system.xml.in keys_DATA = $(keys_in_files:.xml.in=.xml) @@ -106,6 +113,7 @@ EXTRA_DIST = \ $(menu_DATA) \ $(convert_DATA) \ $(keys_in_files) \ + perf-background.xml.in \ org.gnome.Shell.PortalHelper.desktop.in \ org.gnome.Shell.PortalHelper.service.in \ org.gnome.shell.gschema.xml.in.in @@ -117,6 +125,7 @@ CLEANFILES += \ $(desktop_DATA) \ $(keys_DATA) \ $(gsettings_SCHEMAS) \ + perf-background.xml \ gschemas.compiled \ org.gnome.shell.gschema.valid \ org.gnome.shell.gschema.xml.in diff --git a/data/perf-background.xml.in b/data/perf-background.xml.in new file mode 100644 index 000000000..752a55226 --- /dev/null +++ b/data/perf-background.xml.in @@ -0,0 +1,31 @@ + + + + 1990 + 1 + 1 + 0 + 00 + 00 + + + + +1261440000.0 +@datadir@/backgrounds/gnome/adwaita-morning.jpg +@datadir@/backgrounds/gnome/adwaita-day.jpg + + + + +60 +/usr/share/backgrounds/gnome/Sandstone.jpg + + + diff --git a/js/ui/background.js b/js/ui/background.js index 021269989..3fe0b7a02 100644 --- a/js/ui/background.js +++ b/js/ui/background.js @@ -311,7 +311,8 @@ const Background = new Lang.Class({ params = Params.parse(params, { monitorIndex: 0, layoutManager: Main.layoutManager, effects: Meta.BackgroundEffects.NONE, - settings: null }); + settings: null, + overrideImage: null }); this.actor = new Meta.BackgroundGroup(); this.actor._delegate = this; @@ -319,6 +320,7 @@ const Background = new Lang.Class({ Lang.bind(this, this._destroy)); this._settings = params.settings; + this._overrideImage = params.overrideImage; this._monitorIndex = params.monitorIndex; this._layoutManager = params.layoutManager; this._effects = params.effects; @@ -582,18 +584,23 @@ const Background = new Lang.Class({ this._loadPattern(); - this._style = this._settings.get_enum(BACKGROUND_STYLE_KEY); - if (this._style == GDesktopEnums.BackgroundStyle.NONE) { - this._setLoaded(); - return; - } - - let uri = this._settings.get_string(PICTURE_URI_KEY); let filename; - if (GLib.uri_parse_scheme(uri) != null) - filename = Gio.File.new_for_uri(uri).get_path(); - else - filename = uri; + if (this._overrideImage != null) { + filename = this._overrideImage; + this._style = GDesktopEnums.BackgroundStyle.WALLPAPER; // Hardcode + } else { + this._style = this._settings.get_enum(BACKGROUND_STYLE_KEY); + if (this._style == GDesktopEnums.BackgroundStyle.NONE) { + this._setLoaded(); + return; + } + + let uri = this._settings.get_string(PICTURE_URI_KEY); + if (GLib.uri_parse_scheme(uri) != null) + filename = Gio.File.new_for_uri(uri).get_path(); + else + filename = uri; + } if (!filename) { this._setLoaded(); @@ -728,6 +735,8 @@ const BackgroundManager = new Lang.Class({ controlPosition: true, settingsSchema: BACKGROUND_SCHEMA }); + // Allow override the background image setting for performance testing + this._overrideImage = GLib.getenv('SHELL_BACKGROUND_IMAGE'); this._settings = new Gio.Settings({ schema_id: params.settingsSchema }); this._container = params.container; this._layoutManager = params.layoutManager; @@ -789,7 +798,8 @@ const BackgroundManager = new Lang.Class({ let background = new Background({ monitorIndex: this._monitorIndex, layoutManager: this._layoutManager, effects: this._effects, - settings: this._settings }); + settings: this._settings, + overrideImage: this._overrideImage }); this._container.add_child(background.actor); let monitor = this._layoutManager.monitors[this._monitorIndex]; diff --git a/src/gnome-shell-perf-tool.in b/src/gnome-shell-perf-tool.in index 07374f6e8..3bb32dd50 100644 --- a/src/gnome-shell-perf-tool.in +++ b/src/gnome-shell-perf-tool.in @@ -82,6 +82,9 @@ def start_shell(perf_output=None): if perf_output is not None: env['SHELL_PERF_OUTPUT'] = perf_output + # A fixed background image + env['SHELL_BACKGROUND_IMAGE'] = '@pkgdatadir@/perf-background.xml' + self_dir = os.path.dirname(os.path.abspath(sys.argv[0])) args = [] args.append(os.path.join(self_dir, 'gnome-shell'))