A hopefully kosher edit.
This little chunk of code has been tweaked and cargo'd forward for years with no documentation as to what's going on. What I object to is the blatent disregarding of the width specified in getdown.txt with something calculated internally. (width - x*2) GIGO; fix your fucking getdown.txt. - If we are not granted privileges, reading the metadata breaks, which is why the fallback was first added. - Later it was tweaked because getWidth() can sometimes report 0 and that would cause the fallback width to be negative.
This commit is contained in:
@@ -259,9 +259,16 @@ public class StatusPanel extends JComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_newlab = createLabel(status, _ifc.statusText);
|
_newlab = createLabel(status, _ifc.statusText);
|
||||||
int width = getWidth() - _ifc.status.x*2;
|
// set the width of the label to the width specified
|
||||||
width = width > 0 ? Math.min(_ifc.status.width, width) : _ifc.status.width;
|
int width = _ifc.status.width;
|
||||||
_newlab.setTargetWidth(width);
|
if (width == 0) {
|
||||||
|
// unless we had trouble reading that width, in which case use the entire window
|
||||||
|
width = getWidth();
|
||||||
|
}
|
||||||
|
// but the window itself might not be initialized and have a width of 0
|
||||||
|
if (width > 0) {
|
||||||
|
_newlab.setTargetWidth(width);
|
||||||
|
}
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user