1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-24 19:22:03 +00:00

Bit of cleanup for Lisp_Xinitialized. (#237)

* Bit of cleanup for Lisp_Xinitialized.

* Remove the `extern` from `xcursor.c`, where it was not used.
* Move the definition from `main.c` to `xinit.c` as it is
  the only file using it.
* Use `stdbool.h` for it rather than an `int` with custom `TRUE`
  and `FALSE` values.

* Add some asserts with Lisp_Xinitialized.
This commit is contained in:
Bruce Mitchener 2021-01-19 11:46:20 +07:00 committed by GitHub
parent 32a4b52c66
commit c9a72229dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 8 deletions

View File

@ -249,7 +249,6 @@ char keystring[128] = {""};
#define FALSE 0
#define TRUE !FALSE
int Lisp_Xinitialized = FALSE;
char sysout_name[MAXPATHLEN]; /* Set by read_Xoption, in the X version. */
int sysout_size = 0; /* ditto */

View File

@ -29,7 +29,7 @@
extern IOPAGE *IOPage;
extern XGCValues gcv;
extern int Lisp_Xinitialized, Bitmap_Pad, Default_Depth;
extern int Bitmap_Pad, Default_Depth;
GC cursor_source_gc, cursor_mask_gc;
XColor cursor_fore_xcsd, cursor_back_xcsd, xced;

View File

@ -10,6 +10,8 @@
#include "version.h"
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <X11/X.h>
@ -40,15 +42,13 @@
#include <stropts.h>
#endif /* OS5 */
#define FALSE 0
#define TRUE !FALSE
#define PERCENT_OF_SCREEN 95
#define DISPLAY_MAX 65536 * 16 * 2 /* same magic number is */
/* in loadsysout.c */
extern DLword *Lisp_world;
extern int Lisp_Xinitialized;
extern char Display_Name[128];
extern DLword *DisplayRegion68k;
bool Lisp_Xinitialized = false;
int xsync = False;
int Byte_Order, Bitmap_Bit_Order, Bitmap_Pad, Default_Depth, Display_Height, Display_Width;
@ -105,6 +105,8 @@ void init_Xevent(DspInterface dsp)
/************************************************************************/
void lisp_Xexit(DspInterface dsp)
{
assert(Lisp_Xinitialized);
#if defined(OS5) && defined(I_SETSIG)
ioctl(ConnectionNumber(dsp->display_id), I_SETSIG, 0); /* so no interrupts happen during */
#endif
@ -113,7 +115,7 @@ void lisp_Xexit(DspInterface dsp)
XDestroyWindow(dsp->display_id, dsp->LispWindow);
XCloseDisplay(dsp->display_id);
Lisp_Xinitialized = FALSE;
Lisp_Xinitialized = false;
} /* end lisp_Xexit */
/************************************************************************/
@ -173,7 +175,9 @@ void Xevent_after_raid(DspInterface dsp)
/************************************************************************/
void Open_Display(DspInterface dsp)
{
FD_SET(ConnectionNumber(dsp->display_id), &LispReadFds);
assert(Lisp_Xinitialized == false);
FD_SET(ConnectionNumber(dsp->display_id), &LispReadFds);
fcntl(ConnectionNumber(dsp->display_id), F_SETOWN, getpid());
/****************************************************/
@ -192,7 +196,7 @@ void Open_Display(DspInterface dsp)
if (dsp->ScreenBitmap.data == NULL) dsp->ScreenBitmap.data = (char *)DisplayRegion68k;
Create_LispWindow(dsp); /* Make the main window */
Lisp_Xinitialized = TRUE;
Lisp_Xinitialized = true;
init_Xevent(dsp); /* Turn on the intrpts. */
} /* end OpenDisplay */