[gnome-shell/wip/carlosg/pad-osd-fixes: 5/12] padOsd: Make label coordinates API "private"
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/pad-osd-fixes: 5/12] padOsd: Make label coordinates API "private"
- Date: Fri, 29 May 2020 15:41:09 +0000 (UTC)
commit 618d1f84e59b50b0ad002747b8c2acded2c858bb
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu May 28 19:54:25 2020 +0200
padOsd: Make label coordinates API "private"
This is only called internally, and only needed there.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1290
js/ui/padOsd.js | 37 +++++++++++++++++--------------------
1 file changed, 17 insertions(+), 20 deletions(-)
---
diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js
index ca70e7f0ed..f851ae45ae 100644
--- a/js/ui/padOsd.js
+++ b/js/ui/padOsd.js
@@ -348,14 +348,14 @@ var PadDiagram = GObject.registerClass({
// FIXME: Fix num buttons.
let i = 0;
for (i = 0; i < 50; i++) {
- let [found] = this.getButtonLabelCoords(i);
+ let [found] = this._getLabelCoords(Meta.PadActionType.BUTTON, i);
if (!found)
break;
this._addLabel(Meta.PadActionType.BUTTON, i);
}
for (i = 0; i < 2; i++) {
- let [found] = this.getRingLabelCoords(i, CW);
+ let [found] = this._getLabelCoords(Meta.PadActionType.RING, i, CW);
if (!found)
break;
this._addLabel(Meta.PadActionType.RING, i, CW);
@@ -363,7 +363,7 @@ var PadDiagram = GObject.registerClass({
}
for (i = 0; i < 2; i++) {
- let [found] = this.getStripLabelCoords(i, UP);
+ let [found] = this._getLabelCoords(Meta.PadActionType.STRIP, i, UP);
if (!found)
break;
this._addLabel(Meta.PadActionType.STRIP, i, UP);
@@ -452,13 +452,13 @@ var PadDiagram = GObject.registerClass({
for (let i = 0; i < this._labels.length; i++) {
let [label, action, idx, dir] = this._labels[i];
- let [found_, x, y, arrangement] = this.getLabelCoords(action, idx, dir);
+ let [found_, x, y, arrangement] = this._getLabelCoords(action, idx, dir);
this._allocateChild(label, x, y, arrangement);
}
if (this._editorActor && this._curEdited) {
let [label_, action, idx, dir] = this._curEdited;
- let [found_, x, y, arrangement] = this.getLabelCoords(action, idx, dir);
+ let [found_, x, y, arrangement] = this._getLabelCoords(action, idx, dir);
this._allocateChild(this._editorActor, x, y, arrangement);
}
}
@@ -528,39 +528,36 @@ var PadDiagram = GObject.registerClass({
return [true, x, y, direction];
}
- getButtonLabelCoords(button) {
+ _getButtonLabels(button) {
let ch = String.fromCharCode('A'.charCodeAt() + button);
let labelName = 'Label%s'.format(ch);
let leaderName = 'Leader%s'.format(ch);
-
- return this._getItemLabelCoords(labelName, leaderName);
+ return [labelName, leaderName];
}
- getRingLabelCoords(number, dir) {
+ _getRingLabels(number, dir) {
let numStr = number > 0 ? (number + 1).toString() : '';
let dirStr = dir == CW ? 'CW' : 'CCW';
let labelName = 'LabelRing%s%s'.format(numStr, dirStr);
let leaderName = 'LeaderRing%s%s'.format(numStr, dirStr);
-
- return this._getItemLabelCoords(labelName, leaderName);
+ return [labelName, leaderName];
}
- getStripLabelCoords(number, dir) {
+ _getStripLabels(number, dir) {
let numStr = number > 0 ? (number + 1).toString() : '';
let dirStr = dir == UP ? 'Up' : 'Down';
let labelName = 'LabelStrip%s%s'.format(numStr, dirStr);
let leaderName = 'LeaderStrip%s%s'.format(numStr, dirStr);
-
- return this._getItemLabelCoords(labelName, leaderName);
+ return [labelName, leaderName];
}
- getLabelCoords(action, idx, dir) {
+ _getLabelCoords(action, idx, dir) {
if (action == Meta.PadActionType.BUTTON)
- return this.getButtonLabelCoords(idx);
+ return this._getItemLabelCoords(...this._getButtonLabels(idx));
else if (action == Meta.PadActionType.RING)
- return this.getRingLabelCoords(idx, dir);
+ return this._getItemLabelCoords(...this._getRingLabels(idx, dir));
else if (action == Meta.PadActionType.STRIP)
- return this.getStripLabelCoords(idx, dir);
+ return this._getItemLabelCoords(...this._getStripLabels(idx, dir));
return [false];
}
@@ -603,7 +600,7 @@ var PadDiagram = GObject.registerClass({
if (str != null) {
label.set_text(str);
- let [found_, x, y, arrangement] = this.getLabelCoords(action, idx, dir);
+ let [found_, x, y, arrangement] = this._getLabelCoords(action, idx, dir);
this._allocateChild(label, x, y, arrangement);
}
label.show();
@@ -644,7 +641,7 @@ var PadDiagram = GObject.registerClass({
if (this._curEdited == null)
return;
- let [found] = this.getLabelCoords(action, idx, dir);
+ let [found] = this._getLabelCoords(action, idx, dir);
if (!found)
return;
this._editorActor.show();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]