Skip to content

Commit 63bed61

Browse files
committed
appIndicator: Simplify the image content bytes check
1 parent 4e91374 commit 63bed61

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

appIndicator.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import St from 'gi://St';
2323

2424
import * as Params from 'resource:///org/gnome/shell/misc/params.js';
2525
import * as Signals from 'resource:///org/gnome/shell/misc/signals.js';
26-
import * as Config from 'resource:///org/gnome/shell/misc/config.js';
2726

2827
import * as IconCache from './iconCache.js';
2928
import * as Util from './util.js';
@@ -43,7 +42,6 @@ Gio._promisify(Gio.DBusConnection.prototype, 'call');
4342
const MAX_UPDATE_FREQUENCY = 30; // In ms
4443
const FALLBACK_ICON_NAME = 'image-loading-symbolic';
4544
const PIXMAPS_FORMAT = imports.gi.Cogl.PixelFormat.ARGB_8888;
46-
const GNOME_48_PLUS = Number(Config.PACKAGE_VERSION.split(".")[0]) >= 48;
4745

4846
export const SNICategory = Object.freeze({
4947
APPLICATION: 'ApplicationStatus',
@@ -1327,11 +1325,13 @@ class AppIndicatorsIconActor extends St.Icon {
13271325
preferredHeight: height,
13281326
});
13291327

1330-
const setBytesArgs = [pixmapVariant.get_data_as_bytes(), PIXMAPS_FORMAT, width, height, rowStride];
1331-
if (GNOME_48_PLUS) {
1332-
setBytesArgs.unshift(global.stage.context.get_backend().get_cogl_context());
1333-
}
1334-
imageContent.set_bytes(...setBytesArgs);
1328+
// Remove this dynamic check when we depend on GNOME 48.
1329+
const coglContext = [];
1330+
const mutterBackend = global.stage?.context?.get_backend?.();
1331+
if (imageContent.set_bytes.length === 6 && mutterBackend?.get_cogl_context)
1332+
coglContext.push(mutterBackend.get_cogl_context());
1333+
imageContent.set_bytes(...coglContext, pixmapVariant.get_data_as_bytes(),
1334+
PIXMAPS_FORMAT, width, height, rowStride);
13351335

13361336
if (iconType !== SNIconType.OVERLAY && !this._indicator.hasOverlayIcon) {
13371337
const scaledSize = iconSize * scaleFactor;

0 commit comments

Comments
 (0)