* scrollForwardR is buggy (+patch)
@ 1993-07-18 22:21 Scott Schwartz
0 siblings, 0 replies; only message in thread
From: Scott Schwartz @ 1993-07-18 22:21 UTC (permalink / raw)
To: Sam Fans
Greetings all,
In the Bell Labs distribution, if the X resource database contains
Sam*scrollForwardR:false
then scrolling will malfunction. As distributed, scrollForwardR works
by having samterm/main.c lie to scroll() about which button was
pressed, if it was 1 or 3. Unfortunately, scroll() detects the lie at
line 122 when it calls button(but); it will always exit the loop at
that point since the real mouse won't match but. My fix was to have
the scrolling logic in samterm check to see which is the
forward-scrolling button in the three places it needs to know that.
*** 1.1 1993/07/18 21:23:20
--- main.c 1993/07/18 22:00:31
***************
*** 21,26 ****
--- 21,28 ----
char lock = 1;
char hasunlocked = 0;
+ int fwdbut = 3; /* an X resource may set this to 1 */
+
void
main(int argc, char *argv[])
{
***************
*** 29,36 ****
Rectangle r;
Flayer *nwhich;
- int fwdbut;
-
getscreen(argc, argv);
fwdbut = scrollfwdbut();
iconinit();
--- 31,36 ----
***************
*** 81,87 ****
if(nwhich!=which)
current(nwhich);
else if(scr)
! scroll(which, fwdbut == 3 ? 1 : 3);
else{
t=(Text *)which->user1;
if(flselect(which)){
--- 81,87 ----
if(nwhich!=which)
current(nwhich);
else if(scr)
! scroll(which, 1);
else{
t=(Text *)which->user1;
if(flselect(which)){
***************
*** 98,104 ****
menu2hit();
}else if((mouse.buttons&4)){
if(scr)
! scroll(which, fwdbut == 3 ? 3 : 1);
else
menu3hit();
}
--- 98,104 ----
menu2hit();
}else if((mouse.buttons&4)){
if(scr)
! scroll(which, 3);
else
menu3hit();
}
***************
*** 287,302 ****
{
Text *t=(Text *)l->user1;
! switch(but){
! case 1:
outTsll(Torigin, t->tag, l->origin, p0);
! break;
! case 2:
outTsll(Torigin, t->tag, p0, 1L);
! break;
! case 3:
horigin(t->tag,p0);
- }
}
int
--- 287,298 ----
{
Text *t=(Text *)l->user1;
! if (but == BCKBUT)
outTsll(Torigin, t->tag, l->origin, p0);
! else if (but == SETBUT)
outTsll(Torigin, t->tag, p0, 1L);
! else if (but == FWDBUT)
horigin(t->tag,p0);
}
int
*** 1.1 1993/07/18 21:30:30
--- samterm.h 1993/07/18 22:00:33
***************
*** 5,10 ****
--- 5,14 ----
#define MAXFILES 256
#define NL 5
+ #define BCKBUT (4-fwdbut)
+ #define SETBUT (2)
+ #define FWDBUT (fwdbut)
+
enum{
Up,
Down
***************
*** 67,72 ****
--- 71,77 ----
extern long snarflen;
extern Mouse mouse;
extern long modified;
+ extern int fwdbut;
Rune *gettext(Flayer*, long, ulong*);
void *alloc(ulong n);
*** 1.1 1993/07/16 20:06:17
--- scroll.c 1993/07/18 22:05:39
***************
*** 100,114 ****
my = s.max.y;
if(!eqpt(mouse.xy, Pt(x, my)))
cursorset(Pt(x, my));
! if(but == 1){
p0 = l->origin-frcharofpt(&l->f, Pt(s.max.x, my));
rt = scrpos(l->scroll, p0, p0+l->f.nchars, tot);
y = rt.min.y;
! }else if(but == 2){
y = my;
if(y > s.max.y-2)
y = s.max.y-2;
! }else if(but == 3){
p0 = l->origin+frcharofpt(&l->f, Pt(s.max.x, my));
rt = scrpos(l->scroll, p0, p0+l->f.nchars, tot);
y = rt.min.y;
--- 100,114 ----
my = s.max.y;
if(!eqpt(mouse.xy, Pt(x, my)))
cursorset(Pt(x, my));
! if(but == BCKBUT){
p0 = l->origin-frcharofpt(&l->f, Pt(s.max.x, my));
rt = scrpos(l->scroll, p0, p0+l->f.nchars, tot);
y = rt.min.y;
! }else if(but == SETBUT){
y = my;
if(y > s.max.y-2)
y = s.max.y-2;
! }else if(but == FWDBUT){
p0 = l->origin+frcharofpt(&l->f, Pt(s.max.x, my));
rt = scrpos(l->scroll, p0, p0+l->f.nchars, tot);
y = rt.min.y;
***************
*** 118,137 ****
r = raddp(scr, Pt(0, y-scr.min.y));
scrflip(l, r);
}
! }
}while(button(but));
if(in){
h = s.max.y-s.min.y;
scrflip(l, r);
p0 = 0;
! if(but == 1)
p0 = (long)(my-s.min.y)/l->f.font->height+1;
! else if(but == 2){
if(tot > 1024L*1024L)
p0 = ((tot>>10)*(y-s.min.y)/h)<<10;
else
p0 = tot*(y-s.min.y)/h;
! }else if(but == 3){
p0 = l->origin+frcharofpt(&l->f, Pt(s.max.x, my));
if(p0 > tot)
p0 = tot;
--- 118,137 ----
r = raddp(scr, Pt(0, y-scr.min.y));
scrflip(l, r);
}
! }
}while(button(but));
if(in){
h = s.max.y-s.min.y;
scrflip(l, r);
p0 = 0;
! if(but == BCKBUT)
p0 = (long)(my-s.min.y)/l->f.font->height+1;
! else if(but == SETBUT){
if(tot > 1024L*1024L)
p0 = ((tot>>10)*(y-s.min.y)/h)<<10;
else
p0 = tot*(y-s.min.y)/h;
! }else if(but == FWDBUT){
p0 = l->origin+frcharofpt(&l->f, Pt(s.max.x, my));
if(p0 > tot)
p0 = tot;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1993-07-18 22:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-07-18 22:21 scrollForwardR is buggy (+patch) Scott Schwartz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).