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

Net reduction of about 150 warnings when compiling with clang 15.0.6

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().
This commit is contained in:
Nick Briggs
2022-12-09 16:20:14 -08:00
parent e122d894f9
commit 60e13a774d
15 changed files with 253 additions and 216 deletions

View File

@@ -25,8 +25,8 @@ DspInterfaceRec curdsp;
DspInterface currentdsp = &curdsp;
#ifdef XWINDOW
extern int LispDisplayRequestedWidth;
extern int LispDisplayRequestedHeight;
extern unsigned LispDisplayRequestedWidth;
extern unsigned LispDisplayRequestedHeight;
#endif /* XWINDOW */
#ifdef DOS

View File

@@ -57,8 +57,8 @@ extern DspInterface currentdsp;
int LispWindowFd = -1;
int FrameBufferFd = -1;
int displaywidth, displayheight, DisplayRasterWidth, DisplayType;
int DisplayByteSize;
extern unsigned displaywidth, displayheight, DisplayRasterWidth, DisplayType, DisplayByteSize;
unsigned displaywidth, displayheight, DisplayRasterWidth, DisplayType, DisplayByteSize;
DLword *DisplayRegion68k; /* 68k addr of #{}22,0 */
#ifdef DISPLAYBUFFER
@@ -158,7 +158,7 @@ void clear_display() {
/* ================================================================ */
/* Now takes 68k address, function renamed for safety */
void init_display2(DLword *display_addr, int display_max)
void init_display2(DLword *display_addr, unsigned display_max)
{
@@ -187,7 +187,7 @@ void init_display2(DLword *display_addr, int display_max)
#endif /* XWINDOW */
init_cursor();
DisplayByteSize = ((displaywidth * displayheight / 8 + (getpagesize() - 1)) & -getpagesize());
DisplayByteSize = ((displaywidth * displayheight / 8 + ((unsigned)getpagesize() - 1)) & (unsigned)-getpagesize());
DBPRINT(("Display address: %p\n", (void *)DisplayRegion68k));
DBPRINT((" length : 0x%x\n", DisplayByteSize));

View File

@@ -31,8 +31,8 @@ unsigned long clipping_Xbitblt(DspInterface dsp, DLword *dummy, int x, int y, in
{
int temp_x, temp_y, LowerRightX, LowerRightY;
LowerRightX = dsp->Visible.x + dsp->Visible.width - 1;
LowerRightY = dsp->Visible.y + dsp->Visible.height - 1;
LowerRightX = dsp->Visible.x + (int)dsp->Visible.width - 1;
LowerRightY = dsp->Visible.y + (int)dsp->Visible.height - 1;
/* display region of interest lower right x, y pixel */
temp_x = x + w - 1;
@@ -48,7 +48,7 @@ unsigned long clipping_Xbitblt(DspInterface dsp, DLword *dummy, int x, int y, in
(temp_y <= LowerRightY)) {
XLOCK;
XPutImage(dsp->display_id, dsp->DisplayWindow, dsp->Copy_GC, &dsp->ScreenBitmap, x, y,
x - dsp->Visible.x, y - dsp->Visible.y, w, h);
x - dsp->Visible.x, y - dsp->Visible.y, (unsigned)w, (unsigned)h);
XFlush(dsp->display_id);
XUNLOCK(dsp);
return (1);
@@ -75,7 +75,7 @@ unsigned long clipping_Xbitblt(DspInterface dsp, DLword *dummy, int x, int y, in
if ((w > 0) && (h > 0)) {
XLOCK;
XPutImage(dsp->display_id, dsp->DisplayWindow, dsp->Copy_GC, &dsp->ScreenBitmap, x, y,
x - dsp->Visible.x, y - dsp->Visible.y, w, h);
x - dsp->Visible.x, y - dsp->Visible.y, (unsigned)w, (unsigned)h);
XFlush(dsp->display_id);
XUNLOCK(dsp);
}

View File

@@ -25,7 +25,6 @@
#include "xdefs.h" // for XLOCK, XUNLOCK, DEF_BDRWIDE, DEF_WIN_HEIGHT
#include "xinitdefs.h" // for Open_Display, X_init, Xevent_after_raid
#include "xlspwindefs.h" // for Create_LispWindow
#include "xwinmandefs.h" // for bound
/* DISPLAY_MAX same magic number is in ldsout.c */
#define DISPLAY_MAX (65536 * 16 * 2)
@@ -34,22 +33,45 @@ extern DLword *Lisp_world;
extern char Display_Name[128];
extern DLword *DisplayRegion68k;
extern int noscroll;
extern bool Lisp_Xinitialized;
bool Lisp_Xinitialized = false;
extern int xsync;
int xsync = False;
extern int LispWindowRequestedX;
extern int LispWindowRequestedY;
extern unsigned LispWindowRequestedWidth;
extern unsigned LispWindowRequestedHeight;
int LispWindowRequestedX = 0;
int LispWindowRequestedY = 0;
unsigned LispWindowRequestedWidth = DEF_WIN_WIDTH;
unsigned LispWindowRequestedHeight = DEF_WIN_HEIGHT;
extern int LispDisplayRequestedX, LispDisplayRequestedY;
extern unsigned LispDisplayRequestedWidth, LispDisplayRequestedHeight;
int LispDisplayRequestedX, LispDisplayRequestedY;
unsigned LispDisplayRequestedWidth, LispDisplayRequestedHeight;
extern Colormap Colors;
Colormap Colors;
extern volatile sig_atomic_t XLocked;
volatile sig_atomic_t XLocked = 0; /* non-zero while doing X ops, to avoid signals */
extern volatile sig_atomic_t XNeedSignal;
volatile sig_atomic_t XNeedSignal = 0; /* T if an X interrupt happened while XLOCK asserted */
/* ubound: return (unsigned) value if it is between lower and upper otherwise lower or upper */
static inline unsigned ubound(unsigned lower, unsigned value, unsigned upper)
{
if (value <= lower)
return (lower);
else if (value >= upper)
return (upper);
else
return (value);
}
/************************************************************************/
/* */
/* i n i t _ X e v e n t */
@@ -205,8 +227,8 @@ void Open_Display(DspInterface dsp)
/* */
/*********************************************************************/
DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, int width_hint, int height_hint,
int depth_hint)
DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, unsigned width_hint, unsigned height_hint,
unsigned depth_hint)
{
Screen *Xscreen;
@@ -236,17 +258,17 @@ DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, int width_hint, int he
/* Set the width and height of the display. */
if (height_hint == 0) {
dsp->Display.height =
HeightOfScreen(Xscreen) - OUTER_SB_WIDTH(dsp); /* In the default case,
(unsigned)HeightOfScreen(Xscreen) - OUTER_SB_WIDTH(dsp); /* In the default case,
adjust for scroll gadgets*/
} else
dsp->Display.height = bound(WIN_MIN_HEIGHT, height_hint, WIN_MAX_HEIGHT);
dsp->Display.height = ubound(WIN_MIN_HEIGHT, height_hint, WIN_MAX_HEIGHT);
if (width_hint == 0) {
dsp->Display.width =
WidthOfScreen(Xscreen) - OUTER_SB_WIDTH(dsp); /* In the default case,
(unsigned)WidthOfScreen(Xscreen) - OUTER_SB_WIDTH(dsp); /* In the default case,
adjust for scroll gadgets*/
} else
dsp->Display.width = bound(WIN_MIN_WIDTH, width_hint, WIN_MAX_WIDTH);
dsp->Display.width = ubound(WIN_MIN_WIDTH, width_hint, WIN_MAX_WIDTH);
/************************************************************/
/* Set the size of ScreenBitMap */
@@ -270,18 +292,18 @@ DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, int width_hint, int he
/* Set the geometry of the Visible (Lisp) window. */
dsp->Visible.width =
bound(OUTER_SB_WIDTH(dsp), LispWindowRequestedWidth,
min(dsp->Display.width, (WidthOfScreen(Xscreen) - OUTER_SB_WIDTH(dsp))));
ubound(OUTER_SB_WIDTH(dsp), LispWindowRequestedWidth,
min(dsp->Display.width, (unsigned)WidthOfScreen(Xscreen) - OUTER_SB_WIDTH(dsp)));
dsp->Visible.height =
bound(OUTER_SB_WIDTH(dsp), LispWindowRequestedHeight,
min(dsp->Display.height, (HeightOfScreen(Xscreen) - OUTER_SB_WIDTH(dsp))));
ubound(OUTER_SB_WIDTH(dsp), LispWindowRequestedHeight,
min(dsp->Display.height, (unsigned)HeightOfScreen(Xscreen) - OUTER_SB_WIDTH(dsp)));
/* Initialize the screen image structure. */
dsp->ScreenBitmap.width = dsp->Display.width;
dsp->ScreenBitmap.height = dsp->Display.height;
dsp->ScreenBitmap.width = (int)dsp->Display.width;
dsp->ScreenBitmap.height = (int)dsp->Display.height;
dsp->ScreenBitmap.xoffset = 0;
dsp->bitsperpixel =
DefaultDepthOfScreen(ScreenOfDisplay(dsp->display_id, DefaultScreen(dsp->display_id)));
(unsigned short)DefaultDepthOfScreen(ScreenOfDisplay(dsp->display_id, DefaultScreen(dsp->display_id)));
#if (defined(BYTESWAP))
dsp->ScreenBitmap.byte_order = LSBFirst;
#else /* BYTESWAP */
@@ -298,7 +320,7 @@ DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, int width_hint, int he
dsp->ScreenBitmap.bitmap_pad = 32;
dsp->ScreenBitmap.depth = 8;
dsp->ScreenBitmap.bits_per_pixel = 8;
dsp->ScreenBitmap.bytes_per_line = (dsp->Display.width);
dsp->ScreenBitmap.bytes_per_line = (int)dsp->Display.width;
dsp->ScreenBitmap.red_mask = 7;
dsp->ScreenBitmap.green_mask = 7;
dsp->ScreenBitmap.blue_mask = 3;

View File

@@ -47,8 +47,6 @@ extern char **save_argv;
extern DspInterface currentdsp;
XGCValues gcv;
XEvent report;
Cursor WaitCursor, DefaultCursor, VertScrollCursor, VertThumbCursor, ScrollUpCursor,
ScrollDownCursor, HorizScrollCursor, HorizThumbCursor, ScrollLeftCursor, ScrollRightCursor;
@@ -72,20 +70,22 @@ void Create_LispWindow(DspInterface dsp)
XClassHint xclasshint = {0};
XTextProperty IconText = {0}, WindowNameText = {0};
XSetWindowAttributes Lisp_SetWinAttributes = {0};
XGCValues gcv = {0};
Screen *screen;
int Col2, Row2, Col3, Row3, GravSize;
unsigned int Col2, Row2, Col3, Row3;
unsigned int GravSize;
char *WT, *IT;
WT = Window_Title;
IT = Icon_Title;
GravSize = (int)(dsp->ScrollBarWidth / 2) - (dsp->InternalBorderWidth);
GravSize = (dsp->ScrollBarWidth / 2) - dsp->InternalBorderWidth;
Col2 = dsp->Visible.width;
Row2 = dsp->Visible.height;
Col3 = dsp->Visible.width + (int)(OUTER_SB_WIDTH(dsp) / 2);
Row3 = dsp->Visible.height + (int)(OUTER_SB_WIDTH(dsp) / 2);
Col3 = dsp->Visible.width + (OUTER_SB_WIDTH(dsp) / 2);
Row3 = dsp->Visible.height + (OUTER_SB_WIDTH(dsp) / 2);
screen = ScreenOfDisplay(dsp->display_id, DefaultScreen(dsp->display_id));
dsp->LispWindow = XCreateSimpleWindow(
@@ -117,10 +117,10 @@ void Create_LispWindow(DspInterface dsp)
dsp->Copy_GC =
XCreateGC(dsp->display_id, dsp->LispWindow, GCForeground | GCBackground | GCFunction, &gcv);
szhint.max_width = dsp->Display.width + OUTER_SB_WIDTH(dsp);
szhint.max_height = dsp->Display.height + OUTER_SB_WIDTH(dsp);
szhint.min_width = OUTER_SB_WIDTH(dsp);
szhint.min_height = OUTER_SB_WIDTH(dsp);
szhint.max_width = (int)(dsp->Display.width + OUTER_SB_WIDTH(dsp));
szhint.max_height = (int)(dsp->Display.height + OUTER_SB_WIDTH(dsp));
szhint.min_width = (int)OUTER_SB_WIDTH(dsp);
szhint.min_height = (int)OUTER_SB_WIDTH(dsp);
szhint.win_gravity = dsp->BitGravity;
szhint.flags = PMaxSize | PWinGravity | PSize;
@@ -155,14 +155,14 @@ void Create_LispWindow(DspInterface dsp)
dsp->ScrollBarPixmap = XCreatePixmapFromBitmapData(
dsp->display_id, dsp->LispWindow, (char *)check_bits, check_width, check_height,
BlackPixelOfScreen(screen), WhitePixelOfScreen(screen), DefaultDepthOfScreen(screen));
BlackPixelOfScreen(screen), WhitePixelOfScreen(screen), (unsigned)DefaultDepthOfScreen(screen));
dsp->GravityOnPixmap = XCreatePixmapFromBitmapData(
dsp->display_id, dsp->LispWindow, (char *)check_bits, 16, 16, BlackPixelOfScreen(screen),
WhitePixelOfScreen(screen), DefaultDepthOfScreen(screen));
WhitePixelOfScreen(screen), (unsigned)DefaultDepthOfScreen(screen));
dsp->GravityOffPixmap = XCreatePixmapFromBitmapData(
dsp->display_id, dsp->LispWindow, (char *)plain_bits, 16, 16, BlackPixelOfScreen(screen),
WhitePixelOfScreen(screen), DefaultDepthOfScreen(screen));
WhitePixelOfScreen(screen), (unsigned)DefaultDepthOfScreen(screen));
set_Xcursor(dsp, default_cursor.cuimage, (int)default_cursor.cuhotspotx,
(int)(15 - default_cursor.cuhotspoty), &DefaultCursor, 0);
@@ -189,8 +189,8 @@ void Create_LispWindow(DspInterface dsp)
/********************************/
/* Make all the toolkit windows */
/********************************/
dsp->VerScrollBar = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow, Col2,
0 - dsp->InternalBorderWidth, /* y */
dsp->VerScrollBar = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow, (int)Col2,
0 - (int)dsp->InternalBorderWidth, /* y */
dsp->ScrollBarWidth, /* width */
dsp->Visible.height, dsp->InternalBorderWidth,
BlackPixelOfScreen(screen), WhitePixelOfScreen(screen));
@@ -198,7 +198,7 @@ void Create_LispWindow(DspInterface dsp)
XMapWindow(dsp->display_id, dsp->VerScrollBar);
dsp->HorScrollBar = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow,
0 - dsp->InternalBorderWidth, Row2, /* y */
0 - (int)dsp->InternalBorderWidth, (int)Row2, /* y */
dsp->Visible.width, /* width */
dsp->ScrollBarWidth, dsp->InternalBorderWidth,
BlackPixelOfScreen(screen), WhitePixelOfScreen(screen));
@@ -208,10 +208,10 @@ void Create_LispWindow(DspInterface dsp)
XMapWindow(dsp->display_id, dsp->HorScrollBar);
dsp->VerScrollButton = XCreateSimpleWindow(
dsp->display_id, dsp->VerScrollBar, 0 - dsp->InternalBorderWidth, /* x */
(int)((dsp->Visible.y * dsp->Visible.height) / dsp->Display.height), /* y */
dsp->display_id, dsp->VerScrollBar, 0 - (int)dsp->InternalBorderWidth, /* x */
(dsp->Visible.y * (int)dsp->Visible.height) / (int)dsp->Display.height, /* y */
dsp->ScrollBarWidth, /* width */
(int)((dsp->Visible.height * dsp->Visible.height) / dsp->Display.height) + 1,
((dsp->Visible.height * dsp->Visible.height) / dsp->Display.height) + 1,
dsp->InternalBorderWidth, BlackPixelOfScreen(screen), WhitePixelOfScreen(screen));
XChangeWindowAttributes(dsp->display_id, dsp->VerScrollButton, CWOverrideRedirect,
&Lisp_SetWinAttributes);
@@ -221,9 +221,9 @@ void Create_LispWindow(DspInterface dsp)
dsp->HorScrollButton = XCreateSimpleWindow(
dsp->display_id, dsp->HorScrollBar,
(int)((dsp->Visible.x * dsp->Visible.width) / dsp->Display.width),
0 - dsp->InternalBorderWidth, /* y */
(int)((dsp->Visible.width * dsp->Visible.width) / dsp->Display.width) + 1,
(dsp->Visible.x * (int)dsp->Visible.width) / (int)dsp->Display.width,
0 - (int)dsp->InternalBorderWidth, /* y */
((dsp->Visible.width * dsp->Visible.width) / dsp->Display.width) + 1,
dsp->ScrollBarWidth, dsp->InternalBorderWidth, BlackPixelOfScreen(screen),
WhitePixelOfScreen(screen));
XChangeWindowAttributes(dsp->display_id, dsp->HorScrollButton, CWOverrideRedirect,
@@ -232,7 +232,7 @@ void Create_LispWindow(DspInterface dsp)
XClearWindow(dsp->display_id, dsp->HorScrollButton);
XMapWindow(dsp->display_id, dsp->HorScrollButton);
dsp->NWGrav = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow, Col2, Row2, GravSize,
dsp->NWGrav = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow, (int)Col2, (int)Row2, GravSize,
GravSize, dsp->InternalBorderWidth, BlackPixelOfScreen(screen),
WhitePixelOfScreen(screen));
XSetWindowBackgroundPixmap(dsp->display_id, dsp->NWGrav, dsp->GravityOnPixmap);
@@ -241,7 +241,7 @@ void Create_LispWindow(DspInterface dsp)
XClearWindow(dsp->display_id, dsp->NWGrav);
XMapWindow(dsp->display_id, dsp->NWGrav);
dsp->SEGrav = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow, Col3, Row3, GravSize,
dsp->SEGrav = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow, (int)Col3, (int)Row3, GravSize,
GravSize, dsp->InternalBorderWidth, BlackPixelOfScreen(screen),
WhitePixelOfScreen(screen));
XSetWindowBackgroundPixmap(dsp->display_id, dsp->SEGrav, dsp->GravityOffPixmap);
@@ -250,7 +250,7 @@ void Create_LispWindow(DspInterface dsp)
XClearWindow(dsp->display_id, dsp->NWGrav);
XMapWindow(dsp->display_id, dsp->SEGrav);
dsp->SWGrav = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow, Col2, Row3, GravSize,
dsp->SWGrav = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow, (int)Col2, (int)Row3, GravSize,
GravSize, dsp->InternalBorderWidth, BlackPixelOfScreen(screen),
WhitePixelOfScreen(screen));
XSetWindowBackgroundPixmap(dsp->display_id, dsp->SWGrav, dsp->GravityOffPixmap);
@@ -258,7 +258,7 @@ void Create_LispWindow(DspInterface dsp)
XClearWindow(dsp->display_id, dsp->NWGrav);
XMapWindow(dsp->display_id, dsp->SWGrav);
dsp->NEGrav = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow, Col3, Row2, GravSize,
dsp->NEGrav = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow, (int)Col3, (int)Row2, GravSize,
GravSize, dsp->InternalBorderWidth, BlackPixelOfScreen(screen),
WhitePixelOfScreen(screen));
XSetWindowBackgroundPixmap(dsp->display_id, dsp->NEGrav, dsp->GravityOffPixmap);
@@ -278,6 +278,7 @@ void lisp_Xvideocolor(int flag)
{
Screen *screen;
XEvent event;
XGCValues gcv = {0};
unsigned long newForeground;
XLOCK;
@@ -296,8 +297,8 @@ void lisp_Xvideocolor(int flag)
event.xexpose.window = currentdsp->DisplayWindow;
event.xexpose.x = 0;
event.xexpose.y = 0;
event.xexpose.width = currentdsp->Visible.width;
event.xexpose.height = currentdsp->Visible.height;
event.xexpose.width = (int)currentdsp->Visible.width;
event.xexpose.height = (int)currentdsp->Visible.height;
XSendEvent(currentdsp->display_id, currentdsp->DisplayWindow, True, 0, &event);
}
@@ -315,8 +316,8 @@ void set_Xmouseposition(int x, int y)
dest_x = (x & 0xFFFF) + Current_Hot_X - currentdsp->Visible.x;
dest_y = (y & 0xFFFF) + Current_Hot_Y - currentdsp->Visible.y;
if ((dest_x >= 0) && (dest_x <= currentdsp->Visible.width) && (dest_y >= 0) &&
(dest_y <= currentdsp->Visible.height)) {
if ((dest_x >= 0) && (dest_x <= (int)currentdsp->Visible.width) && (dest_y >= 0) &&
(dest_y <= (int)currentdsp->Visible.height)) {
XLOCK;
XWarpPointer(currentdsp->display_id, (Window)NULL, currentdsp->DisplayWindow, 0, 0, 0, 0,
dest_x, dest_y);

View File

@@ -19,14 +19,74 @@
#include "devif.h" // for (anonymous), DspInterface
#include "xmkicondefs.h" // for make_Xicon
XImage IconImage;
extern int Lisp_icon_width, Lisp_icon_height;
extern uint8_t Lisp_icon[];
static Pixmap IconPixmap;
extern char iconpixmapfile[1024];
static const unsigned int Lisp_icon_width = 88;
static const unsigned int Lisp_icon_height = 58;
static const uint8_t Lisp_icon[] =
{
0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08,
0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x3f, 0xe2,
0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x10, 0x20,
0xbf, 0xff, 0xff, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x97, 0xa8,
0x3f, 0xff, 0xff, 0xa0, 0x82, 0x08, 0x20, 0x82, 0x08, 0x30, 0x22,
0x20, 0x00, 0x00, 0x88, 0x20, 0x82, 0x08, 0x20, 0x83, 0xf0, 0x20,
0xa0, 0x00, 0x00, 0x82, 0x08, 0x20, 0x82, 0x08, 0x21, 0x10, 0x28,
0x24, 0x01, 0x00, 0xa0, 0x87, 0xff, 0xff, 0xc2, 0x09, 0x1f, 0xe2,
0x29, 0xb2, 0x00, 0x88, 0x24, 0x00, 0x00, 0x60, 0x83, 0x04, 0x20,
0xa9, 0xb2, 0x50, 0x82, 0x0c, 0x00, 0x00, 0x48, 0x21, 0x06, 0x08,
0x29, 0xb2, 0x00, 0xa0, 0x87, 0xff, 0xff, 0xc2, 0x09, 0xfc, 0x82,
0x24, 0x01, 0x00, 0xbf, 0xff, 0xff, 0xff, 0xe0, 0x82, 0x08, 0x20,
0xa0, 0x00, 0x00, 0xbf, 0xff, 0xe0, 0x08, 0x48, 0x21, 0xfe, 0x08,
0x20, 0x01, 0x20, 0xe0, 0x00, 0x20, 0x0f, 0x42, 0x0a, 0x02, 0x82,
0x20, 0x00, 0x90, 0xe0, 0x00, 0x3f, 0xf8, 0x60, 0x83, 0xfe, 0x20,
0xa5, 0x48, 0x90, 0xbf, 0xff, 0xff, 0xff, 0x48, 0x20, 0x82, 0x08,
0x20, 0x00, 0x90, 0xbf, 0xff, 0xe0, 0x08, 0x42, 0x08, 0x20, 0x82,
0x20, 0x01, 0x20, 0xa0, 0x00, 0x35, 0x4f, 0x7f, 0xff, 0xff, 0xe0,
0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x20, 0x08, 0x5f, 0xff, 0xff, 0xe8,
0x20, 0x00, 0x00, 0xa0, 0x00, 0x35, 0x4f, 0x50, 0x00, 0x00, 0x22,
0x3f, 0xff, 0xff, 0xab, 0x56, 0x20, 0x08, 0x70, 0x07, 0xc0, 0x20,
0x82, 0x00, 0x00, 0x20, 0x00, 0x35, 0x0f, 0xd0, 0x0c, 0x47, 0xa8,
0x22, 0x00, 0x00, 0x2d, 0x5a, 0xa0, 0x08, 0x90, 0x0f, 0xcc, 0xa2,
0x0a, 0x00, 0x00, 0x20, 0x00, 0x34, 0x08, 0x30, 0x10, 0x17, 0xa0,
0x82, 0x00, 0x00, 0x20, 0x00, 0x20, 0x0a, 0x10, 0x17, 0xd0, 0x28,
0x22, 0x00, 0x00, 0x20, 0x00, 0x35, 0x08, 0x90, 0x2c, 0x67, 0xa2,
0x0a, 0x00, 0x00, 0x20, 0x00, 0x20, 0x08, 0x30, 0x37, 0xdc, 0xa0,
0x82, 0x00, 0x00, 0x20, 0x00, 0x35, 0x4a, 0x17, 0xe0, 0x07, 0xa8,
0x22, 0x00, 0x00, 0x20, 0x00, 0x20, 0x08, 0x94, 0x57, 0xc0, 0x22,
0x0a, 0x00, 0x00, 0x20, 0x00, 0x20, 0x08, 0x37, 0xec, 0x40, 0x20,
0x83, 0xff, 0xff, 0xe0, 0x00, 0x20, 0x0a, 0x10, 0x27, 0xc0, 0x28,
0x20, 0x82, 0x08, 0x20, 0x00, 0x20, 0x08, 0x90, 0x10, 0x00, 0x22,
0x08, 0x20, 0x82, 0x20, 0x00, 0x3f, 0xf8, 0x30, 0x1f, 0xc0, 0x20,
0x82, 0x08, 0x20, 0xa0, 0x00, 0x20, 0x82, 0x10, 0x0c, 0x40, 0x28,
0x20, 0x82, 0x08, 0x3f, 0xff, 0xe8, 0x20, 0x90, 0x07, 0xc0, 0x22,
0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x30, 0x00, 0x00, 0x20,
0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x10, 0x00, 0x00, 0x28,
0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x9f, 0xff, 0xff, 0xe2,
0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20,
0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82, 0x08,
0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x20, 0x82, 0x08, 0x20, 0x82,
0x42, 0x13, 0x18, 0xc7, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x99, 0x34, 0xa5, 0x24, 0x29, 0x26, 0x38, 0xc5, 0x04, 0x00, 0x00,
0xa1, 0x14, 0x99, 0x27, 0x35, 0x29, 0x40, 0x26, 0x9c, 0x00, 0x00,
0xa1, 0x13, 0xa4, 0xe4, 0x25, 0x29, 0x30, 0xe4, 0xa4, 0x00, 0x00,
0xa1, 0x10, 0xa4, 0x24, 0x24, 0xc9, 0x09, 0x24, 0xa4, 0x00, 0x00,
0x5a, 0x13, 0x18, 0xc7, 0xa4, 0xc6, 0x70, 0xd4, 0x9c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0xc0, 0x50, 0x84, 0x00, 0x00, 0x01, 0xc0, 0x02, 0x10, 0x20,
0x02, 0x12, 0x00, 0x48, 0xcb, 0x32, 0x22, 0x0c, 0x02, 0x38, 0x20,
0x03, 0x92, 0x50, 0x31, 0x2c, 0x49, 0x42, 0x12, 0x02, 0x10, 0xe0,
0x02, 0x12, 0x50, 0x31, 0xe8, 0x48, 0x82, 0x12, 0x02, 0x11, 0x20,
0x02, 0x16, 0x50, 0x49, 0x08, 0x49, 0x42, 0x12, 0x02, 0x15, 0x20,
0x02, 0x0a, 0x50, 0x84, 0xc8, 0x32, 0x21, 0xcc, 0x93, 0xc8, 0xe0,
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
/************************************************************************/
/* */
/* m a k e _ X i c o n */
@@ -39,6 +99,8 @@ Pixmap make_Xicon(DspInterface dsp)
{
unsigned int width, height;
int value, x_hot, y_hot;
XImage IconImage;
#ifdef TRACE
printf("In make_Xicon().\n");
@@ -68,7 +130,7 @@ Pixmap make_Xicon(DspInterface dsp)
IconPixmap = XCreatePixmap(
dsp->display_id, dsp->LispWindow, Lisp_icon_width, Lisp_icon_height,
DefaultDepthOfScreen(ScreenOfDisplay(dsp->display_id, DefaultScreen(dsp->display_id))));
(unsigned)DefaultDepthOfScreen(ScreenOfDisplay(dsp->display_id, DefaultScreen(dsp->display_id))));
XPutImage(dsp->display_id, IconPixmap, dsp->Copy_GC, &IconImage, 0, 0, 0, 0, Lisp_icon_width,
Lisp_icon_height);

View File

@@ -77,9 +77,13 @@ static XrmOptionDescRec opTable[] = {
reasons /jarl
*/
extern char Display_Name[128];
char Display_Name[128];
extern char iconpixmapfile[1024];
char iconpixmapfile[1024];
extern char Window_Title[255];
char Window_Title[255];
extern char Icon_Title[255];
char Icon_Title[255];
extern char sysout_name[];
@@ -200,7 +204,7 @@ void read_Xoption(int *argc, char *argv[])
/* protocol. */
if (XrmGetResource(commandlineDB, "ldex.display", "Ldex.Display", str_type, &value) == True) {
(void)strncpy(Display_Name, value.addr, (int)value.size);
(void)strncpy(Display_Name, value.addr, value.size);
} else if (getenv("DISPLAY") == (char *)NULL) {
fprintf(stderr, "Can't find a display. Either set the shell\n");
fprintf(stderr, "variable DISPLAY to an appropriate display\n");
@@ -241,7 +245,7 @@ void read_Xoption(int *argc, char *argv[])
if (XrmGetResource(rDB, "ldex.sysout", "Ldex.Sysout", str_type, &value) == True) {
/* Get Sysout */
(void)strncpy(sysout_name, value.addr, (int)value.size);
(void)strncpy(sysout_name, value.addr, value.size);
}
if (sysout_name[0] == '\0') {
fprintf(stderr, "Couldn't find a sysout to run;\n");
@@ -249,30 +253,30 @@ void read_Xoption(int *argc, char *argv[])
}
if (XrmGetResource(rDB, "ldex.title", "Ldex.Title", str_type, &value) == True) {
(void)strncpy(Window_Title, value.addr, (int)value.size);
(void)strncpy(Window_Title, value.addr, value.size);
} else {
(void)strcpy(Window_Title, WINDOW_NAME);
}
if (XrmGetResource(rDB, "ldex.icontitle", "Ldex.icontitle", str_type, &value) == True) {
(void)strncpy(Icon_Title, value.addr, (int)value.size);
(void)strncpy(Icon_Title, value.addr, value.size);
} else {
(void)strcpy(Icon_Title, "Medley");
}
if (XrmGetResource(rDB, "ldex.iconbitmap", "Ldex.Iconbitmap", str_type, &value) == True) {
(void)strncpy(iconpixmapfile, value.addr, (int)value.size);
(void)strncpy(iconpixmapfile, value.addr, value.size);
}
/* Old style geometry definition. */
if (XrmGetResource(rDB, "ldex.geometry", "Ldex.geometry", str_type, &value) == True) {
/* Get Geometry */
(void)strncpy(tmp, value.addr, (int)value.size);
(void)strncpy(tmp, value.addr, value.size);
bitmask = XParseGeometry(tmp, &LispWindowRequestedX, &LispWindowRequestedY,
&LispWindowRequestedWidth, &LispWindowRequestedHeight);
}
if (XrmGetResource(rDB, "ldex.screen", "Ldex.screen", str_type, &value) == True) {
/* Get Geometry */
(void)strncpy(tmp, value.addr, (int)value.size);
(void)strncpy(tmp, value.addr, value.size);
bitmask = XParseGeometry(tmp, &LispDisplayRequestedX, &LispDisplayRequestedY,
&LispDisplayRequestedWidth, &LispDisplayRequestedHeight);
}
@@ -291,12 +295,12 @@ void read_Xoption(int *argc, char *argv[])
"ldex.maxpages",
"Ldex.maxpages",
str_type, &value) == True) {
(void)strncpy(tmp, value.addr, (int)value.size);
(void)strncpy(tmp, value.addr, value.size);
maxpages = atoi(tmp);
}
*/
if (XrmGetResource(rDB, "ldex.memory", "Ldex.memory", str_type, &value) == True) {
(void)strncpy(tmp, value.addr, (int)value.size);
(void)strncpy(tmp, value.addr, value.size);
errno = 0;
i = (int)strtol(tmp, (char **)NULL, 10);
if (errno == 0 && i > 0)
@@ -309,7 +313,7 @@ void read_Xoption(int *argc, char *argv[])
#ifdef MAIKO_ENABLE_ETHERNET
if (XrmGetResource(rDB, "ldex.EtherNet", "Ldex.EtherNet", str_type, &value) == True) {
int b0, b1, b2, b3, b4, b5;
(void)strncpy(tmp, value.addr, (int)value.size);
(void)strncpy(tmp, value.addr, value.size);
#if defined(USE_DLPI)
if (sscanf(tmp, "%d:%x:%x:%x:%x:%x:%x", &ether_fd, &b0, &b1, &b2, &b3, &b4, &b5) == 7)
#elif defined(USE_NIT)

View File

@@ -15,34 +15,44 @@
#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;
/* 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 = bound(0, newX, dsp->Display.width - dsp->Visible.width);
dsp->Visible.y = bound(0, newY, dsp->Display.height - dsp->Visible.height);
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 = (int)((dsp->Visible.x * dsp->Visible.width) / dsp->Display.width);
newY = (int)((dsp->Visible.y * dsp->Visible.height) / dsp->Display.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, -dsp->InternalBorderWidth);
XMoveWindow(dsp->display_id, dsp->VerScrollButton, -dsp->InternalBorderWidth, newY);
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) / dsp->Visible.height)); }
{ 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) / dsp->Visible.width), dsp->Visible.y); }
{ 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); }

View File

@@ -23,7 +23,7 @@
#include "xdefs.h" // for XLOCK, XUNLOCK
#include "xlspwindefs.h" // for DoRing
#include "xscrolldefs.h" // for JumpScrollHor, JumpScrollVer, Scroll, Scro...
#include "xwinmandefs.h" // for Set_BitGravity, beep_Xkeyboard, bound, dis...
#include "xwinmandefs.h" // for Set_BitGravity, beep_Xkeyboard, dis...
int Mouse_Included = FALSE;
@@ -51,15 +51,15 @@ extern u_char *SUNLispKeyMap;
#define MOUSE_RIGHT 14
#define MOUSE_MIDDLE 15
/* bound: return b if it is between a and c otherwise it returns a or c */
int bound(int a, int b, int c)
/* ubound: return (unsigned) value if it is between lower and upper otherwise lower or upper */
static inline unsigned ubound(unsigned lower, unsigned value, unsigned upper)
{
if (b <= a)
return (a);
else if (b >= c)
return (c);
if (value <= lower)
return (lower);
else if (value >= upper)
return (upper);
else
return (b);
return (value);
}
void Set_BitGravity(XButtonEvent *event, DspInterface dsp, Window window, int grav)
@@ -85,50 +85,51 @@ void Set_BitGravity(XButtonEvent *event, DspInterface dsp, Window window, int gr
XUNLOCK(dsp);
} /* end Set_BitGravity */
static void lisp_Xconfigure(DspInterface dsp, int x, int y, int lspWinWidth, int lspWinHeight)
static void lisp_Xconfigure(DspInterface dsp, int x, int y, unsigned lspWinWidth, unsigned lspWinHeight)
{
int GravSize, Col2, Row2, Col3, Row3;
int Col2, Row2, Col3, Row3;
unsigned int GravSize;
/* The Visible width and height changes when */
/* we configure the window. Make them */
/* stay within bounds. */
dsp->Visible.width =
bound(OUTER_SB_WIDTH(dsp) + 2, lspWinWidth, dsp->Display.width + OUTER_SB_WIDTH(dsp)) -
ubound(OUTER_SB_WIDTH(dsp) + 2, lspWinWidth, dsp->Display.width + OUTER_SB_WIDTH(dsp)) -
OUTER_SB_WIDTH(dsp);
dsp->Visible.height =
bound(OUTER_SB_WIDTH(dsp) + 2, lspWinHeight, dsp->Display.height + OUTER_SB_WIDTH(dsp)) -
ubound(OUTER_SB_WIDTH(dsp) + 2, lspWinHeight, dsp->Display.height + OUTER_SB_WIDTH(dsp)) -
OUTER_SB_WIDTH(dsp);
GravSize = (int)(dsp->ScrollBarWidth / 2) - (dsp->InternalBorderWidth);
Col2 = dsp->Visible.width;
Row2 = dsp->Visible.height;
Col3 = dsp->Visible.width + (int)(OUTER_SB_WIDTH(dsp) / 2);
Row3 = dsp->Visible.height + (int)(OUTER_SB_WIDTH(dsp) / 2);
GravSize = (dsp->ScrollBarWidth / 2) - (dsp->InternalBorderWidth);
Col2 = (int)dsp->Visible.width;
Row2 = (int)dsp->Visible.height;
Col3 = (int)(dsp->Visible.width + (OUTER_SB_WIDTH(dsp) / 2));
Row3 = (int)(dsp->Visible.height + (OUTER_SB_WIDTH(dsp) / 2));
XLOCK;
XMoveResizeWindow(dsp->display_id, dsp->DisplayWindow, 0, 0, dsp->Visible.width,
dsp->Visible.height);
if (noscroll == 0) {
/* Scroll bars */
XMoveResizeWindow(dsp->display_id, dsp->VerScrollBar, Col2, 0 - dsp->InternalBorderWidth, /* y */
XMoveResizeWindow(dsp->display_id, dsp->VerScrollBar, Col2, 0 - (int)dsp->InternalBorderWidth, /* y */
dsp->ScrollBarWidth, /* width */
dsp->Visible.height); /* height */
XMoveResizeWindow(dsp->display_id, dsp->HorScrollBar, 0 - dsp->InternalBorderWidth, Row2, /* y */
XMoveResizeWindow(dsp->display_id, dsp->HorScrollBar, 0 - (int)dsp->InternalBorderWidth, Row2, /* y */
dsp->Visible.width, /* width */
dsp->ScrollBarWidth); /* height */
/* Scroll buttons */
XMoveResizeWindow(
dsp->display_id, dsp->HorScrollButton,
(int)((dsp->Visible.x * dsp->Visible.width) / dsp->Display.width), /* x */
0 - dsp->InternalBorderWidth, /* y */
(int)((dsp->Visible.width * dsp->Visible.width) / dsp->Display.width) + 1, /* width */
(dsp->Visible.x * (int)dsp->Visible.width) / (int)dsp->Display.width, /* x */
0 - (int)dsp->InternalBorderWidth, /* y */
((dsp->Visible.width * dsp->Visible.width) / dsp->Display.width) + 1, /* width */
dsp->ScrollBarWidth); /* height */
XMoveResizeWindow(
dsp->display_id, dsp->VerScrollButton, 0 - dsp->InternalBorderWidth, /* x */
(int)((dsp->Visible.y * dsp->Visible.height) / dsp->Display.height), /* y */
dsp->display_id, dsp->VerScrollButton, 0 - (int)dsp->InternalBorderWidth, /* x */
(dsp->Visible.y * (int)dsp->Visible.height) / (int)dsp->Display.height, /* y */
dsp->ScrollBarWidth, /* width */
(int)((dsp->Visible.height * dsp->Visible.height) / dsp->Display.height) + 1); /* height */
((dsp->Visible.height * dsp->Visible.height) / dsp->Display.height) + 1); /* height */
/* Gravity windows */
XMoveResizeWindow(dsp->display_id, dsp->NWGrav, Col2, Row2, GravSize, GravSize);
@@ -245,8 +246,8 @@ void process_Xevents(DspInterface dsp)
else if (report.xany.window == dsp->LispWindow)
switch (report.xany.type) {
case ConfigureNotify:
lisp_Xconfigure(dsp, report.xconfigure.x, report.xconfigure.y, report.xconfigure.width,
report.xconfigure.height);
lisp_Xconfigure(dsp, report.xconfigure.x, report.xconfigure.y, (unsigned)report.xconfigure.width,
(unsigned)report.xconfigure.height);
break;
case EnterNotify: enable_Xkeyboard(currentdsp); break;
case LeaveNotify: break;
@@ -290,6 +291,7 @@ void process_Xevents(DspInterface dsp)
break;
default: break;
} /* end switch */
break;
default: break;
}
else if (report.xany.window == dsp->VerScrollBar)