From 04b0b3ee0b773959fc6523f8b09b1783dee3c0de Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Wed, 7 Jun 2017 23:53:03 -0700 Subject: [PATCH] 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 --- inc/xscroll.h | 15 +++++++++++++++ src/xscroll.c | 17 ++++++++--------- src/xwinman.c | 21 +++++++++------------ 3 files changed, 32 insertions(+), 21 deletions(-) create mode 100644 inc/xscroll.h diff --git a/inc/xscroll.h b/inc/xscroll.h new file mode 100644 index 0000000..b5d0bb5 --- /dev/null +++ b/inc/xscroll.h @@ -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); diff --git a/src/xscroll.c b/src/xscroll.c index 7452dda..0a11987 100644 --- a/src/xscroll.c +++ b/src/xscroll.c @@ -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); } diff --git a/src/xwinman.c b/src/xwinman.c index b268b9e..6a0b900 100644 --- a/src/xwinman.c +++ b/src/xwinman.c @@ -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 */