From b5659c09770b0bb617a9797e27cc6893a8eb6660 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 18 Jun 2013 23:23:41 +0200 Subject: libdraw: avoid moving cursor if we dont have to for menuhit depending on the font, poping the menu would move your cursor one pixel down each time (due to division). this is annoying when using a trackpoint and trying to repeat some operation over 9000 times. the cursor should only be moved when the menu is repositioned to contain it on the screen. --- sys/src/libdraw/emenuhit.c | 3 ++- sys/src/libdraw/menuhit.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/src/libdraw/emenuhit.c b/sys/src/libdraw/emenuhit.c index 8e34fe942..a8e01a358 100644 --- a/sys/src/libdraw/emenuhit.c +++ b/sys/src/libdraw/emenuhit.c @@ -230,7 +230,8 @@ emenuhit(int but, Mouse *m, Menu *menu) border(screen, menur, Blackborder, bord, ZP); save = allocimage(display, menurect(textr, 0), screen->chan, 0, -1); r = menurect(textr, lasti); - emoveto(divpt(addpt(r.min, r.max), 2)); + if(pt.x || pt.y) + emoveto(divpt(addpt(r.min, r.max), 2)); menupaint(menu, textr, off, nitemdrawn); if(scrolling) menuscrollpaint(scrollr, off, nitem, nitemdrawn); diff --git a/sys/src/libdraw/menuhit.c b/sys/src/libdraw/menuhit.c index cea8bb716..e911466ec 100644 --- a/sys/src/libdraw/menuhit.c +++ b/sys/src/libdraw/menuhit.c @@ -234,7 +234,8 @@ menuhit(int but, Mousectl *mc, Menu *menu, Screen *scr) border(b, menur, Blackborder, bord, ZP); save = allocimage(display, menurect(textr, 0), screen->chan, 0, -1); r = menurect(textr, lasti); - moveto(mc, divpt(addpt(r.min, r.max), 2)); + if(pt.x || pt.y) + moveto(mc, divpt(addpt(r.min, r.max), 2)); menupaint(b, menu, textr, off, nitemdrawn); if(scrolling) menuscrollpaint(b, scrollr, off, nitem, nitemdrawn); -- cgit v1.2.3