Bugzilla – Bug 8479
getSize() often returns 0 for a styled icon widget
Last modified: 2009-03-25 12:25:31 UTC
to fix bug 6504, which creates a new "smallicon" menu style, SlimBrowser needs to not use a hard-coded value for THUMB_SIZE Richard, will this be a good use of your new service registration code? That is, have DefaultSkin register a method where another applet can query for icon size based on a given style?
7.1 r2611: SlimBrowserApplet queries the icon style's size for determining the size of the thumbnail to be requested. NowPlaying needs to yet be fixed, and appears to be a bit trickier. Using icon:getSize() for browse menus should be enough to fix bug#6504. I'll check that first, but should be able to close that one if I'm correct in that assumption.
It doesn't look like an icon widget can be queried for its size in many situations. For example, in SlimBrowser roundabout line 838 the titleIcon Icon widget that is created returns 0 when titleIcon:getSize() is called. I've tried a number of tweaks to the icon style (notably adding s.icon.w = 56, s.albumtitle.icon.w = 56, etc.) to no effect. -- add the icon if it's been specified in the window params if data.window['icon-id'] then -- Fetch an image from SlimServer titleIcon = Icon("icon") local iconSize = titleIcon:getSize() log:warn('**************', iconSize) _server:fetchArtworkThumb(data.window["icon-id"], titleIcon, THUMB_SIZE) 110549:4762 WARN (SlimBrowserApplet.lua:839) - **************0 The same is true for the artwork in NowPlayingApplet-- I can't dynamically choose the size to request because getSize() always returns 0 Richard, I poked around the C code a little bit but didn't find anything that looked glaring. Maybe I'm just getting myself confused in the skinning code, but I have a feeling there's something that might need fixing at the C layer. Punting to you for comment...punt back as you see fit.
Ben, I think I see the problem but need to test something first. I don't see to be able to trigger the code you've pasted below, how do I get into that code block?
Created attachment 3530 [details] reproduce issue in NowPlayingApplet the example from SlimBrowser wasn't a good one because that part of the code isn't typically hit in normal browse menus. try this patch against NowPlaying that just creates an icon of style "icon" and queries for its size. It should return a value from the skin for the icon size, but does not.
Punting to 7.2
this is a must fix for the on screen keyboard. Need to be able to have buttons of different widths, styled in the skin, that can be queried with getSize()
is this fixed, ben?
let's call it "worked around effectively" :)
sorry, that last comment wasn't helpful to peterw, didn't realize there were outside devs cc:ed on this bug. I would actually say that this bug is not fixed, but within the skin we set a bunch of constants in the param function that effectively do what we need-- in the skin applet: function param(self) return { THUMB_SIZE = 41, nowPlayingBrowseArtworkSize = 190, nowPlayingSSArtworkSize = 190, nowPlayingLargeArtworkSize = 190, } end in JiveMain.lua: function JiveMain:getSkinParam(key) if self._skin then local param = self._skin:param() if key and param[key] then return param[key] end end log:error('no value for skinParam ', key, ' found') return nil end and finally, in an applet that needs the parameter, e.g., SlimBrowser: local THUMB_SIZE = jiveMain:getSkinParam("THUMB_SIZE") -- getSkinParam in this case would return 41 could be that's not an acceptable solution for what peterw is interested in. If not, please reopen.