1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-14 15:36:34 +00:00
Interlisp.maiko/src/xscroll.c
Nick Briggs 3d9f090e70
Cleanup of includes and related changes based on include-what-you-use diagnostics (#436)
Remove unused #define PERCENT_OF_SCREEN in MyWindow.h
Move structures for dir.c to dirdefs.h where they are used
Resolve S_CHAR vs S_CHARACTER in favor of S_CHARACTER and cleanup #defines
Fix  = vs == bug in FSDEBUG code in dir.c
Eliminate duplicate/unused constant definitions in gcr.c
Declare static internal function bytecmp in mkatom.c
Update many source and include files to include headers for what they use
2022-08-10 11:07:57 -07:00

58 lines
2.3 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...
#include "xwinmandefs.h" // for bound
int ScrollPitch = SCROLL_PITCH;
/* 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 = bound(0, newX, dsp->Display.width - dsp->Visible.width);
dsp->Visible.y = bound(0, newY, dsp->Display.height - dsp->Visible.height);
newX = (int)((dsp->Visible.x * dsp->Visible.width) / dsp->Display.width);
newY = (int)((dsp->Visible.y * dsp->Visible.height) / dsp->Display.height);
XMoveWindow(dsp->display_id, dsp->HorScrollButton, newX, -dsp->InternalBorderWidth);
XMoveWindow(dsp->display_id, dsp->VerScrollButton, -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) / dsp->Visible.height)); }
void JumpScrollHor(DspInterface dsp, int x)
{ Scroll(dsp, (int)((dsp->Display.width * x) / 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); }