1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-13 23:27:12 +00:00

Add new include file xscroll.h defining the Scroll functions implemented in xscroll.c

and used in xwinman.c
Update function declarations from K&R style to new style.
Fix incorrect argument counts for some procedure calls.

	new file:   ../inc/xscroll.h
	modified:   xscroll.c
	modified:   xwinman.c
This commit is contained in:
Nick Briggs 2017-06-07 23:53:03 -07:00
parent 9ea244b927
commit 04b0b3ee0b
3 changed files with 32 additions and 21 deletions

15
inc/xscroll.h Normal file
View File

@ -0,0 +1,15 @@
/************************************************************************/
/* */
/* xscroll.h */
/* */
/* Scrolling functions implemented in xscroll.c */
/* */
/************************************************************************/
void Scroll(DspInterface dsp, int newX, int newY);
void JumpScrollVer(DspInterface dsp, int y);
void JumpScrollHor(DspInterface dsp, int x);
void ScrollLeft(DspInterface dsp);
void ScrollRight(DspInterface dsp);
void ScrollUp(DspInterface dsp);
void ScrollDown(DspInterface dsp);

View File

@ -29,10 +29,9 @@ static char *id = "$Id: xscroll.c,v 1.2 1999/01/03 02:07:48 sybalsky Exp $ Copyr
int ScrollPitch = SCROLL_PITCH;
/* Move the DisplayWindow and the ScrollButtons to a new */
/* position. newX, newY refers to the uppre left corner */
/* position. newX, newY refers to the upper left corner */
/* of the LispDisplay */
void Scroll(dsp, newX, newY) DspInterface dsp;
int newX, newY;
void Scroll(DspInterface dsp, int newX, int newY)
{
/* Limit the newX and newY values. */
dsp->Vissible.x = bound(0, newX, dsp->Display.width - dsp->Vissible.width);
@ -48,20 +47,20 @@ int newX, newY;
dsp->Vissible.height);
} /* end Scroll */
void JumpScrollVer(dsp, y) DspInterface dsp;
void JumpScrollVer(DspInterface dsp, int y)
{ Scroll(dsp, dsp->Vissible.x, (int)((dsp->Display.width * y) / dsp->Vissible.height)); }
void JumpScrollHor(dsp, x) DspInterface dsp;
void JumpScrollHor(DspInterface dsp, int x)
{ Scroll(dsp, (int)((dsp->Display.width * x) / dsp->Vissible.width), dsp->Vissible.y); }
void ScrollLeft(dsp) DspInterface dsp;
void ScrollLeft(DspInterface dsp)
{ Scroll(dsp, dsp->Vissible.x - ScrollPitch, dsp->Vissible.y); }
void ScrollRight(dsp) DspInterface dsp;
void ScrollRight(DspInterface dsp)
{ Scroll(dsp, dsp->Vissible.x + ScrollPitch, dsp->Vissible.y); }
void ScrollUp(dsp) DspInterface dsp;
void ScrollUp(DspInterface dsp)
{ Scroll(dsp, dsp->Vissible.x, dsp->Vissible.y - ScrollPitch); }
void ScrollDown(dsp) DspInterface dsp;
void ScrollDown(DspInterface dsp)
{ Scroll(dsp, dsp->Vissible.x, dsp->Vissible.y + ScrollPitch); }

View File

@ -29,6 +29,7 @@ static char *id = "$Id: xwinman.c,v 1.3 2001/12/26 22:17:07 sybalsky Exp $ Copyr
#include "lispemul.h"
#include "devif.h"
#include "xdefs.h"
#include "xscroll.h"
int Mouse_Included = FALSE;
@ -60,10 +61,7 @@ int bound(a, b, c) int a, b, c;
return (b);
}
void Set_BitGravity(event, dsp, window, grav) XButtonEvent *event;
DspInterface dsp;
Window window;
int grav;
void Set_BitGravity(XButtonEvent *event, DspInterface dsp, Window window, int grav)
{
XSetWindowAttributes Lisp_SetWinAttributes;
Window OldWindow;
@ -87,8 +85,7 @@ int grav;
XUNLOCK;
} /* end Set_BitGravity */
void lisp_Xconfigure(dsp, x, y, lspWinWidth, lspWinHeight) DspInterface dsp;
int x, y, lspWinWidth, lspWinHeight;
void lisp_Xconfigure(DspInterface dsp, int x, int y, int lspWinWidth, int lspWinHeight)
{
int GravSize, Col2, Row2, Col3, Row3;
@ -142,7 +139,7 @@ int x, y, lspWinWidth, lspWinHeight;
XUNLOCK;
} /* end lisp_Xconfigure */
void enable_Xkeyboard(dsp) DspInterface dsp;
void enable_Xkeyboard(DspInterface dsp)
{
XLOCK;
XSelectInput(dsp->display_id, dsp->DisplayWindow, dsp->EnableEventMask);
@ -150,7 +147,7 @@ void enable_Xkeyboard(dsp) DspInterface dsp;
XUNLOCK;
}
void disable_Xkeyboard(dsp) DspInterface dsp;
void disable_Xkeyboard(DspInterface dsp)
{
XLOCK;
XSelectInput(dsp->display_id, dsp->DisplayWindow, dsp->DisableEventMask);
@ -158,7 +155,7 @@ void disable_Xkeyboard(dsp) DspInterface dsp;
XUNLOCK;
}
void beep_Xkeyboard(dsp) DspInterface dsp;
void beep_Xkeyboard(DspInterface dsp)
{
#ifdef TRACE
printf("TRACE: beep_Xkeyboard()\n");
@ -181,7 +178,7 @@ void beep_Xkeyboard(dsp) DspInterface dsp;
extern int Current_Hot_X, Current_Hot_Y; /* Cursor hotspot */
void getXsignaldata(dsp) DspInterface dsp;
void getXsignaldata(DspInterface dsp)
{
XEvent report;
@ -261,14 +258,14 @@ void getXsignaldata(dsp) DspInterface dsp;
switch (report.xbutton.button) {
case Button1:
DefineCursor(dsp->display_id, dsp->HorScrollBar, &ScrollLeftCursor);
ScrollLeft(dsp, report);
ScrollLeft(dsp);
break;
case Button2:
DefineCursor(dsp->display_id, dsp->HorScrollBar, &HorizThumbCursor);
break;
case Button3:
DefineCursor(dsp->display_id, dsp->HorScrollBar, &ScrollRightCursor);
ScrollRight(dsp, report);
ScrollRight(dsp);
break;
default: break;
} /* end switch */