mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-28 20:41:30 +00:00
Remove SIGPOLL usage (#385)
* Remove unnecessary calls to XLOCK/XUNLOCK The X methods called by flush_display_region() and flush_display_lineregion() handle the locking/unlocking, therefore it is unnecessary to invoke the locking here. * Remove explict signals when doing XUNLOCK() Call getXsignaldata() directly if a signal happened while X code was locked, instead of generating a signal and then handling it. Some macros and functions needed to pass the DspInterface instead of extracting the X display and window and passing those so that the correct structure was available for the XUNLOCK() call.
This commit is contained in:
10
src/bbtsub.c
10
src/bbtsub.c
@@ -484,9 +484,7 @@ do_it_now:
|
||||
#endif
|
||||
|
||||
#ifdef XWINDOW
|
||||
XLOCK;
|
||||
if (in_display_segment(dstbase)) flush_display_region(dx, dty, w, h);
|
||||
XUNLOCK;
|
||||
#endif /* XWINDOW */
|
||||
|
||||
#ifdef DOS
|
||||
@@ -841,9 +839,7 @@ do_it_now:
|
||||
#endif
|
||||
|
||||
#ifdef XWINDOW
|
||||
XLOCK;
|
||||
if (in_display_segment(dstbase)) flush_display_region(dlx, dty, width, height);
|
||||
XUNLOCK;
|
||||
#endif /* XWINDOW */
|
||||
|
||||
#ifdef DOS
|
||||
@@ -1090,9 +1086,7 @@ do_it_now:
|
||||
#endif
|
||||
|
||||
#ifdef XWINDOW
|
||||
XLOCK;
|
||||
if (in_display_segment(dstbase)) flush_display_region(left, dty, width, height);
|
||||
XUNLOCK;
|
||||
#endif /* XWINDOW */
|
||||
|
||||
#ifdef DOS
|
||||
@@ -1222,9 +1216,7 @@ void bltchar(LispPTR *args)
|
||||
#endif
|
||||
|
||||
#ifdef XWINDOW
|
||||
XLOCK;
|
||||
if (in_display_segment(dstbase)) flush_display_lineregion(dx, dstbase, w, h);
|
||||
XUNLOCK;
|
||||
#endif /* XWINDOW */
|
||||
|
||||
#ifdef DOS
|
||||
@@ -1315,10 +1307,8 @@ LispPTR bltchar(LispPTR *args)
|
||||
#endif
|
||||
|
||||
#ifdef XWINDOW
|
||||
XLOCK;
|
||||
if (in_display_segment(dstbase))
|
||||
flush_display_lineregion(((BLTC *)args)->left, dstbase, (((BLTC *)args)->right - ((BLTC *)args)->left), pbt->pbtheight);
|
||||
XUNLOCK;
|
||||
#endif /* XWINDOW */
|
||||
|
||||
#ifdef DOS
|
||||
|
||||
@@ -411,7 +411,7 @@ static u_char *make_X_keymap() {
|
||||
XDisplayKeycodes(currentdsp->display_id, &minkey, &maxkey);
|
||||
codecount = maxkey + 1 - minkey;
|
||||
mapping = XGetKeyboardMapping(currentdsp->display_id, minkey, codecount, &symspercode);
|
||||
XUNLOCK;
|
||||
XUNLOCK(currentdsp);
|
||||
|
||||
for (; *key_sym_pairs != -1;) {
|
||||
int reusable = *key_sym_pairs++, code = *key_sym_pairs++, sym = *key_sym_pairs++, xcode;
|
||||
|
||||
@@ -53,7 +53,7 @@ unsigned long clipping_Xbitblt(DspInterface dsp, DLword *dummy, int x, int y, in
|
||||
XPutImage(dsp->display_id, dsp->DisplayWindow, dsp->Copy_GC, &dsp->ScreenBitmap, x, y,
|
||||
x - dsp->Visible.x, y - dsp->Visible.y, w, h);
|
||||
XFlush(dsp->display_id);
|
||||
XUNLOCK;
|
||||
XUNLOCK(dsp);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ unsigned long clipping_Xbitblt(DspInterface dsp, DLword *dummy, int x, int y, in
|
||||
XPutImage(dsp->display_id, dsp->DisplayWindow, dsp->Copy_GC, &dsp->ScreenBitmap, x, y,
|
||||
x - dsp->Visible.x, y - dsp->Visible.y, w, h);
|
||||
XFlush(dsp->display_id);
|
||||
XUNLOCK;
|
||||
XUNLOCK(dsp);
|
||||
}
|
||||
return (1);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ void Init_XCursor() {
|
||||
cursorlist->next = NULL;
|
||||
for (i = 0; i < CURSORHEIGHT; i++) cursorlist->bitmap[i] = newbm[i];
|
||||
set_Xcursor(currentdsp, (uint8_t *)newbm, 0, 0, &(cursorlist->Xid), 1);
|
||||
DefineCursor(currentdsp->display_id, currentdsp->DisplayWindow, &(cursorlist->Xid));
|
||||
DefineCursor(currentdsp, currentdsp->DisplayWindow, &(cursorlist->Xid));
|
||||
} /* end Init_XCursor */
|
||||
|
||||
/************************************************************************/
|
||||
@@ -120,8 +120,8 @@ void Set_XCursor(int x, int y)
|
||||
clp->next = cursorlist;
|
||||
cursorlist = clp;
|
||||
}
|
||||
DefineCursor(currentdsp->display_id, currentdsp->DisplayWindow, &(clp->Xid));
|
||||
XUNLOCK; /* Signals OK now */
|
||||
DefineCursor(currentdsp, currentdsp->DisplayWindow, &(clp->Xid));
|
||||
XUNLOCK(currentdsp); /* Signals OK now */
|
||||
|
||||
#ifdef NEWXCURSOR
|
||||
/* Save the hotspot for later position reporting/setting */
|
||||
@@ -140,16 +140,16 @@ void Set_XCursor(int x, int y)
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
void init_Xcursor(Display *display, Window window)
|
||||
void init_Xcursor(DspInterface dsp)
|
||||
{
|
||||
TPRINT(("TRACE: init_Xcursor()\n"));
|
||||
|
||||
XLOCK; /* Take no X signals during this activity (ISC 386) */
|
||||
|
||||
XAllocNamedColor(display, Colors, "black", &cursor_fore_xcsd, &xced);
|
||||
XAllocNamedColor(display, Colors, "white", &cursor_back_xcsd, &xced);
|
||||
XAllocNamedColor(dsp->display_id, Colors, "black", &cursor_fore_xcsd, &xced);
|
||||
XAllocNamedColor(dsp->display_id, Colors, "white", &cursor_back_xcsd, &xced);
|
||||
|
||||
XUNLOCK; /* OK to take signals again */
|
||||
XUNLOCK(dsp); /* OK to take signals again */
|
||||
|
||||
} /* end init_Xcursor */
|
||||
|
||||
@@ -190,6 +190,6 @@ void set_Xcursor(DspInterface dsp, const uint8_t *bitmap, int hotspot_x, int hot
|
||||
XFreePixmap(dsp->display_id, Cursor_msk);
|
||||
|
||||
XFlush(dsp->display_id);
|
||||
XUNLOCK;
|
||||
XUNLOCK(dsp);
|
||||
|
||||
} /* end set_Xcursor */
|
||||
|
||||
@@ -140,7 +140,7 @@ void Xevent_before_raid(DspInterface dsp)
|
||||
|
||||
XLOCK;
|
||||
XFlush(dsp->display_id);
|
||||
XUNLOCK;
|
||||
XUNLOCK(dsp);
|
||||
} /* end Xevent_before_raid */
|
||||
|
||||
/************************************************************************/
|
||||
@@ -158,7 +158,7 @@ void Xevent_after_raid(DspInterface dsp)
|
||||
dsp->Visible.height);
|
||||
XLOCK;
|
||||
XFlush(dsp->display_id);
|
||||
XUNLOCK;
|
||||
XUNLOCK(dsp);
|
||||
|
||||
} /* end Xevent_after_raid */
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ void Create_LispWindow(DspInterface dsp)
|
||||
save_argc, &szhint, &Lisp_WMhints, &xclasshint);
|
||||
|
||||
XSelectInput(dsp->display_id, dsp->LispWindow, dsp->EnableEventMask);
|
||||
init_Xcursor(dsp->display_id, dsp->LispWindow);
|
||||
init_Xcursor(dsp);
|
||||
|
||||
dsp->DisplayWindow = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow, 0, 0,
|
||||
dsp->Visible.width, dsp->Visible.height, 0,
|
||||
@@ -195,7 +195,7 @@ void Create_LispWindow(DspInterface dsp)
|
||||
dsp->ScrollBarWidth, /* width */
|
||||
dsp->Visible.height, dsp->InternalBorderWidth,
|
||||
BlackPixelOfScreen(screen), WhitePixelOfScreen(screen));
|
||||
DefineCursor(dsp->display_id, dsp->VerScrollBar, &VertScrollCursor);
|
||||
DefineCursor(dsp, dsp->VerScrollBar, &VertScrollCursor);
|
||||
XMapWindow(dsp->display_id, dsp->VerScrollBar);
|
||||
|
||||
dsp->HorScrollBar = XCreateSimpleWindow(dsp->display_id, dsp->LispWindow,
|
||||
@@ -203,7 +203,7 @@ void Create_LispWindow(DspInterface dsp)
|
||||
dsp->Visible.width, /* width */
|
||||
dsp->ScrollBarWidth, dsp->InternalBorderWidth,
|
||||
BlackPixelOfScreen(screen), WhitePixelOfScreen(screen));
|
||||
DefineCursor(dsp->display_id, dsp->HorScrollBar, &HorizScrollCursor);
|
||||
DefineCursor(dsp, dsp->HorScrollBar, &HorizScrollCursor);
|
||||
XChangeWindowAttributes(dsp->display_id, dsp->HorScrollBar, CWOverrideRedirect,
|
||||
&Lisp_SetWinAttributes);
|
||||
XMapWindow(dsp->display_id, dsp->HorScrollBar);
|
||||
@@ -237,7 +237,7 @@ void Create_LispWindow(DspInterface dsp)
|
||||
GravSize, dsp->InternalBorderWidth, BlackPixelOfScreen(screen),
|
||||
WhitePixelOfScreen(screen));
|
||||
XSetWindowBackgroundPixmap(dsp->display_id, dsp->NWGrav, dsp->GravityOnPixmap);
|
||||
DefineCursor(dsp->display_id, dsp->NWGrav, &DefaultCursor);
|
||||
DefineCursor(dsp, dsp->NWGrav, &DefaultCursor);
|
||||
XChangeWindowAttributes(dsp->display_id, dsp->NWGrav, CWOverrideRedirect, &Lisp_SetWinAttributes);
|
||||
XClearWindow(dsp->display_id, dsp->NWGrav);
|
||||
XMapWindow(dsp->display_id, dsp->NWGrav);
|
||||
@@ -246,7 +246,7 @@ void Create_LispWindow(DspInterface dsp)
|
||||
GravSize, dsp->InternalBorderWidth, BlackPixelOfScreen(screen),
|
||||
WhitePixelOfScreen(screen));
|
||||
XSetWindowBackgroundPixmap(dsp->display_id, dsp->SEGrav, dsp->GravityOffPixmap);
|
||||
DefineCursor(dsp->display_id, dsp->SEGrav, &DefaultCursor);
|
||||
DefineCursor(dsp, dsp->SEGrav, &DefaultCursor);
|
||||
XChangeWindowAttributes(dsp->display_id, dsp->SEGrav, CWOverrideRedirect, &Lisp_SetWinAttributes);
|
||||
XClearWindow(dsp->display_id, dsp->NWGrav);
|
||||
XMapWindow(dsp->display_id, dsp->SEGrav);
|
||||
@@ -255,7 +255,7 @@ void Create_LispWindow(DspInterface dsp)
|
||||
GravSize, dsp->InternalBorderWidth, BlackPixelOfScreen(screen),
|
||||
WhitePixelOfScreen(screen));
|
||||
XSetWindowBackgroundPixmap(dsp->display_id, dsp->SWGrav, dsp->GravityOffPixmap);
|
||||
DefineCursor(dsp->display_id, dsp->SWGrav, &DefaultCursor);
|
||||
DefineCursor(dsp, dsp->SWGrav, &DefaultCursor);
|
||||
XClearWindow(dsp->display_id, dsp->NWGrav);
|
||||
XMapWindow(dsp->display_id, dsp->SWGrav);
|
||||
|
||||
@@ -263,16 +263,16 @@ void Create_LispWindow(DspInterface dsp)
|
||||
GravSize, dsp->InternalBorderWidth, BlackPixelOfScreen(screen),
|
||||
WhitePixelOfScreen(screen));
|
||||
XSetWindowBackgroundPixmap(dsp->display_id, dsp->NEGrav, dsp->GravityOffPixmap);
|
||||
DefineCursor(dsp->display_id, dsp->NEGrav, &DefaultCursor);
|
||||
DefineCursor(dsp, dsp->NEGrav, &DefaultCursor);
|
||||
XClearWindow(dsp->display_id, dsp->NWGrav);
|
||||
XMapWindow(dsp->display_id, dsp->NEGrav);
|
||||
|
||||
/* DefineCursor( dsp->display_id, dsp->DisplayWindow, &WaitCursor ); */
|
||||
/* DefineCursor( dsp, dsp->DisplayWindow, &WaitCursor ); */
|
||||
|
||||
XLOCK;
|
||||
XMapWindow(dsp->display_id, dsp->LispWindow);
|
||||
XFlush(dsp->display_id);
|
||||
XUNLOCK;
|
||||
XUNLOCK(dsp);
|
||||
}
|
||||
|
||||
void lisp_Xvideocolor(int flag)
|
||||
@@ -303,7 +303,7 @@ void lisp_Xvideocolor(int flag)
|
||||
}
|
||||
|
||||
XFlush(currentdsp->display_id);
|
||||
XUNLOCK;
|
||||
XUNLOCK(currentdsp);
|
||||
|
||||
} /* end lisp_Xvideocolor */
|
||||
|
||||
@@ -322,7 +322,7 @@ void set_Xmouseposition(int x, int y)
|
||||
XWarpPointer(currentdsp->display_id, (Window)NULL, currentdsp->DisplayWindow, 0, 0, 0, 0,
|
||||
dest_x, dest_y);
|
||||
XFlush(currentdsp->display_id);
|
||||
XUNLOCK;
|
||||
XUNLOCK(currentdsp);
|
||||
}
|
||||
} /* end set_Xmouseposition */
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ void Set_BitGravity(XButtonEvent *event, DspInterface dsp, Window window, int gr
|
||||
|
||||
XSetWindowBackgroundPixmap(event->display, window, dsp->GravityOnPixmap);
|
||||
XClearWindow(event->display, window);
|
||||
XUNLOCK;
|
||||
XUNLOCK(dsp);
|
||||
} /* end Set_BitGravity */
|
||||
|
||||
static void lisp_Xconfigure(DspInterface dsp, int x, int y, int lspWinWidth, int lspWinHeight)
|
||||
@@ -137,7 +137,7 @@ static void lisp_Xconfigure(DspInterface dsp, int x, int y, int lspWinWidth, int
|
||||
XMoveResizeWindow(dsp->display_id, dsp->SWGrav, Col2, Row3, GravSize, GravSize);
|
||||
Scroll(dsp, dsp->Visible.x, dsp->Visible.y);
|
||||
XFlush(dsp->display_id);
|
||||
XUNLOCK;
|
||||
XUNLOCK(dsp);
|
||||
} /* end lisp_Xconfigure */
|
||||
|
||||
void enable_Xkeyboard(DspInterface dsp)
|
||||
@@ -145,7 +145,7 @@ void enable_Xkeyboard(DspInterface dsp)
|
||||
XLOCK;
|
||||
XSelectInput(dsp->display_id, dsp->DisplayWindow, dsp->EnableEventMask);
|
||||
XFlush(dsp->display_id);
|
||||
XUNLOCK;
|
||||
XUNLOCK(dsp);
|
||||
}
|
||||
|
||||
void disable_Xkeyboard(DspInterface dsp)
|
||||
@@ -153,7 +153,7 @@ void disable_Xkeyboard(DspInterface dsp)
|
||||
XLOCK;
|
||||
XSelectInput(dsp->display_id, dsp->DisplayWindow, dsp->DisableEventMask);
|
||||
XFlush(dsp->display_id);
|
||||
XUNLOCK;
|
||||
XUNLOCK(dsp);
|
||||
}
|
||||
|
||||
void beep_Xkeyboard(DspInterface dsp)
|
||||
@@ -165,7 +165,7 @@ void beep_Xkeyboard(DspInterface dsp)
|
||||
XLOCK;
|
||||
XBell(dsp->display_id, (int)50);
|
||||
XFlush(dsp->display_id);
|
||||
XUNLOCK;
|
||||
XUNLOCK(dsp);
|
||||
|
||||
} /* end beep_Xkeyboard */
|
||||
|
||||
@@ -241,7 +241,7 @@ void getXsignaldata(DspInterface dsp)
|
||||
(dsp->bitblt_to_screen)(dsp, 0, report.xexpose.x + dsp->Visible.x,
|
||||
report.xexpose.y + dsp->Visible.y, report.xexpose.width,
|
||||
report.xexpose.height);
|
||||
XUNLOCK;
|
||||
XUNLOCK(dsp);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
@@ -266,14 +266,14 @@ void getXsignaldata(DspInterface dsp)
|
||||
case ButtonPress:
|
||||
switch (report.xbutton.button) {
|
||||
case Button1:
|
||||
DefineCursor(dsp->display_id, dsp->HorScrollBar, &ScrollLeftCursor);
|
||||
DefineCursor(dsp, dsp->HorScrollBar, &ScrollLeftCursor);
|
||||
ScrollLeft(dsp);
|
||||
break;
|
||||
case Button2:
|
||||
DefineCursor(dsp->display_id, dsp->HorScrollBar, &HorizThumbCursor);
|
||||
DefineCursor(dsp, dsp->HorScrollBar, &HorizThumbCursor);
|
||||
break;
|
||||
case Button3:
|
||||
DefineCursor(dsp->display_id, dsp->HorScrollBar, &ScrollRightCursor);
|
||||
DefineCursor(dsp, dsp->HorScrollBar, &ScrollRightCursor);
|
||||
ScrollRight(dsp);
|
||||
break;
|
||||
default: break;
|
||||
@@ -282,14 +282,14 @@ void getXsignaldata(DspInterface dsp)
|
||||
case ButtonRelease:
|
||||
switch (report.xbutton.button) {
|
||||
case Button1:
|
||||
DefineCursor(dsp->display_id, report.xany.window, &HorizScrollCursor);
|
||||
DefineCursor(dsp, report.xany.window, &HorizScrollCursor);
|
||||
break;
|
||||
case Button2:
|
||||
JumpScrollHor(dsp, report.xbutton.x);
|
||||
DefineCursor(dsp->display_id, report.xany.window, &HorizScrollCursor);
|
||||
DefineCursor(dsp, report.xany.window, &HorizScrollCursor);
|
||||
break;
|
||||
case Button3:
|
||||
DefineCursor(dsp->display_id, report.xany.window, &HorizScrollCursor);
|
||||
DefineCursor(dsp, report.xany.window, &HorizScrollCursor);
|
||||
break;
|
||||
default: break;
|
||||
} /* end switch */
|
||||
@@ -300,14 +300,14 @@ void getXsignaldata(DspInterface dsp)
|
||||
case ButtonPress:
|
||||
switch (report.xbutton.button) {
|
||||
case Button1:
|
||||
DefineCursor(dsp->display_id, report.xany.window, &ScrollUpCursor);
|
||||
DefineCursor(dsp, report.xany.window, &ScrollUpCursor);
|
||||
ScrollUp(dsp);
|
||||
break;
|
||||
case Button2:
|
||||
DefineCursor(dsp->display_id, report.xany.window, &VertThumbCursor);
|
||||
DefineCursor(dsp, report.xany.window, &VertThumbCursor);
|
||||
break;
|
||||
case Button3:
|
||||
DefineCursor(dsp->display_id, report.xany.window, &ScrollDownCursor);
|
||||
DefineCursor(dsp, report.xany.window, &ScrollDownCursor);
|
||||
ScrollDown(dsp);
|
||||
break;
|
||||
default: break;
|
||||
@@ -316,14 +316,14 @@ void getXsignaldata(DspInterface dsp)
|
||||
case ButtonRelease:
|
||||
switch (report.xbutton.button) {
|
||||
case Button1:
|
||||
DefineCursor(dsp->display_id, report.xany.window, &VertScrollCursor);
|
||||
DefineCursor(dsp, report.xany.window, &VertScrollCursor);
|
||||
break;
|
||||
case Button3:
|
||||
DefineCursor(dsp->display_id, report.xany.window, &VertScrollCursor);
|
||||
DefineCursor(dsp, report.xany.window, &VertScrollCursor);
|
||||
break;
|
||||
case Button2:
|
||||
JumpScrollVer(dsp, report.xbutton.y);
|
||||
DefineCursor(dsp->display_id, report.xany.window, &VertScrollCursor);
|
||||
DefineCursor(dsp, report.xany.window, &VertScrollCursor);
|
||||
break;
|
||||
default: break;
|
||||
} /* end switch */
|
||||
|
||||
Reference in New Issue
Block a user