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

Reformat all C source files with Clang-format in Google style w/ 100 col width.

This commit is contained in:
Nick Briggs
2017-05-28 18:08:18 -07:00
parent 691645d048
commit 156c3292f8
167 changed files with 40520 additions and 48069 deletions

718
src/mnwevent.c Executable file → Normal file
View File

@@ -1,10 +1,7 @@
/* $Id: mnwevent.c,v 1.2 1999/01/03 02:07:25 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* $Id: mnwevent.c,v 1.2 1999/01/03 02:07:25 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
static char *id = "$Id: mnwevent.c,v 1.2 1999/01/03 02:07:25 sybalsky Exp $ Copyright (C) Venue";
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
@@ -20,8 +17,6 @@ static char *id = "$Id: mnwevent.c,v 1.2 1999/01/03 02:07:25 sybalsky Exp $ Copy
#include "version.h"
#include <stdio.h>
#include <X11/Xlib.h>
@@ -40,15 +35,15 @@ static char *id = "$Id: mnwevent.c,v 1.2 1999/01/03 02:07:25 sybalsky Exp $ Copy
#ifndef FALSE
#define FALSE 0
#define TRUE !FALSE
#define TRUE !FALSE
#endif /* FALSE */
extern XEvent report;
extern DLword *CTopMNWEvent;
int MNWEventFlg=0; /* Count of MNW events needing service */
int MNWEventFlg = 0; /* Count of MNW events needing service */
DspInterfaceRec *FD_to_dspif[32]; /* Map from FD # to a display */
DspInterfaceRec *FD_to_dspif[32]; /* Map from FD # to a display */
int MNWReadFds = 0;
DLword *CTopMNWEvent;
@@ -57,12 +52,8 @@ LispPTR *MNWEVENTQUEUE68k;
extern LispPTR *MakeAtom68k();
extern DLword *EmCursorX68K
, *EmCursorY68K;
extern DLword *EmMouseX68K
, *EmMouseY68K
, *EmKbdAd068K
, *EmRealUtilin68K;
extern DLword *EmCursorX68K, *EmCursorY68K;
extern DLword *EmMouseX68K, *EmMouseY68K, *EmKbdAd068K, *EmRealUtilin68K;
extern LispPTR *CLastUserActionCell68k;
extern MISCSTATS *MiscStats;
@@ -78,26 +69,25 @@ LispPTR *MNWBUFFERING68k = 0;
/* at the head of the chain. (This is bubblesort) */
/* */
/************************************************************************/
WindowInterface Find_window(dspif, Xwindow)
DspInterface dspif;
Window Xwindow;
WindowInterface Find_window(dspif, Xwindow) DspInterface dspif;
Window Xwindow;
{
WindowInterface curr, prev;
if(dspif->CreatedWifs == (WindowInterface)NULL) return(NIL);
if(dspif->CreatedWifs->blackframe == Xwindow) return(dspif->CreatedWifs);
if (dspif->CreatedWifs == (WindowInterface)NULL) return (NIL);
if (dspif->CreatedWifs->blackframe == Xwindow) return (dspif->CreatedWifs);
/* Find the wif we are interested in. */
for(prev = dspif->CreatedWifs, curr = prev->next;
((curr != (WindowInterface)NULL) && (curr->blackframe != Xwindow));
curr = curr->next, prev = prev->next){}
if(curr == (WindowInterface)NULL) return(NIL); /* wif not found */
for (prev = dspif->CreatedWifs, curr = prev->next;
((curr != (WindowInterface)NULL) && (curr->blackframe != Xwindow));
curr = curr->next, prev = prev->next) {}
if (curr == (WindowInterface)NULL) return (NIL); /* wif not found */
/* Bubble curr to the head of the list */
prev->next = curr->next;
curr->next = dspif->CreatedWifs;
dspif->CreatedWifs = curr;
return(curr);
return (curr);
}
/************************************************************************/
@@ -111,55 +101,52 @@ WindowInterface Find_window(dspif, Xwindow)
/* Get a pointer to the next event in line in the Lisp eventqueue. */
/* Return NULL if fail. This is the head of DoRing. */
/************************************************************************/
MNWEvent *NewEvent()
{
if (! CTopMNWEvent )
{
LispPTR index;
index = get_package_atom("\\MNWEVENTQUEUE", 14, "INTERLISP", 9, NIL);
if (index != 0xFFFFFFFF)
{
MNWEVENTQUEUE68k = GetVALCELL68k(index);
DOMNWEVENT_index = get_package_atom("\\DOMNWEVENT", 11, "INTERLISP", 9, NIL);
CTopMNWEvent= (DLword*)Addr68k_from_LADDR(*MNWEVENTQUEUE68k);
}
MNWEvent *NewEvent() {
if (!CTopMNWEvent) {
LispPTR index;
index = get_package_atom("\\MNWEVENTQUEUE", 14, "INTERLISP", 9, NIL);
if (index != 0xFFFFFFFF) {
MNWEVENTQUEUE68k = GetVALCELL68k(index);
DOMNWEVENT_index = get_package_atom("\\DOMNWEVENT", 11, "INTERLISP", 9, NIL);
CTopMNWEvent = (DLword *)Addr68k_from_LADDR(*MNWEVENTQUEUE68k);
}
if (CTopMNWEvent)
{ DLword w, r;
r=RING_READ(CTopMNWEvent);
w=RING_WRITE(CTopMNWEvent);
}
if (CTopMNWEvent) {
DLword w, r;
r = RING_READ(CTopMNWEvent);
w = RING_WRITE(CTopMNWEvent);
if (r != w) return((MNWEvent*)(CTopMNWEvent+ w));
}
return(NULL);
if (r != w) return ((MNWEvent *)(CTopMNWEvent + w));
}
return (NULL);
}
/************************************************************************/
/* SignalMNWEvent */
/* Tell Lisp that an event happened. This is the tail part of DoRing */
/* */
/************************************************************************/
SignalMNWEvent()
{
SignalMNWEvent() {
DLword w, r;
if (CTopMNWEvent) {
r=RING_READ(CTopMNWEvent);
w=RING_WRITE(CTopMNWEvent);
r = RING_READ(CTopMNWEvent);
w = RING_WRITE(CTopMNWEvent);
if(r==0) /* Queue was empty */
((RING*)CTopMNWEvent)->read=w;
if(w >= MAXMNWEVENT) ((RING*)CTopMNWEvent)->write = MINMNWEVENT;
else ((RING*)CTopMNWEvent)->write = w + MNWEVENTSIZE;
if (r == 0) /* Queue was empty */
((RING *)CTopMNWEvent)->read = w;
if (w >= MAXMNWEVENT)
((RING *)CTopMNWEvent)->write = MINMNWEVENT;
else
((RING *)CTopMNWEvent)->write = w + MNWEVENTSIZE;
if (*MNWBUFFERING68k == NIL) *MNWBUFFERING68k = ATOM_T;
if (*MNWBUFFERING68k == NIL) *MNWBUFFERING68k = ATOM_T;
if (MNWEventFlg++ > 0) Irq_Stk_End = Irq_Stk_Check = 0; /* Ask for interrupt */
}
}
void HandleMotion(widget, wif, xevent, continue_to_dispatch)
Widget widget;
WindowInterface wif;
XMotionEvent *xevent;
Boolean *continue_to_dispatch;
void HandleMotion(widget, wif, xevent, continue_to_dispatch) Widget widget;
WindowInterface wif;
XMotionEvent *xevent;
Boolean *continue_to_dispatch;
{
MNWPointerMotionEvent *mevent;
@@ -167,42 +154,34 @@ void HandleMotion(widget, wif, xevent, continue_to_dispatch)
*CLastUserActionCell68k = MiscStats->secondstmp;
(*((DLword *)EmMouseX68K)) = *EmCursorX68K = xevent->x_root;
(*((DLword *)EmMouseY68K)) = *EmCursorY68K = xevent->y_root;
/* printf("mouse x %d, y %d\n", xevent->x_root, xevent->y_root); */
/* printf("mouse x %d, y %d\n", xevent->x_root, xevent->y_root); */
DoRing();
if(( KBDEventFlg ) > 0)
{
/* immidiately request for IRQ check */
Irq_Stk_End=Irq_Stk_Check=0;
}
if ((KBDEventFlg) > 0) {
/* immidiately request for IRQ check */
Irq_Stk_End = Irq_Stk_Check = 0;
}
}
}
void HandleButton(widget, wif, xevent, continue_to_dispatch)
Widget widget;
WindowInterface wif;
XButtonEvent *xevent;
Boolean *continue_to_dispatch;
void HandleButton(widget, wif, xevent, continue_to_dispatch) Widget widget;
WindowInterface wif;
XButtonEvent *xevent;
Boolean *continue_to_dispatch;
{
MNWButtonEvent *mevent;
lisp_Xbutton(xevent, 0);
}
void HandleKey(widget, wif, xevent, continue_to_dispatch)
Widget widget;
WindowInterface wif;
XKeyEvent *xevent;
Boolean *continue_to_dispatch;
void HandleKey(widget, wif, xevent, continue_to_dispatch) Widget widget;
WindowInterface wif;
XKeyEvent *xevent;
Boolean *continue_to_dispatch;
{
lisp_Xkeyboard(xevent, 0);
#ifdef NEVER
if((mevent = NewEvent()) != NULL){
if ((mevent = NewEvent()) != NULL) {
mevent->screen = wif->MedleyScreen;
mevent->window = wif->MedleyWindow;
mevent->event = MNWButton;
@@ -216,230 +195,198 @@ void HandleKey(widget, wif, xevent, continue_to_dispatch)
#endif /* NEVER */
}
void HandleCrossing(widget, wif, xevent, continue_to_dispatch)
Widget widget;
WindowInterface wif;
XCrossingEvent *xevent;
Boolean *continue_to_dispatch;
void HandleCrossing(widget, wif, xevent, continue_to_dispatch) Widget widget;
WindowInterface wif;
XCrossingEvent *xevent;
Boolean *continue_to_dispatch;
{
switch (xevent->type)
{
case EnterNotify: DoMNWRing(MNWMouseIn, wif->MedleyScreen, wif->MedleyWindow, 0, 0, 0, 0);
break;
switch (xevent->type) {
case EnterNotify:
DoMNWRing(MNWMouseIn, wif->MedleyScreen, wif->MedleyWindow, 0, 0, 0, 0);
break;
case LeaveNotify: if (NotifyInferior != xevent->detail)
DoMNWRing(MNWMouseOut, wif->MedleyScreen, wif->MedleyWindow, 0, 0, 0, 0);
break;
}
case LeaveNotify:
if (NotifyInferior != xevent->detail)
DoMNWRing(MNWMouseOut, wif->MedleyScreen, wif->MedleyWindow, 0, 0, 0, 0);
break;
}
}
void HandleBackgroundCrossing(widget, dspif, xevent, continue_to_dispatch)
Widget widget;
DspInterface dspif;
XCrossingEvent *xevent;
Boolean *continue_to_dispatch;
void HandleBackgroundCrossing(widget, dspif, xevent, continue_to_dispatch) Widget widget;
DspInterface dspif;
XCrossingEvent *xevent;
Boolean *continue_to_dispatch;
{
switch (xevent->type)
{
case EnterNotify: DoMNWRing(MNWMouseIn, dspif->screen, 0, 0, 0, 0, 0);
break;
switch (xevent->type) {
case EnterNotify: DoMNWRing(MNWMouseIn, dspif->screen, 0, 0, 0, 0, 0); break;
case LeaveNotify: if (NotifyInferior != xevent->detail)
DoMNWRing(MNWMouseOut, dspif->screen, 0, 0, 0, 0, 0);
break;
}
case LeaveNotify:
if (NotifyInferior != xevent->detail) DoMNWRing(MNWMouseOut, dspif->screen, 0, 0, 0, 0, 0);
break;
}
}
void HandleFocus(widget, wif, xevent, continue_to_dispatch)
Widget widget;
WindowInterface wif;
XFocusChangeEvent *xevent;
Boolean *continue_to_dispatch;
void HandleFocus(widget, wif, xevent, continue_to_dispatch) Widget widget;
WindowInterface wif;
XFocusChangeEvent *xevent;
Boolean *continue_to_dispatch;
{
MNWFocusEvent *mevent;
/*
if((mevent = (MNWFocusEvent *)NewEvent()) != NULL){
mevent->screen = wif->MedleyScreen;
mevent->window = wif->MedleyWindow;
if(xevent->type == FocusIn) mevent->event = MNWFocusIn;
else mevent->event = MNWFocusOut;
SignalMNWEvent();
}
*/
/*
if((mevent = (MNWFocusEvent *)NewEvent()) != NULL){
mevent->screen = wif->MedleyScreen;
mevent->window = wif->MedleyWindow;
if(xevent->type == FocusIn) mevent->event = MNWFocusIn;
else mevent->event = MNWFocusOut;
SignalMNWEvent();
}
*/
}
void HandleStructure(widget, wif, xevent, continue_to_dispatch)
Widget widget;
WindowInterface wif;
XAnyEvent *xevent;
Boolean *continue_to_dispatch;
void HandleStructure(widget, wif, xevent, continue_to_dispatch) Widget widget;
WindowInterface wif;
XAnyEvent *xevent;
Boolean *continue_to_dispatch;
{
LispPTR screen, MWindow;
Window window;
Display *display;
DspInterfaceRec *dspif;
LispPTR screen, MWindow;
Window window;
Display *display;
DspInterfaceRec *dspif;
screen = wif->MedleyScreen;
MWindow = wif->MedleyWindow;
window = xevent->window;
dspif = wif->dspif;
display = dspif->handle;
screen = wif->MedleyScreen;
MWindow = wif->MedleyWindow;
window = xevent->window;
dspif = wif->dspif;
display = dspif->handle;
switch (xevent->type)
{
case UnmapNotify: DoMNWRing(MNWClose, screen, MWindow, 0, 0, 0, 0);
break;
switch (xevent->type) {
case UnmapNotify: DoMNWRing(MNWClose, screen, MWindow, 0, 0, 0, 0); break;
case MapNotify: break;
case MapNotify: break;
case ConfigureNotify: if (!wif) break; /* don't change inner windows */
/* if (wif->moving || wif->reshaping)
{
wif->moving = wif->reshaping = 0;
break;
}
else */
{
int l, b, b2, w, h;
XConfigureEvent *ev = (XConfigureEvent *) xevent;
/* printf("M/S event send %d, x %d, y %d, w %d, h %d\n",
xevent->send_event, ev->x, ev->y,
ev->width, ev->height); */
case ConfigureNotify:
if (!wif) break; /* don't change inner windows */
/* if (wif->moving || wif->reshaping)
{
wif->moving = wif->reshaping = 0;
break;
}
else */
{
int l, b, b2, w, h;
XConfigureEvent *ev = (XConfigureEvent *)xevent;
/* printf("M/S event send %d, x %d, y %d, w %d, h %d\n",
xevent->send_event, ev->x, ev->y,
ev->width, ev->height); */
l = ev->x;
b = ev->y;
l = ev->x;
b = ev->y;
#ifdef INDIGO
/* apparent bug in SGI's x server */
if ((!xevent->send_event) && (l==0) && (b == 0))
/* apparent bug in SGI's x server */
if ((!xevent->send_event) && (l == 0) && (b == 0))
#else
if ((!xevent->send_event))
if ((!xevent->send_event))
#endif /* INDIGO */
{
Window parent, root, *children;
int nch;
{
Window parent, root, *children;
int nch;
XQueryTree(display, window, &root, &parent, &children, &nch);
XFree(children);
if (parent != root) XTranslateCoordinates(display, parent,
dspif->root,
ev->x, ev->y,
&l, &b, &window);
/* printf("[translated x %d, y %d]\n", l, b); */
}
XQueryTree(display, window, &root, &parent, &children, &nch);
XFree(children);
if (parent != root)
XTranslateCoordinates(display, parent, dspif->root, ev->x, ev->y, &l, &b, &window);
/* printf("[translated x %d, y %d]\n", l, b); */
}
b2 = HeightOfScreen(wif->screen) - b - ev->height;
if ((wif->topregion.width == ev->width) &&
(wif->topregion.height == ev->height))
{
if ((wif->topregion.x != l) || (wif->topregion.y != b))
{
/* printf("movew to %d, %d.\n", l+wif->outerregion.x, b2+wif->outerregion.y); */
DoMNWRing(MNWMove, screen, MWindow, l+wif->outerregion.x, b2+wif->outerregion.y,
ev->width-(wif->topregion.width - wif->outerregion.width), ev->height-(wif->topregion.height - wif->outerregion.height));
b2 = HeightOfScreen(wif->screen) - b - ev->height;
if ((wif->topregion.width == ev->width) && (wif->topregion.height == ev->height)) {
if ((wif->topregion.x != l) || (wif->topregion.y != b)) {
/* printf("movew to %d, %d.\n", l+wif->outerregion.x, b2+wif->outerregion.y); */
DoMNWRing(MNWMove, screen, MWindow, l + wif->outerregion.x, b2 + wif->outerregion.y,
ev->width - (wif->topregion.width - wif->outerregion.width),
ev->height - (wif->topregion.height - wif->outerregion.height));
}
} else /* if ((ev->x != wif->outerregion.x) || (ev->y != wif->outerregion.y)) */
{
/* printf("shapew to %d, %d, %d, %d.\n", l+wif->outerregion.x, b2+wif->outerregion.y,
ev->width-(wif->topregion.width - wif->outerregion.width),
ev->height-(wif->topregion.height - wif->outerregion.height)); */
DoMNWRing(MNWShapeReq, screen, MWindow, l + wif->outerregion.x, b2 + wif->outerregion.y,
ev->width - (wif->topregion.width - wif->outerregion.width),
ev->height - (wif->topregion.height - wif->outerregion.height));
}
}
else /* if ((ev->x != wif->outerregion.x) || (ev->y != wif->outerregion.y)) */
{
/* printf("shapew to %d, %d, %d, %d.\n", l+wif->outerregion.x, b2+wif->outerregion.y,
ev->width-(wif->topregion.width - wif->outerregion.width), ev->height-(wif->topregion.height - wif->outerregion.height)); */
DoMNWRing(MNWShapeReq, screen, MWindow, l+wif->outerregion.x, b2+wif->outerregion.y,
ev->width-(wif->topregion.width - wif->outerregion.width), ev->height-(wif->topregion.height - wif->outerregion.height));
}
}
break;
break;
case ReparentNotify: if (wif) wif->parent = ((XReparentEvent *)xevent)->parent;
break;
}
case ReparentNotify:
if (wif) wif->parent = ((XReparentEvent *)xevent)->parent;
break;
}
}
void HandleBackgroundButton(widget, wif, xevent, continue_to_dispatch)
Widget widget;
LispPTR wif;
XButtonEvent *xevent;
Boolean *continue_to_dispatch;
void HandleBackgroundButton(widget, wif, xevent, continue_to_dispatch) Widget widget;
LispPTR wif;
XButtonEvent *xevent;
Boolean *continue_to_dispatch;
{
MNWButtonEvent *mevent;
{ /* Copied from HandleMotion -- tell Lisp of mouse move */
*CLastUserActionCell68k = MiscStats->secondstmp;
(*((DLword *)EmMouseX68K)) = *EmCursorX68K = xevent->x_root;
(*((DLword *)EmMouseY68K)) = *EmCursorY68K = xevent->y_root;
DoRing();
if(( KBDEventFlg ) > 0)
{
/* immediately request for IRQ check */
Irq_Stk_End=Irq_Stk_Check=0;
}
if ((KBDEventFlg) > 0) {
/* immediately request for IRQ check */
Irq_Stk_End = Irq_Stk_Check = 0;
}
}
lisp_Xbutton(xevent, 0);
#ifdef NEVER
if((xevent->type == ButtonPress) &&
((mevent = (MNWButtonEvent *)NewEvent()) != NULL))
{
mevent->screen = wif/*->MedleyScreen*/;
mevent->window = 0;
mevent->event = MNWButton;
mevent->pos.x = xevent->x_root;
mevent->pos.y = xevent->y_root;
mevent->button.left = xevent->state | Button1Mask;
mevent->button.middle = xevent->state | Button2Mask;
mevent->button.right = xevent->state | Button3Mask;
SignalMNWEvent();
}
if ((xevent->type == ButtonPress) && ((mevent = (MNWButtonEvent *)NewEvent()) != NULL)) {
mevent->screen = wif /*->MedleyScreen*/;
mevent->window = 0;
mevent->event = MNWButton;
mevent->pos.x = xevent->x_root;
mevent->pos.y = xevent->y_root;
mevent->button.left = xevent->state | Button1Mask;
mevent->button.middle = xevent->state | Button2Mask;
mevent->button.right = xevent->state | Button3Mask;
SignalMNWEvent();
}
#endif
}
/* Handle expose events on the frame widget -- print the title */
void HandleTitle(widget, wif, xevent, continue_to_dispatch)
Widget widget;
WindowInterface wif;
XExposeEvent *xevent;
Boolean *continue_to_dispatch;
void HandleTitle(widget, wif, xevent, continue_to_dispatch) Widget widget;
WindowInterface wif;
XExposeEvent *xevent;
Boolean *continue_to_dispatch;
{
if (xevent->y <= 12) showtitle(wif->MedleyWindow,
((MedleyWindow)Cptr(wif->MedleyWindow))->WTITLE);
if (xevent->y <= 12)
showtitle(wif->MedleyWindow, ((MedleyWindow)Cptr(wif->MedleyWindow))->WTITLE);
}
/* Handle expose events on the frame widget -- print the title */
void HandleExpose(widget, wif, xevent, continue_to_dispatch)
Widget widget;
WindowInterface wif;
XExposeEvent *xevent;
Boolean *continue_to_dispatch;
{
XCopyPlane(wif->dspif->handle, wif->backing, XtWindow(wif->windowwidget),
wif->ReplaceGC,
xevent->x, xevent->y, xevent->width, xevent->height,
xevent->x, xevent->y, 1);
}
void HandleExpose(widget, wif, xevent, continue_to_dispatch) Widget widget;
WindowInterface wif;
XExposeEvent *xevent;
Boolean *continue_to_dispatch;
{
XCopyPlane(wif->dspif->handle, wif->backing, XtWindow(wif->windowwidget), wif->ReplaceGC,
xevent->x, xevent->y, xevent->width, xevent->height, xevent->x, xevent->y, 1);
}
void SignalVJmpScroll(widget, wif, percent_ptr)
Widget widget;
WindowInterface wif;
XtPointer percent_ptr; /* This is a *float */
void SignalVJmpScroll(widget, wif, percent_ptr) Widget widget;
WindowInterface wif;
XtPointer percent_ptr; /* This is a *float */
{
MNWJumpScrollReqEvent *event;
if((event = (MNWJumpScrollReqEvent *)NewEvent()) != NULL){
if ((event = (MNWJumpScrollReqEvent *)NewEvent()) != NULL) {
event->screen = wif->MedleyScreen;
event->window = wif->MedleyWindow;
event->event = MNWScrollJmpReq;
@@ -449,14 +396,13 @@ void SignalVJmpScroll(widget, wif, percent_ptr)
}
}
void SignalHJmpScroll(widget, wif, percent_ptr)
Widget widget;
WindowInterface wif;
XtPointer percent_ptr; /* This is a *float */
void SignalHJmpScroll(widget, wif, percent_ptr) Widget widget;
WindowInterface wif;
XtPointer percent_ptr; /* This is a *float */
{
MNWJumpScrollReqEvent *event;
if((event = (MNWJumpScrollReqEvent *)NewEvent()) != NULL){
if ((event = (MNWJumpScrollReqEvent *)NewEvent()) != NULL) {
event->screen = wif->MedleyScreen;
event->window = wif->MedleyWindow;
event->event = MNWScrollJmpReq;
@@ -466,14 +412,13 @@ void SignalHJmpScroll(widget, wif, percent_ptr)
}
}
void SignalVScroll(widget, wif, position)
Widget widget;
WindowInterface wif;
int position;
void SignalVScroll(widget, wif, position) Widget widget;
WindowInterface wif;
int position;
{
MNWScrollReqEvent *event;
if((event = (MNWScrollReqEvent *)NewEvent()) != NULL){
if ((event = (MNWScrollReqEvent *)NewEvent()) != NULL) {
event->screen = wif->MedleyScreen;
event->window = wif->MedleyWindow;
event->event = MNWScrollReq;
@@ -483,26 +428,22 @@ void SignalVScroll(widget, wif, position)
}
}
void SignalHScroll(widget, wif, position)
Widget widget;
WindowInterface wif;
int position;
void SignalHScroll(widget, wif, position) Widget widget;
WindowInterface wif;
int position;
{
MNWScrollReqEvent *event;
if((event = (MNWScrollReqEvent *)NewEvent()) != NULL){
if ((event = (MNWScrollReqEvent *)NewEvent()) != NULL) {
event->screen = wif->MedleyScreen;
event->window = wif->MedleyWindow;
event->event = MNWScrollReq;
event->dy = 0;
event->dx = - position;
event->dx = -position;
SignalMNWEvent();
}
}
/************************************************************************/
/* */
/* */
@@ -510,8 +451,7 @@ void SignalHScroll(widget, wif, position)
/* */
/* */
/************************************************************************/
getMNWsignaldata(fd)
int fd;
getMNWsignaldata(fd) int fd;
{
Display *display;
DspInterfaceRec *dspif;
@@ -522,113 +462,101 @@ getMNWsignaldata(fd)
LispPTR screen;
display = (dspif = FD_to_dspif[fd])->handle;
screen = dspif->screen;
TPRINT(( "TRACE: getXsignaldata()\n" ));
screen = dspif->screen;
TPRINT(("TRACE: getXsignaldata()\n"));
while(XtAppPending(dspif->xtcontext))
{
XtAppNextEvent(dspif->xtcontext, &report);
XtDispatchEvent(&report);
}
while (XtAppPending(dspif->xtcontext)) {
XtAppNextEvent(dspif->xtcontext, &report);
XtDispatchEvent(&report);
}
#ifdef NEVER
while(XPending(display))
{
/* XtAppNextEvent(dspif->xtcontext, &report); */
XNextEvent( display, &report );
window = report.xany.window;
while (XPending(display)) {
/* XtAppNextEvent(dspif->xtcontext, &report); */
XNextEvent(display, &report);
window = report.xany.window;
wif = Find_window(dspif, window);
wif = Find_window(dspif, window);
if (wif) {
switch (report.type) {
case KeyPress:
case KeyRelease: lisp_Xkeyboard(&report, 0);
break;
if (wif) {
switch (report.type) {
case KeyPress:
case KeyRelease: lisp_Xkeyboard(&report, 0); break;
case ButtonPress:
case ButtonRelease: lisp_Xbutton(&report, 0);
break;
case ButtonPress:
case ButtonRelease: lisp_Xbutton(&report, 0); break;
case MotionNotify: {
*CLastUserActionCell68k = MiscStats->secondstmp;
(*((DLword *)EmMouseX68K)) = *EmCursorX68K = report.xmotion.x_root;
(*((DLword *)EmMouseY68K)) = *EmCursorY68K = report.xmotion.y_root;
DoRing();
if(( KBDEventFlg ) > 0)
{
/* immidiately request for IRQ check */
Irq_Stk_End=Irq_Stk_Check=0;
}
}
break;
case MotionNotify: {
*CLastUserActionCell68k = MiscStats->secondstmp;
(*((DLword *)EmMouseX68K)) = *EmCursorX68K = report.xmotion.x_root;
(*((DLword *)EmMouseY68K)) = *EmCursorY68K = report.xmotion.y_root;
DoRing();
if ((KBDEventFlg) > 0) {
/* immidiately request for IRQ check */
Irq_Stk_End = Irq_Stk_Check = 0;
}
} break;
case EnterNotify: if (MWindow) DoMNWRing(MNWMouseIn, screen, MWindow, 0, 0, 0, 0);
break;
case EnterNotify:
if (MWindow) DoMNWRing(MNWMouseIn, screen, MWindow, 0, 0, 0, 0);
break;
case LeaveNotify: if (NotifyInferior != report.xcrossing.detail)
DoMNWRing(MNWMouseOut, screen, MWindow, 0, 0, 0, 0);
break;
case LeaveNotify:
if (NotifyInferior != report.xcrossing.detail)
DoMNWRing(MNWMouseOut, screen, MWindow, 0, 0, 0, 0);
break;
case FocusIn: DoMNWRing(MNWFocusIn, screen, MWindow, 0, 0, 0, 0);
break;
case FocusIn: DoMNWRing(MNWFocusIn, screen, MWindow, 0, 0, 0, 0); break;
case FocusOut: DoMNWRing(MNWFocusOut, screen, MWindow, 0, 0, 0, 0);
break;
case FocusOut: DoMNWRing(MNWFocusOut, screen, MWindow, 0, 0, 0, 0); break;
case Expose: if (wif->not_exposed)
{
char *tmpstring;
BITMAP *bitmap;
showtitle(MWindow, ((MedleyWindow)Cptr(MWindow))->WTITLE);
bitmap = (BITMAP *)Cptr(((MedleyWindow)Cptr(MWindow))->SAVE);
MBMToDrawable(bitmap, dspif, wif, 0, 0,
wif->innerregion.x, wif->innerregion.y,
wif->innerregion.width, wif->innerregion.height);
XFlush(display);
wif->not_exposed = 0; /* don't expose it again */
}
case Expose:
if (wif->not_exposed) {
char *tmpstring;
BITMAP *bitmap;
break;
showtitle(MWindow, ((MedleyWindow)Cptr(MWindow))->WTITLE);
bitmap = (BITMAP *)Cptr(((MedleyWindow)Cptr(MWindow))->SAVE);
case NoExpose:
MBMToDrawable(bitmap, dspif, wif, 0, 0, wif->innerregion.x, wif->innerregion.y,
wif->innerregion.width, wif->innerregion.height);
XFlush(display);
wif->not_exposed = 0; /* don't expose it again */
}
case CreateNotify: break;
break;
case DestroyNotify:
case NoExpose:
case CirculateNotify:
if (PlaceOnBottom == report.xcirculate.place)
{
DspInterface dspif;
BITMAP *bitmap;
case CreateNotify: break;
dspif = DspIfFromMscr(screen);
bitmap = (BITMAP *)Cptr(((MedleyWindow)Cptr(MWindow))->SAVE);
case DestroyNotify:
/* Copy the whole black frame to the bitmap. */
DrawableToMBM(bitmap, dspif, wif->blackframe, wif->screen, 0, 0, 0, 0,
wif->outerregion.width, wif->outerregion.height);
DrawableToMBM(bitmap, dspif, wif->handle, wif->screen, 0, 0,
wif->innerregion.x, wif->innerregion.y,
wif->innerregion.width, wif->innerregion.height);
case CirculateNotify:
if (PlaceOnBottom == report.xcirculate.place) {
DspInterface dspif;
BITMAP *bitmap;
}
break;
dspif = DspIfFromMscr(screen);
bitmap = (BITMAP *)Cptr(((MedleyWindow)Cptr(MWindow))->SAVE);
default: break;
}
/* Copy the whole black frame to the bitmap. */
DrawableToMBM(bitmap, dspif, wif->blackframe, wif->screen, 0, 0, 0, 0,
wif->outerregion.width, wif->outerregion.height);
DrawableToMBM(bitmap, dspif, wif->handle, wif->screen, 0, 0, wif->innerregion.x,
wif->innerregion.y, wif->innerregion.width, wif->innerregion.height);
}
break;
default: break;
}
/* else {*/ /* No wif found. Assume it is a widget window. */
/* XtDispatchEvent(&report); */
/* } */
}
/* else {*/ /* No wif found. Assume it is a widget window. */
/* XtDispatchEvent(&report); */
/* } */
}
#endif /* NEVER */
} /* end getMNWsignaldata() */
} /* end getMNWsignaldata() */
/************************************************************************/
/* */
@@ -639,50 +567,48 @@ getMNWsignaldata(fd)
/* */
/************************************************************************/
DoMNWRing(type, screen, window, l, b, wid, h)
int type;
LispPTR screen, window;
int l, b, wid, h;
DoMNWRing(type, screen, window, l, b, wid, h) int type;
LispPTR screen, window;
int l, b, wid, h;
{
DLword w, r;
MNWEvent *event;
int foo = MNWEVENTSIZE; /* so we can examine the value */
int foo = MNWEVENTSIZE; /* so we can examine the value */
if (! CTopMNWEvent )
{
LispPTR index;
index = get_package_atom("\\MNWEVENTQUEUE", 14, "INTERLISP", 9, NIL);
if (index != 0xFFFFFFFF)
{
MNWEVENTQUEUE68k = GetVALCELL68k(index);
DOMNWEVENT_index = get_package_atom("\\DOMNWEVENT", 11, "INTERLISP", 9, NIL);
CTopMNWEvent= (DLword*)Addr68k_from_LADDR(*MNWEVENTQUEUE68k);
}
if (!CTopMNWEvent) {
LispPTR index;
index = get_package_atom("\\MNWEVENTQUEUE", 14, "INTERLISP", 9, NIL);
if (index != 0xFFFFFFFF) {
MNWEVENTQUEUE68k = GetVALCELL68k(index);
DOMNWEVENT_index = get_package_atom("\\DOMNWEVENT", 11, "INTERLISP", 9, NIL);
CTopMNWEvent = (DLword *)Addr68k_from_LADDR(*MNWEVENTQUEUE68k);
}
do_ring:
}
do_ring:
if (CTopMNWEvent)
{
r=RING_READ(CTopMNWEvent);
w=RING_WRITE(CTopMNWEvent);
if (CTopMNWEvent) {
r = RING_READ(CTopMNWEvent);
w = RING_WRITE(CTopMNWEvent);
if (r == w) return;
if (r == w) return;
event=(MNWEvent*)(CTopMNWEvent+ w);
event = (MNWEvent *)(CTopMNWEvent + w);
event->Any.event = type;
event->Any.screen = screen;
event->Any.window = window;
event->Any.pad[0] = l;
event->Any.pad[1] = b;
event->Any.pad[2] = wid;
event->Any.pad[3] = h;
if(r==0) /* Queue was empty */
((RING*)CTopMNWEvent)->read=w;
if(w >= MAXMNWEVENT) ((RING*)CTopMNWEvent)->write = MINMNWEVENT;
else ((RING*)CTopMNWEvent)->write = w + MNWEVENTSIZE;
event->Any.event = type;
event->Any.screen = screen;
event->Any.window = window;
event->Any.pad[0] = l;
event->Any.pad[1] = b;
event->Any.pad[2] = wid;
event->Any.pad[3] = h;
if (r == 0) /* Queue was empty */
((RING *)CTopMNWEvent)->read = w;
if (w >= MAXMNWEVENT)
((RING *)CTopMNWEvent)->write = MINMNWEVENT;
else
((RING *)CTopMNWEvent)->write = w + MNWEVENTSIZE;
if (*MNWBUFFERING68k == NIL) *MNWBUFFERING68k = ATOM_T;
if (MNWEventFlg++ > 0) Irq_Stk_End = Irq_Stk_Check = 0; /* Ask for interrupt */
}
if (*MNWBUFFERING68k == NIL) *MNWBUFFERING68k = ATOM_T;
if (MNWEventFlg++ > 0) Irq_Stk_End = Irq_Stk_Check = 0; /* Ask for interrupt */
}
}