GNOME Bugzilla – Bug 768317
Fix various glitches in OSD window
Last modified: 2016-07-05 18:50:33 UTC
Some fallout from bug 758471 ...
Created attachment 330792 [details] [review] osdWindow: Fix level bar width Commit 9b07ce1d0d changed the OSD window's level bar to be a regular actor instead of a custom drawn bar. The bar actor's width depends on both the configured level (e.g. 40%) and the available width, however the width is currently only updated when the configured level changes. Fix that by properly considering changes to the parent's width as well.
Created attachment 330793 [details] [review] osdWindow: Fix blurry level bar ClutterActor:width is a floating point property, so it will not be automatically rounded to non-fractional values that properly align to pixels. To fix the resulting blurriness, add explicit rounding.
Created attachment 330794 [details] [review] osdWindow: Use a constraint to enforce ratio Commit 9b07ce1d0d broke the code that keeps the OSD window square. Use that opportunity to move away from the hack of setting the min-height style property from code and adjusting the width on allocate, and implement a proper constraint instead.
*** Bug 768330 has been marked as a duplicate of this bug. ***
Review of attachment 330793 [details] [review]: ::: js/ui/osdWindow.js @@ +41,2 @@ let alloc = this.actor.get_allocation_box(); + let newWidth = Math.floor((alloc.x2 - alloc.x1) * this._level / 100); why not round() ? don't we take the risk of ending up 1 pixel short of a full bar when the level is 100 this way?
Review of attachment 330792 [details] [review]: looks fine
Review of attachment 330794 [details] [review]: got a bit puzzled until realizing the MonitorConstraint applies to the parent of the box this constraint applies to anyway, looks good ::: js/ui/osdWindow.js @@ +65,3 @@ + // so add it to our minimum size + let minSize = this._minSize + actor.margin_top + actor.margin_bottom; + let [width, height] = actorBox.get_size(); this is the min-width/min-height set from the osd-window css class right? perhaps a small comment here to make that obvious
Review of attachment 330794 [details] [review]: hang on, this patch actually makes the level bar blurry on this 1366x768 monitor, not sure why though
Review of attachment 330794 [details] [review]: now it doesn't anymore, glitch in the matrix I suppose
(In reply to Rui Matos from comment #5) > why not round() ? don't we take the risk of ending up 1 pixel short of a > full bar when the level is 100 this way? I don't think so, if this._level is 100, we should multiply by one either way. But then I neither think that round() is wrong, so changed.
(In reply to Rui Matos from comment #7) > this is the min-width/min-height set from the osd-window css class right? At least, but likely more on most displays. It's something like [Math.min(min-width, icon-size + horizontal padding), Math.min(min-height, icon-size + vertical padding)] (where the icon size depends on the monitor dimensions, see _monitorsChanged).
Attachment 330792 [details] pushed as 775187b - osdWindow: Fix level bar width Attachment 330793 [details] pushed as 424fa01 - osdWindow: Fix blurry level bar Attachment 330794 [details] pushed as 128697d - osdWindow: Use a constraint to enforce ratio