Patch: Fix for slider thumb not showing

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

User avatar
ErikHjortsberg
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Sun Jan 23, 2005 12:45
Location: Sweden
Contact:

Patch: Fix for slider thumb not showing

Postby ErikHjortsberg » Sat Jan 29, 2011 12:58

Hi, I still cannot log in to Mantis for some reason, so I'll post this here instead.

There's a bug with FalSlider which has the effect that if the size of any of the dimensions of the slider track is zero at any point, it will cause the position sent to the thumb to be {{NaN, 0},{NaN,0}}, due to a division of zero. This seems then to cause the thumb window to never be able to recover (I'm not sure exactly what happens, but it seems like when setSize later is called, the NaNs will make that turn out invalid. Perhaps there should be an assert in CEGUIWindow for sizes and positions that contain NaN?)
Anyway, this patch will fix this issue (apply in the "0.7" branch):

Code: Select all

Index: cegui/src/WindowRendererSets/Falagard/FalSlider.cpp
===================================================================
--- cegui/src/WindowRendererSets/Falagard/FalSlider.cpp (revision 2787)
+++ cegui/src/WindowRendererSets/Falagard/FalSlider.cpp (arbetskopia)
@@ -76,9 +76,10 @@
 
         const Size w_pixel_size(w->getPixelSize());
 
+        float thumbRelXPos = w_pixel_size.d_width == 0.0f ? 0.0f : (area.d_left / w_pixel_size.d_width);
+        float thumbRelYPos = w_pixel_size.d_height == 0.0f ? 0.0f : (area.d_top / w_pixel_size.d_height);
         // get base location for thumb widget
-        UVector2 thumbPosition(cegui_reldim(area.d_left / w_pixel_size.d_width),
-                               cegui_reldim(area.d_top / w_pixel_size.d_height));
+        UVector2 thumbPosition(cegui_reldim(thumbRelXPos), cegui_reldim(thumbRelYPos));
 
         // Is this a vertical slider
         if (d_vertical)


Btw, when doing this it became apparent how much cumbersome the process of providing such a patch like this is when using svn in contrast to using a DVCS. While svn works very well for the regular developers, I would argue that the barrier of entry for non-regular developers wanting to provide a patch is a magnitude lower when using a DVCS.
Ember, a client for the Worldforge system.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Patch: Fix for slider thumb not showing

Postby CrazyEddie » Sun Jan 30, 2011 09:06

Thanks for the patch, I'll apply it later today or, possibly more likely, AM tomorrow.

For the Mantis issue, I've deleted an account on there with your name - hopefully the next time you try to log in, a 'new' account with the right details should get recreated for you. If you could try that and let me know if it worked or not, that would be great :)

Btw, when doing this it became apparent how much cumbersome the process of providing such a patch like this is when using svn in contrast to using a DVCS. While svn works very well for the regular developers, I would argue that the barrier of entry for non-regular developers wanting to provide a patch is a magnitude lower when using a DVCS.

Thanks for this. I'm still on the fence somewhat regarding whether to switch. I've been using Mercurial for some things I've been doing here and, aside from some tiny little things that annoyed me, I've found it very good. Since a majority of the day to day commands are basically the same as for svn, I think any transition would be mostly painless for us devs. As the situation stands, it appears there are few (or even no) valid reasons not to migrate, aside from the inertia that keeps me from doing it! ;) I will look over the situation again over the coming week and make a decision one way or the other.

CE.

User avatar
ErikHjortsberg
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Sun Jan 23, 2005 12:45
Location: Sweden
Contact:

Re: Patch: Fix for slider thumb not showing

Postby ErikHjortsberg » Sun Jan 30, 2011 20:03

Login works now, thanks.
Ember, a client for the Worldforge system.


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 4 guests