mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
scrolling
This commit is contained in:
parent
038aa0220a
commit
fa009f9d72
2 changed files with 30 additions and 0 deletions
|
@ -42,6 +42,7 @@ OFILES=\
|
|||
rectclip.$O\
|
||||
replclipr.$O\
|
||||
rgb.$O\
|
||||
scroll.$O\
|
||||
string.$O\
|
||||
stringbg.$O\
|
||||
stringsubfont.$O\
|
||||
|
|
29
src/libdraw/scroll.c
Normal file
29
src/libdraw/scroll.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <draw.h>
|
||||
|
||||
int
|
||||
mousescrollsize(int maxlines)
|
||||
{
|
||||
static int lines, pcnt;
|
||||
char *mss;
|
||||
|
||||
if(lines == 0 && pcnt == 0){
|
||||
mss = getenv("mousescrollsize");
|
||||
if(mss){
|
||||
if(strchr(mss, '%') != nil)
|
||||
pcnt = atof(mss);
|
||||
else
|
||||
lines = atoi(mss);
|
||||
free(mss);
|
||||
}
|
||||
if(lines == 0 && pcnt == 0)
|
||||
lines = 1;
|
||||
if(pcnt>=100)
|
||||
pcnt = 100;
|
||||
}
|
||||
|
||||
if(lines)
|
||||
return lines;
|
||||
return pcnt * maxlines/100.0;
|
||||
}
|
Loading…
Reference in a new issue