diff options
author | fvogel <fvogelnew1@free.fr> | 2017-04-06 20:01:59 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2017-04-06 20:01:59 (GMT) |
commit | d0b1723d34a856dc2d97018fb4a249d8c66fd2fd (patch) | |
tree | 39bae83927e12e2e33b5a459c20a4811b2617538 /generic | |
parent | bffab6100745d46b0d1bd5c1fa77ef83e9234c98 (diff) | |
download | tk-d0b1723d34a856dc2d97018fb4a249d8c66fd2fd.zip tk-d0b1723d34a856dc2d97018fb4a249d8c66fd2fd.tar.gz tk-d0b1723d34a856dc2d97018fb4a249d8c66fd2fd.tar.bz2 |
Slightly better fix anonymously proposed in [6020ee2d03]. Use floor() instead of casting to an int.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/ttk/ttkNotebook.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 389d520..b649e4b 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -4,6 +4,7 @@ #include <string.h> #include <ctype.h> +#include <math.h> #include <stdio.h> #include <tk.h> @@ -454,15 +455,17 @@ static void SqueezeTabs( if (nTabs > 0) { int difference = available - needed; - double delta = (double)difference / needed; + double fraction = (double)difference / needed; double slack = 0; + double ad; int i; for (i = 0; i < nTabs; ++i) { Tab *tab = Ttk_SlaveData(nb->notebook.mgr,i); - double ad = slack + tab->width * delta; + + ad = slack + tab->width * fraction; tab->width += (int)ad; - slack = ad - (int)ad; + slack = ad - floor(ad); } } } |