[gnome-shell/gnome-3-24] padOsd: strengthen ring/strip label creation



commit 7f693ed2c48d7a98f34b51818ff1d57c92895c39
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jul 12 22:38:31 2017 +0200

    padOsd: strengthen ring/strip label creation
    
    If the padOsd is given a nonexistent ring/strip, things would fail
    badly later when trying to paint a 0x0 StLabel. Just avoid creating
    more ring/strip labels than those known by libwacom.
    
    This is unlikely to happen, but seems better to protect against it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782033

 js/ui/padOsd.js |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js
index bdc381f..7358b00 100644
--- a/js/ui/padOsd.js
+++ b/js/ui/padOsd.js
@@ -685,11 +685,17 @@ const PadOsd = new Lang.Class({
         }
 
         for (i = 0; i < padDevice.get_n_rings(); i++) {
+            let [found] = this._padDiagram.getRingLabelCoords(i, CW);
+            if (!found)
+                break;
             this._createLabel(Meta.PadActionType.RING, i, CW);
             this._createLabel(Meta.PadActionType.RING, i, CCW);
         }
 
         for (i = 0; i < padDevice.get_n_strips(); i++) {
+            let [found] = this._padDiagram.getStripLabelCoords(i, UP);
+            if (!found)
+                break;
             this._createLabel(Meta.PadActionType.STRIP, i, UP);
             this._createLabel(Meta.PadActionType.STRIP, i, DOWN);
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]