mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-15 15:57:13 +00:00
devif.h, mnxdefs.h: Update MRegion to reflect that width/height are unsigned. Update ...EventMask fields in XWINDOW section of DspInterfaceRec to match parameter type used in XSelectInput() to which they are passed. Add padding to explicitly align colors field (short among longs) xbitmaps.h: Reorder fields in LISP_CURSOR struct to avoid requiring padding for alignment constraints, and adjust initialization to match. Declare cursors static const. Move Lisp_Icon from xbitmaps.h to xmkicon.c xinit.c, xinitdefs.h Replace bound() (xwinmandefs.h) with static inline unsigned ubound() in xinit.c Change signature of X_init() to use unsigned values for width, height, depth. Add casts where necessary to avoid implicit signedness conversions. Add extern declarations for all globals defined in xinit.c xwinman.c, xwinmandefs.h Remove bound() from xwinmandefs.h and use static inline unsigned ubound() in xwinman.c Change signature of lisp_Xconfigure() to use unsigned width and height parameters. Make GravSize unsigned to match its usage context. Add casts where necessary to avoid implicit signedness conversions. Add missing break to correct switch case fall-through warning. dspif.c Change LispDisplayRequestedWidth/Height to unsigned to reflect context of use. xlspwin.c Eliminate declaration for unused XEvent report. Move global variable gcv, used only locally, to local variable in the procedures where needed. Change various variables used in width/height calculation to unsigned to match usage context. Add casts where necessary to avoid implicit signedness conversions. xmkicon.c Move Lisp_Icon from xbitmaps.h to xmkicon.c. Move global XImage IconImage to local in function where it is required. Add cast where necessary to avoid implicit signedness conversions. xrdopt.c Remove incorrect casts for signedness causing implicit sign conversion warnings. Add extern declarations for all globals defined in xrdopt.c xscroll.c Replace bound() (xwinmandefs.h) with static inline signed sbound() in xscroll.c initdsp.c, initdspdefs.h Change signedness of various display variables from int to unsigned. Change signature of init_display2() to unsigned display_max. Add extern declarations for some globals defined in initdsp.c xbbt.c Add explicit casts for type warnings from MRegion width/height change. Add explicit casts for type warnings in arguments to XPutImage().
68 lines
2.5 KiB
C
68 lines
2.5 KiB
C
/* $Id: xscroll.c,v 1.2 1999/01/03 02:07:48 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
|
|
*/
|
|
|
|
/************************************************************************/
|
|
/* */
|
|
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
|
|
/* All Rights Reserved. */
|
|
/* Manufactured in the United States of America. */
|
|
/* */
|
|
/************************************************************************/
|
|
|
|
#include "version.h"
|
|
|
|
#include <X11/Xlib.h> // for XMoveWindow
|
|
#include "devif.h" // for (anonymous), MRegion, DspInterface
|
|
#include "xdefs.h" // for SCROLL_PITCH
|
|
#include "xscrolldefs.h" // for JumpScrollHor, JumpScrollVer, Scroll, Scrol...
|
|
|
|
int ScrollPitch = SCROLL_PITCH;
|
|
|
|
/* sbound: return (signed) value if it is between lower and upper otherwise lower or upper */
|
|
static inline int sbound(int lower, int value, int upper)
|
|
{
|
|
if (value <= lower)
|
|
return (lower);
|
|
else if (value >= upper)
|
|
return (upper);
|
|
else
|
|
return (value);
|
|
}
|
|
|
|
/* Move the DisplayWindow and the ScrollButtons to a new */
|
|
/* position. newX, newY refers to the upper left corner */
|
|
/* of the LispDisplay */
|
|
void Scroll(DspInterface dsp, int newX, int newY)
|
|
{
|
|
/* Limit the newX and newY values. */
|
|
dsp->Visible.x = sbound(0, newX, dsp->Display.width - dsp->Visible.width);
|
|
dsp->Visible.y = sbound(0, newY, dsp->Display.height - dsp->Visible.height);
|
|
|
|
newX = (dsp->Visible.x * (int)dsp->Visible.width) / (int)dsp->Display.width;
|
|
newY = (dsp->Visible.y * (int)dsp->Visible.height) / (int)dsp->Display.height;
|
|
|
|
XMoveWindow(dsp->display_id, dsp->HorScrollButton, newX, -(int)dsp->InternalBorderWidth);
|
|
XMoveWindow(dsp->display_id, dsp->VerScrollButton, -(int)dsp->InternalBorderWidth, newY);
|
|
|
|
(dsp->bitblt_to_screen)(dsp, 0, dsp->Visible.x, dsp->Visible.y, dsp->Visible.width,
|
|
dsp->Visible.height);
|
|
} /* end Scroll */
|
|
|
|
void JumpScrollVer(DspInterface dsp, int y)
|
|
{ Scroll(dsp, dsp->Visible.x, ((int)dsp->Display.width * y) / (int)dsp->Visible.height); }
|
|
|
|
void JumpScrollHor(DspInterface dsp, int x)
|
|
{ Scroll(dsp, (((int)dsp->Display.width * x) / (int)dsp->Visible.width), dsp->Visible.y); }
|
|
|
|
void ScrollLeft(DspInterface dsp)
|
|
{ Scroll(dsp, dsp->Visible.x - ScrollPitch, dsp->Visible.y); }
|
|
|
|
void ScrollRight(DspInterface dsp)
|
|
{ Scroll(dsp, dsp->Visible.x + ScrollPitch, dsp->Visible.y); }
|
|
|
|
void ScrollUp(DspInterface dsp)
|
|
{ Scroll(dsp, dsp->Visible.x, dsp->Visible.y - ScrollPitch); }
|
|
|
|
void ScrollDown(DspInterface dsp)
|
|
{ Scroll(dsp, dsp->Visible.x, dsp->Visible.y + ScrollPitch); }
|