ref: ee5f835847688d30671612abcb1032df7f53e3ea
parent: 2f022c6aa10e1765982386688b63a5b2d46913b5
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Mon Jan 7 22:45:49 EST 2013
libdraw: fix wrong menusel() calculation for menuhit() (noticable with small fonts) the text for a menu entry is drawn from: y = textr.min.y + i*(font->height+Vspacing); but we calculated the item from: r = insetrect(textr); i = (p.y - r.min.y) / (font->height+Vspacing); the insetrect is wrong.
--- a/sys/src/libdraw/emenuhit.c
+++ b/sys/src/libdraw/emenuhit.c
@@ -68,7 +68,6 @@
static int
menusel(Rectangle r, Point p)
{- r = insetrect(r, Margin);
if(!ptinrect(p, r))
return -1;
return (p.y-r.min.y)/(font->height+Vspacing);
--- a/sys/src/libdraw/menuhit.c
+++ b/sys/src/libdraw/menuhit.c
@@ -69,7 +69,6 @@
static int
menusel(Rectangle r, Point p)
{- r = insetrect(r, Margin);
if(!ptinrect(p, r))
return -1;
return (p.y-r.min.y)/(font->height+Vspacing);
--
⑨