From c90e7ce25814f6dcd0e52c00961fe936649811b0 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 28 May 2020 14:03:13 +0200 Subject: [PATCH] padOsd: Move button/ring/strip label creation to PadDiagram It's the natural container of those. We can create all those labels internally, and only expose the updateLabels() method to update them wholesome. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1290 --- js/ui/padOsd.js | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js index 221c8ddd6..d874f000e 100644 --- a/js/ui/padOsd.js +++ b/js/ui/padOsd.js @@ -329,6 +329,7 @@ var PadDiagram = GObject.registerClass({ this._imagePath = imagePath; this._handle = this._composeStyledDiagram(); + this._initLabels(); } // eslint-disable-next-line camelcase @@ -343,6 +344,33 @@ var PadDiagram = GObject.registerClass({ this.add_actor(actor); } + _initLabels() { + // FIXME: Fix num buttons. + let i = 0; + for (i = 0; i < 50; i++) { + let [found] = this.getButtonLabelCoords(i); + if (!found) + break; + this._addLabel(Meta.PadActionType.BUTTON, i); + } + + for (i = 0; i < 2; i++) { + let [found] = this.getRingLabelCoords(i, CW); + if (!found) + break; + this._addLabel(Meta.PadActionType.RING, i, CW); + this._addLabel(Meta.PadActionType.RING, i, CCW); + } + + for (i = 0; i < 2; i++) { + let [found] = this.getStripLabelCoords(i, UP); + if (!found) + break; + this._addLabel(Meta.PadActionType.STRIP, i, UP); + this._addLabel(Meta.PadActionType.STRIP, i, DOWN); + } + } + _wrappingSvgHeader() { return '' + '