Skip to content
Snippets Groups Projects
Commit c424fc2f authored by deuce's avatar deuce
Browse files

Latest overhaul...

X11 and SDL modes share the graphics generation.  A new graphical mode
now only needs an init and keyboard functions to work.
parent f0568294
Branches
Tags
No related merge requests found
......@@ -8,14 +8,17 @@ OBJS += $(MTOBJODIR)$(DIRSEP)curs_cio$(OFILE)
ifdef NO_X
CFLAGS += -DNO_X
else
OBJS += $(MTOBJODIR)$(DIRSEP)console$(OFILE) \
OBJS += $(MTOBJODIR)$(DIRSEP)x_events$(OFILE) \
$(MTOBJODIR)$(DIRSEP)x_cio$(OFILE)
NEED_BITMAP := 1
endif
ifdef WITH_SDL_AUDIO
OBJS += $(MTOBJODIR)$(DIRSEP)sdl_con$(OFILE)
NEED_BITMAP := 1
else
ifdef WITH_SDL
NEED_BITMAP := 1
OBJS += $(MTOBJODIR)$(DIRSEP)sdl_con$(OFILE)
OBJS += $(MTOBJODIR)$(DIRSEP)sdlfuncs$(OFILE)
ifeq ($(os),darwin)
......@@ -30,29 +33,17 @@ ifeq ($(os),netbsd)
endif
endif
$(MTOBJODIR)$(DIRSEP)console$(OFILE).static:
$(QUIET)$(DELETE) $(MTOBJODIR)$(DIRSEP)console$(OFILE)*
$(QUIET)touch $(MTOBJODIR)$(DIRSEP)console$(OFILE).static
$(MTOBJODIR)$(DIRSEP)console$(OFILE).dynamic:
$(QUIET)$(DELETE) $(MTOBJODIR)$(DIRSEP)console$(OFILE)*
$(QUIET)touch $(MTOBJODIR)$(DIRSEP)console$(OFILE).dynamic
ifdef NEED_BITMAP
OBJS += $(MTOBJODIR)$(DIRSEP)bitmap_con$(OFILE)
endif
# CIOLIB Library Link Rule
ifdef STATIC
$(CIOLIB-MT_BUILD): $(MTOBJODIR)$(DIRSEP)console$(OFILE).static $(MTOBJODIR) $(OBJS)
else
$(CIOLIB-MT_BUILD): $(MTOBJODIR)$(DIRSEP)console$(OFILE).dynamic $(MTOBJODIR) $(OBJS)
endif
$(CIOLIB-MT_BUILD): $(MTOBJODIR) $(OBJS)
@echo Creating $@ ...
$(QUIET)$(AR) rc $@ $(OBJS)
$(QUIET)$(RANLIB) $@
ifdef STATIC
$(CIOLIB-MT_SHLIB_BUILD): $(MTOBJODIR)$(DIRSEP)console$(OFILE).static $(MTOBJODIR) $(OBJS)
else
$(CIOLIB-MT_SHLIB_BUILD): $(MTOBJODIR)$(DIRSEP)console$(OFILE).dynamic $(MTOBJODIR) $(OBJS)
endif
$(CIOLIB-MT_SHLIB_BUILD): $(MTOBJODIR) $(OBJS)
@echo Creating $@
$(QUIET)$(MKSHLIB) $(LDFLAGS) $(OBJS) $(SHLIBOPTS) -o $@
......
/* $Id$ */
#include <stdarg.h>
#include <stdio.h> /* NULL */
#include <stdlib.h>
#include <string.h>
#include "threadwrap.h"
#include "semwrap.h"
#include "gen_defs.h"
#include "genwrap.h"
#include "dirwrap.h"
#include "xpbeep.h"
#if (defined CIOLIB_IMPORTS)
#undef CIOLIB_IMPORTS
#endif
#if (defined CIOLIB_EXPORTS)
#undef CIOLIB_EXPORTS
#endif
#include "ciolib.h"
#include "keys.h"
#include "vidmodes.h"
#include "allfonts.h"
static char *screen;
int screenwidth;
int screenheight;
#define PIXEL_OFFSET(x,y) ( (y)*screenwidth+(x) )
static int current_font=-99;
struct video_stats vstat;
struct bitmap_callbacks {
void (*drawrect) (int xpos, int ypos, int width, int height, unsigned char *data);
};
pthread_mutex_t vstatlock;
pthread_mutex_t screenlock;
static struct bitmap_callbacks callbacks;
static unsigned char *font;
struct rectangle {
int x;
int y;
int width;
int height;
};
static int update_rect(int sx, int sy, int width, int height, int force);
/* Blinker Thread */
static void blinker_thread(void *data)
{
while(1) {
SLEEP(500);
pthread_mutex_lock(&vstatlock);
if(vstat.blink)
vstat.blink=FALSE;
else
vstat.blink=TRUE;
update_rect(0,0,0,0,FALSE);
pthread_mutex_unlock(&vstatlock);
}
}
int bitmap_init(void (*drawrect_cb) (int xpos, int ypos, int width, int height, unsigned char *data))
{
pthread_mutex_init(&vstatlock, NULL);
pthread_mutex_init(&screenlock, NULL);
pthread_mutex_lock(&vstatlock);
vstat.vmem=NULL;
pthread_mutex_unlock(&vstatlock);
callbacks.drawrect=drawrect_cb;
_beginthread(blinker_thread,0,NULL);
return(0);
}
void send_rectangle(int xoffset, int yoffset, int width, int height, int force)
{
unsigned char *rect;
int pixel=0;
int inpixel;
int x,y;
pthread_mutex_lock(&screenlock);
if(callbacks.drawrect) {
if(xoffset < 0 || xoffset >= screenwidth || yoffset < 0 || yoffset >= screenheight || width <= 0 || width > screenwidth || height <=0 || height >screenheight) {
pthread_mutex_unlock(&screenlock);
return;
}
rect=(unsigned char *)malloc(width*height*sizeof(unsigned char));
if(!rect) {
pthread_mutex_unlock(&screenlock);
return;
}
for(y=0; y<height; y++) {
inpixel=PIXEL_OFFSET(xoffset, yoffset+y);
for(x=0; x<width; x++) {
rect[pixel++]=vstat.palette[screen[inpixel++]];
}
}
callbacks.drawrect(xoffset,yoffset,width,height,rect);
}
pthread_mutex_unlock(&screenlock);
}
int bitmap_init_mode(int mode, int *width, int *height)
{
int i;
char *newscreen;
pthread_mutex_lock(&vstatlock);
if(load_vmode(&vstat, mode)) {
pthread_mutex_unlock(&vstatlock);
return(-1);
}
/* Initialize video memory with black background, white foreground */
for (i = 0; i < vstat.cols*vstat.rows; ++i)
vstat.vmem[i] = 0x0700;
pthread_mutex_lock(&screenlock);
screenwidth=vstat.charwidth*vstat.cols;
if(width)
*width=screenwidth;
screenheight=vstat.charheight*vstat.rows;
if(height)
*height=screenheight;
newscreen=realloc(screen, screenwidth*screenheight);
if(!newscreen) {
pthread_mutex_unlock(&screenlock);
pthread_mutex_unlock(&vstatlock);
return(-1);
}
screen=newscreen;
memset(screen,vstat.palette[0],screenwidth*screenheight);
pthread_mutex_unlock(&screenlock);
/* TODO: Re-enable this
send_rectangle(0,0,screenwidth,screenheight,TRUE);
*/
bitmap_loadfont(NULL);
/* TODO: Remove this next line */
update_rect(1,1,cio_textinfo.screenwidth,cio_textinfo.screenheight,TRUE);
pthread_mutex_unlock(&vstatlock);
cio_textinfo.attribute=7;
cio_textinfo.normattr=7;
cio_textinfo.currmode=mode;
cio_textinfo.screenheight=vstat.rows;
cio_textinfo.screenwidth=vstat.cols;
cio_textinfo.curx=1;
cio_textinfo.cury=1;
cio_textinfo.winleft=1;
cio_textinfo.wintop=1;
cio_textinfo.winright=cio_textinfo.screenwidth;
cio_textinfo.winbottom=cio_textinfo.screenheight;
return(0);
}
/********************************************************/
/* High Level Stuff */
/********************************************************/
/* Called from main thread only (Passes Event) */
int bitmap_puttext(int sx, int sy, int ex, int ey, void *fill)
{
int x,y;
unsigned char *out;
WORD sch;
pthread_mutex_lock(&vstatlock);
if( sx < 1
|| sy < 1
|| ex < 1
|| ey < 1
|| sx > cio_textinfo.screenwidth
|| sy > cio_textinfo.screenheight
|| sx > ex
|| sy > ey
|| ex > cio_textinfo.screenwidth
|| ey > cio_textinfo.screenheight
|| fill==NULL) {
pthread_mutex_unlock(&vstatlock);
return(0);
}
out=fill;
for(y=sy-1;y<ey;y++) {
for(x=sx-1;x<ex;x++) {
sch=*(out++);
sch |= (*(out++))<<8;
vstat.vmem[y*cio_textinfo.screenwidth+x]=sch;
}
}
update_rect(sx,sy,ex-sx+1,ey-sy+1,FALSE);
pthread_mutex_unlock(&vstatlock);
return(1);
}
/* Called from main thread only */
int bitmap_gettext(int sx, int sy, int ex, int ey, void *fill)
{
int x,y;
unsigned char *out;
WORD sch;
pthread_mutex_lock(&vstatlock);
if( sx < 1
|| sy < 1
|| ex < 1
|| ey < 1
|| sx > cio_textinfo.screenwidth
|| sy > cio_textinfo.screenheight
|| sx > ex
|| sy > ey
|| ex > cio_textinfo.screenwidth
|| ey > cio_textinfo.screenheight
|| fill==NULL) {
pthread_mutex_unlock(&vstatlock);
return(0);
}
out=fill;
for(y=sy-1;y<ey;y++) {
for(x=sx-1;x<ex;x++) {
sch=vstat.vmem[y*cio_textinfo.screenwidth+x];
*(out++)=sch & 0xff;
*(out++)=sch >> 8;
}
}
pthread_mutex_unlock(&vstatlock);
return(1);
}
/* Called from main thread only */
void bitmap_setcursortype(int type)
{
pthread_mutex_lock(&vstatlock);
switch(type) {
case _NOCURSOR:
vstat.curs_start=0xff;
vstat.curs_end=0;
break;
case _SOLIDCURSOR:
vstat.curs_start=0;
vstat.curs_end=vstat.charheight-1;
break;
default:
vstat.curs_start = vstat.default_curs_start;
vstat.curs_end = vstat.default_curs_end;
break;
}
update_rect(cio_textinfo.curx+cio_textinfo.winleft-1,cio_textinfo.cury+cio_textinfo.wintop-1,1,1,TRUE);
pthread_mutex_unlock(&vstatlock);
}
int bitmap_setfont(int font, int force)
{
int changemode=0;
int newmode=-1;
struct text_info ti;
char *old;
int ow,oh;
int row,col;
char *new;
int attr;
char *pold;
char *pnew;
if(font < 0 || font>(sizeof(conio_fontdata)/sizeof(struct conio_font_data_struct)-2))
return(-1);
if(conio_fontdata[font].eight_by_sixteen!=NULL)
newmode=C80;
else if(conio_fontdata[font].eight_by_fourteen!=NULL)
newmode=C80X28;
else if(conio_fontdata[font].eight_by_eight!=NULL)
newmode=C80X50;
switch(vstat.charheight) {
case 8:
if(conio_fontdata[font].eight_by_eight==NULL) {
if(force)
return(-1);
else
changemode=1;
}
break;
case 14:
if(conio_fontdata[font].eight_by_fourteen==NULL) {
if(force)
return(-1);
else
changemode=1;
}
break;
case 16:
if(conio_fontdata[font].eight_by_sixteen==NULL) {
if(force)
return(-1);
else
changemode=1;
}
break;
}
if(changemode && newmode==-1)
return(-1);
current_font=font;
if(changemode) {
gettextinfo(&ti);
attr=ti.attribute;
ow=ti.screenwidth;
oh=ti.screenheight;
old=malloc(ow*oh*2);
if(old) {
gettext(1,1,ow,oh,old);
textmode(newmode);
new=malloc(ti.screenwidth*ti.screenheight*2);
pold=old;
pnew=new;
for(row=0; row<ti.screenheight; row++) {
for(col=0; col<ti.screenwidth; col++) {
if(row < oh) {
if(col < ow) {
*(new++)=*(old++);
*(new++)=*(old++);
}
else {
*(new++)=' ';
*(new++)=attr;
}
}
else {
*(new++)=' ';
*(new++)=attr;
}
}
if(row < oh) {
for(;col<ow;col++) {
old++;
old++;
}
}
}
puttext(1,1,ti.screenwidth,ti.screenheight,new);
free(pnew);
free(pold);
}
}
return(0);
}
int bitmap_getfont(void)
{
return(current_font);
}
/* Called from event thread only */
int bitmap_loadfont(char *filename)
{
static char current_filename[MAX_PATH];
unsigned int fontsize;
int fw;
int fh;
int ch;
int x;
int y;
int charrow;
int charcol;
FILE *fontfile;
if(current_font==-99 || current_font>(sizeof(conio_fontdata)/sizeof(struct conio_font_data_struct)-2)) {
for(x=0; conio_fontdata[x].desc != NULL; x++) {
if(!strcmp(conio_fontdata[x].desc, "Codepage 437 English")) {
current_font=x;
break;
}
}
if(conio_fontdata[x].desc==NULL)
current_font=0;
}
if(current_font==-1)
filename=current_filename;
else if(conio_fontdata[current_font].desc==NULL)
return(-1);
pthread_mutex_lock(&vstatlock);
fh=vstat.charheight;
fw=vstat.charwidth/8+(vstat.charwidth%8?1:0);
fontsize=fw*fh*256*sizeof(unsigned char);
if(font)
free(font);
if((font=(unsigned char *)malloc(fontsize))==NULL) {
pthread_mutex_unlock(&vstatlock);
return(-1);
}
if(filename != NULL) {
if(flength(filename)!=fontsize) {
pthread_mutex_unlock(&vstatlock);
free(font);
return(-1);
}
if((fontfile=fopen(filename,"rb"))==NULL) {
pthread_mutex_unlock(&vstatlock);
free(font);
return(-1);
}
if(fread(font, 1, fontsize, fontfile)!=fontsize) {
pthread_mutex_unlock(&vstatlock);
free(font);
fclose(fontfile);
return(-1);
}
fclose(fontfile);
current_font=-1;
if(filename != current_filename)
SAFECOPY(current_filename,filename);
}
else {
switch(vstat.charwidth) {
case 8:
switch(vstat.charheight) {
case 8:
if(conio_fontdata[current_font].eight_by_eight==NULL) {
pthread_mutex_unlock(&vstatlock);
free(font);
return(-1);
}
memcpy(font, conio_fontdata[current_font].eight_by_eight, fontsize);
break;
case 14:
if(conio_fontdata[current_font].eight_by_fourteen==NULL) {
pthread_mutex_unlock(&vstatlock);
free(font);
return(-1);
}
memcpy(font, conio_fontdata[current_font].eight_by_fourteen, fontsize);
break;
case 16:
if(conio_fontdata[current_font].eight_by_sixteen==NULL) {
pthread_mutex_unlock(&vstatlock);
free(font);
return(-1);
}
memcpy(font, conio_fontdata[current_font].eight_by_sixteen, fontsize);
break;
default:
pthread_mutex_unlock(&vstatlock);
free(font);
return(-1);
}
break;
default:
pthread_mutex_unlock(&vstatlock);
free(font);
return(-1);
}
}
pthread_mutex_unlock(&vstatlock);
return(0);
}
/* Called from events thread only */
static void bitmap_draw_cursor(void)
{
int x;
int y;
int attr;
int pixel;
int xoffset,yoffset;
int start,end;
int width;
if(vstat.blink && !hold_update) {
pthread_mutex_lock(&vstatlock);
if(vstat.curs_start<=vstat.curs_end) {
xoffset=(cio_textinfo.curx+cio_textinfo.winleft-2)*vstat.charwidth;
yoffset=(cio_textinfo.cury+cio_textinfo.wintop-2)*vstat.charheight;
attr=cio_textinfo.attribute&0x0f;
start=vstat.curs_start;
end=vstat.curs_end;
width=vstat.charwidth;
pthread_mutex_unlock(&vstatlock);
pthread_mutex_lock(&screenlock);
for(y=start; y<=end; y++) {
pixel=PIXEL_OFFSET(xoffset, yoffset+y);
for(x=0; x<width; x++)
screen[pixel++]=attr;
}
pthread_mutex_unlock(&screenlock);
send_rectangle(xoffset, yoffset+vstat.curs_start, vstat.charwidth, vstat.curs_end-vstat.curs_start+1,FALSE);
}
else
pthread_mutex_unlock(&vstatlock);
}
}
/* Called from main thread only */
void bitmap_gotoxy(int x, int y)
{
static int lx=-1,ly=-1;
pthread_mutex_lock(&vstatlock);
if((x != cio_textinfo.curx) || (y != cio_textinfo.cury)) {
vstat.curs_col=x+cio_textinfo.winleft-1;
vstat.curs_row=y+cio_textinfo.wintop-1;
cio_textinfo.curx=x;
cio_textinfo.cury=y;
}
if(!hold_update) {
/* Erase old cursor */
if(lx != vstat.curs_col || ly != vstat.curs_row)
update_rect(lx,ly,1,1,TRUE);
/* Draw new cursor */
bitmap_draw_cursor();
lx=vstat.curs_col;
ly=vstat.curs_row;
}
pthread_mutex_unlock(&vstatlock);
}
static int bitmap_draw_one_char(unsigned int xpos, unsigned int ypos)
{
int fg;
int bg;
int xoffset=(xpos-1)*vstat.charwidth;
int yoffset=(ypos-1)*vstat.charheight;
int x;
int y;
int fontoffset;
WORD sch;
if(!screen)
return;
if(!vstat.vmem)
return;
sch=vstat.vmem[(ypos-1)*cio_textinfo.screenwidth+(xpos-1)];
bg=(sch&0x7000)>>12;
fg=(sch&0x0f00)>>8;
fontoffset=(sch&0xff)*vstat.charheight;
pthread_mutex_lock(&screenlock);
for(y=0; y<vstat.charheight; y++) {
for(x=0; x<vstat.charwidth; x++) {
if(font[fontoffset] & (0x80 >> x))
screen[PIXEL_OFFSET(xoffset+x, yoffset+y)]=fg;
else
screen[PIXEL_OFFSET(xoffset+x, yoffset+y)]=bg;
}
fontoffset++;
}
pthread_mutex_unlock(&screenlock);
return(0);
}
static int update_rect(int sx, int sy, int width, int height, int force)
{
int x,y;
unsigned int pos;
int redraw_cursor=0;
int lastcharupdated=0;
int fullredraw=0;
static unsigned short *last_vmem=NULL;
static struct video_stats vs;
struct rectangle this_rect;
int this_rect_used=0;
struct rectangle last_rect;
int last_rect_used=0;
if(sx==0 && sy==0 && width==0 && height==0)
fullredraw=1;
if(sx<=0)
sx=1;
if(sy<=0)
sy=1;
if(width<=0 || width>cio_textinfo.screenwidth)
width=cio_textinfo.screenwidth;
if(height<=0 || height>cio_textinfo.screenheight)
height=cio_textinfo.screenheight;
if(vs.cols!=vstat.cols || vs.rows != vstat.rows || last_vmem==NULL) {
unsigned short *p;
p=(unsigned short *)realloc(last_vmem, vstat.cols*vstat.rows*sizeof(unsigned short));
if(p==NULL)
return(-1);
last_vmem=p;
memset(last_vmem, 255, vstat.cols*vstat.rows*sizeof(unsigned short));
sx=1;
sy=1;
width=vstat.cols;
height=vstat.rows;
force=1;
vs.cols=vstat.cols;
vs.rows=vstat.rows;
}
/* Redraw all chars */
if(vstat.blink != vs.blink
|| vstat.curs_col!=vs.curs_col
|| vstat.curs_row!=vs.curs_row)
redraw_cursor=1;
for(y=0;y<height;y++) {
for(x=0;x<width;x++) {
pos=(sy+y-1)*vstat.cols+(sx+x-1);
if(force
|| (last_vmem[pos] != vstat.vmem[pos]) /* Different char */
|| (vstat.blink != vs.blink && vstat.vmem[pos]>>15) /* Blinking char */
|| (redraw_cursor && ((vs.curs_col==sx+x && vs.curs_row==sy+y) || (vstat.curs_col==sx+x && vstat.curs_row==sy+y))) /* Cursor */
) {
last_vmem[pos] = vstat.vmem[pos];
bitmap_draw_one_char(sx+x,sy+y);
if(lastcharupdated) {
this_rect.width+=vstat.charwidth;
lastcharupdated++;
}
else {
if(this_rect_used) {
send_rectangle(this_rect.x, this_rect.y, this_rect.width, this_rect.height,FALSE);
}
this_rect.x=(sx+x-1)*vstat.charwidth;
this_rect.y=(sy+y-1)*vstat.charheight;
this_rect.width=vstat.charwidth;
this_rect.height=vstat.charheight;
this_rect_used=1;
lastcharupdated++;
}
if(!redraw_cursor && sx+x==vstat.curs_col && sy+y==vstat.curs_row)
redraw_cursor=1;
}
else {
if(this_rect_used) {
send_rectangle(this_rect.x, this_rect.y, this_rect.width, this_rect.height,FALSE);
this_rect_used=0;
}
if(last_rect_used) {
send_rectangle(last_rect.x, last_rect.y, last_rect.width, last_rect.height, FALSE);
last_rect_used=0;
}
lastcharupdated=0;
}
pos++;
}
/* If ALL chars in the line were used, add to last_rect */
if(lastcharupdated==width) {
if(last_rect_used) {
last_rect.height += vstat.charheight;
this_rect_used=0;
}
else {
last_rect=this_rect;
last_rect_used=1;
this_rect_used=0;
}
}
/* Otherwise send any stale line buffers */
else
{
if(last_rect_used) {
send_rectangle(last_rect.x, last_rect.y, last_rect.width, last_rect.height, FALSE);
last_rect_used=0;
}
if(this_rect_used) {
send_rectangle(this_rect.x, this_rect.y, this_rect.width, this_rect.height, FALSE);
this_rect_used=0;
}
}
lastcharupdated=0;
}
if(this_rect_used) {
send_rectangle(this_rect.x, this_rect.y, this_rect.width, this_rect.height, FALSE);
}
if(last_rect_used) {
send_rectangle(last_rect.x, last_rect.y, last_rect.width, last_rect.height, FALSE);
}
/* Did we redraw the cursor? If so, update position */
if(redraw_cursor) {
vs.curs_col=vstat.curs_col;
vs.curs_row=vstat.curs_row;
}
/* On full redraws, save the last blink value */
if(fullredraw) {
vs.blink=vstat.blink;
}
if(redraw_cursor)
bitmap_draw_cursor();
return(0);
}
#ifndef BITMAP_CON_H
#define BITMAP_CON_H
#include "vidmodes.h"
#include "threadwrap.h"
extern struct video_stats vstat;
extern pthread_mutex_t vstatlock;
extern sem_t drawn_sem;
int bitmap_gettext(int sx, int sy, int ex, int ey, void *fill);
int bitmap_puttext(int sx, int sy, int ex, int ey, void *fill);
void bitmap_gotoxy(int x, int y);
void bitmap_setcursortype(int type);
int bitmap_setfont(int font, int force);
int bitmap_getfont(void);
int bitmap_loadfont(char *filename);
void send_rectangle(int xoffset, int yoffset, int width, int height, int force);
int bitmap_init_mode(int mode, int *width, int *height);
int bitmap_init(void (*drawrect_cb) (int xpos, int ypos, int width, int height, unsigned char *data));
#endif
......@@ -63,6 +63,7 @@
#undef getch
#endif
#include "bitmap_con.h"
#include "ansi_cio.h"
CIOLIBEXPORT cioapi_t cio_api;
......@@ -120,11 +121,15 @@ int try_sdl_init(int mode)
{
if(!sdl_initciolib(mode)) {
cio_api.mouse=1;
cio_api.puttext=sdl_puttext;
cio_api.gettext=sdl_gettext;
cio_api.puttext=bitmap_puttext;
cio_api.gettext=bitmap_gettext;
cio_api.gotoxy=bitmap_gotoxy;
cio_api.setcursortype=bitmap_setcursortype;
cio_api.setfont=bitmap_setfont;
cio_api.getfont=bitmap_getfont;
cio_api.loadfont=bitmap_loadfont;
cio_api.kbhit=sdl_kbhit;
cio_api.gotoxy=sdl_gotoxy;
cio_api.setcursortype=sdl_setcursortype;
cio_api.getch=sdl_getch;
cio_api.textmode=sdl_textmode;
cio_api.showmouse=sdl_showmouse;
......@@ -139,9 +144,6 @@ int try_sdl_init(int mode)
cio_api.copytext=sdl_copytext;
cio_api.getcliptext=sdl_getcliptext;
#endif
cio_api.setfont=sdl_setfont;
cio_api.getfont=sdl_getfont;
cio_api.loadfont=sdl_loadfont;
cio_api.get_window_info=sdl_get_window_info;
return(1);
}
......@@ -153,16 +155,16 @@ int try_sdl_init(int mode)
#ifndef NO_X
int try_x_init(int mode)
{
if(!console_init()) {
if(!x_init()) {
cio_api.mode=CIOLIB_MODE_X;
cio_api.mouse=1;
cio_api.puttext=x_puttext;
cio_api.gettext=x_gettext;
cio_api.gotoxy=x_gotoxy;
cio_api.setcursortype=x_setcursortype;
cio_api.setfont=x_setfont;
cio_api.getfont=x_getfont;
cio_api.loadfont=x_loadfont;
cio_api.puttext=bitmap_puttext;
cio_api.gettext=bitmap_gettext;
cio_api.gotoxy=bitmap_gotoxy;
cio_api.setcursortype=bitmap_setcursortype;
cio_api.setfont=bitmap_setfont;
cio_api.getfont=bitmap_getfont;
cio_api.loadfont=bitmap_loadfont;
cio_api.beep=x_beep;
cio_api.kbhit=x_kbhit;
......@@ -594,8 +596,8 @@ CIOLIBEXPORT void CIOLIBCALL ciolib_gettextinfo(struct text_info *info)
BW40, BW80, C40, C80, or C4350 */
info->screenheight=cio_textinfo.screenheight; /* text screen's height */
info->screenwidth=cio_textinfo.screenwidth; /* text screen's width */
info->curx=cio_textinfo.curx-cio_textinfo.winleft+1; /* x-coordinate in current window */
info->cury=cio_textinfo.cury-cio_textinfo.wintop+1; /* y-coordinate in current window */
info->curx=cio_textinfo.curx; /* x-coordinate in current window */
info->cury=cio_textinfo.cury; /* y-coordinate in current window */
}
}
......
This diff is collapsed.
/* $Id$ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
#ifndef _CONSOLE_H_
#define _CONSOLE_H_
#include <sys/param.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/user.h>
#include <gen_defs.h>
#include <semwrap.h>
#include "vidmodes.h"
extern sem_t console_mode_changed;
extern sem_t copybuf_set;
extern sem_t pastebuf_request;
extern sem_t pastebuf_set;
extern sem_t font_set;
extern int new_font;
extern int font_force;
extern int setfont_return;
extern pthread_mutex_t copybuf_mutex;
extern char *copybuf;
extern char *pastebuf;
extern int CurrMode;
extern int InitCS;
extern int InitCE;
extern WORD *vmem;
extern BYTE CursRow;
extern BYTE CursCol;
extern BYTE CursStart;
extern BYTE CursEnd;
extern WORD DpyCols;
extern BYTE DpyRows;
extern int FH,FW;
extern int x_nextchar;
extern int console_new_mode;
extern int x11_window_xpos;
extern int x11_window_ypos;
extern int x11_window_width;
extern int x11_window_height;
int init_window();
int video_init();
int init_mode(int mode);
int tty_read(int flag);
int tty_peek(int flag);
int tty_kbhit(void);
void tty_beep(void);
void x_win_title(const char *title);
int console_init(void);
int x_load_font(const char *filename);
#define TTYF_BLOCK 0x00000008
#define TTYF_POLL 0x00000010
#define NO_NEW_MODE -999
#endif
This diff is collapsed.
......@@ -35,6 +35,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifndef STATIC_LINK
#include <dlfcn.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <threadwrap.h>
......@@ -47,145 +52,75 @@
#include "ciolib.h"
#include "x_cio.h"
#include "console.h"
WORD x_curr_attr=0x0700;
int x_puttext(int sx, int sy, int ex, int ey, void *fill)
{
int x,y;
unsigned char *out;
WORD sch;
struct text_info ti;
gettextinfo(&ti);
if( sx < 1
|| sy < 1
|| ex < 1
|| ey < 1
|| sx > ti.screenwidth
|| sy > ti.screenheight
|| sx > ex
|| sy > ey
|| ex > ti.screenwidth
|| ey > ti.screenheight
|| fill==NULL)
return(0);
out=fill;
for(y=sy-1;y<ey;y++) {
for(x=sx-1;x<ex;x++) {
sch=*(out++);
sch |= (*(out++))<<8;
vmem[y*DpyCols+x]=sch;
}
}
return(1);
}
int x_gettext(int sx, int sy, int ex, int ey, void *fill)
{
int x,y;
unsigned char *out;
WORD sch;
struct text_info ti;
gettextinfo(&ti);
if( sx < 1
|| sy < 1
|| ex < 1
|| ey < 1
|| sx > ti.screenwidth
|| sy > ti.screenheight
|| sx > ex
|| sy > ey
|| ex > ti.screenwidth
|| ey > ti.screenheight
|| fill==NULL)
return(0);
out=fill;
for(y=sy-1;y<ey;y++) {
for(x=sx-1;x<ex;x++) {
sch=vmem[y*DpyCols+x];
*(out++)=sch & 0xff;
*(out++)=sch >> 8;
}
}
return(1);
}
#include "x_events.h"
int x_kbhit(void)
{
return(tty_kbhit());
}
fd_set rfd;
struct timeval tv;
void x_gotoxy(int x, int y)
{
CursRow=cio_textinfo.wintop+y-2;
CursCol=cio_textinfo.winleft+x-2;
cio_textinfo.curx=x;
cio_textinfo.cury=y;
}
void x_setcursortype(int type)
{
switch(type) {
case _NOCURSOR:
CursStart=0xff;
CursEnd=0;
break;
case _SOLIDCURSOR:
CursStart=0;
CursEnd=FH-1;
break;
default:
CursStart = InitCS;
CursEnd = InitCE;
break;
}
memset(&tv, 0, sizeof(tv));
FD_ZERO(&rfd);
FD_SET(key_pipe[0], &rfd);
return(select(key_pipe[0]+1, &rfd, NULL, NULL, &tv)==1);
}
int x_getch(void)
{
return(tty_read(TTYF_BLOCK));
unsigned char ch;
while(read(key_pipe[0], &ch, 1)!=1);
return(ch);
}
int x_beep(void)
{
tty_beep();
struct x11_local_event ev;
ev.type=X11_LOCAL_BEEP;
while(write(local_pipe[1], &ev, sizeof(ev))==-1);
return(0);
}
void x_textmode(int mode)
{
console_new_mode=mode;
sem_wait(&console_mode_changed);
struct x11_local_event ev;
ev.type=X11_LOCAL_SETMODE;
ev.data.mode = mode;
while(write(local_pipe[1], &ev, sizeof(ev))==-1);
sem_wait(&mode_set);
}
void x_setname(const char *name)
{
x_win_name(name);
struct x11_local_event ev;
ev.type=X11_LOCAL_SETNAME;
SAFECOPY(ev.data.name, name);
while(write(local_pipe[1], &ev, sizeof(ev))==-1);
}
void x_settitle(const char *title)
{
x_win_title(title);
struct x11_local_event ev;
ev.type=X11_LOCAL_SETTITLE;
SAFECOPY(ev.data.title, title);
while(write(local_pipe[1], &ev, sizeof(ev))==-1);
}
void x_copytext(const char *text, size_t buflen)
{
struct x11_local_event ev;
pthread_mutex_lock(&copybuf_mutex);
if(copybuf!=NULL) {
free(copybuf);
copybuf=NULL;
}
FREE_AND_NULL(copybuf);
copybuf=(char *)malloc(buflen+1);
if(copybuf!=NULL) {
strcpy(copybuf, text);
sem_post(&copybuf_set);
copybuf=strdup(text);
if(copybuf) {
ev.type=X11_LOCAL_COPY;
while(write(local_pipe[1], &ev, sizeof(ev))==-1);
}
pthread_mutex_unlock(&copybuf_mutex);
return;
......@@ -194,38 +129,17 @@ void x_copytext(const char *text, size_t buflen)
char *x_getcliptext(void)
{
char *ret=NULL;
struct x11_local_event ev;
sem_post(&pastebuf_request);
ev.type=X11_LOCAL_PASTE;
while(write(local_pipe[1], &ev, sizeof(ev))==-1);
sem_wait(&pastebuf_set);
if(pastebuf!=NULL) {
ret=(char *)malloc(strlen(pastebuf)+1);
if(ret!=NULL)
strcpy(ret,pastebuf);
}
sem_post(&pastebuf_request);
if(pastebuf!=NULL)
ret=strdup(pastebuf);
sem_post(&pastebuf_used);
return(ret);
}
int x_setfont(int font, int force)
{
if(font==getfont())
return(0);
font_force=force;
new_font=font;
sem_wait(&font_set);
return(setfont_return);
}
int x_getfont(void)
{
return(new_font);
}
int x_loadfont(char *filename)
{
return(x_load_font(filename));
}
int x_get_window_info(int *width, int *height, int *xpos, int *ypos)
{
if(width)
......@@ -239,3 +153,279 @@ int x_get_window_info(int *width, int *height, int *xpos, int *ypos)
return(0);
}
int x_init(void)
{
int fd;
int i;
void *dl;
/* Ensure we haven't already initialized */
if(initialized)
return(0);
/* Set up the pipe for local events */
if(pipe(local_pipe))
return(-1);
/* And the keyboard pipe */
if(pipe(key_pipe))
return(-1);
/* Load X11 functions */
#ifdef STATIC_LINK
x11.XChangeGC=XChangeGC;
x11.XCopyPlane=XCopyPlane;
x11.XFillRectangle=XFillRectangle;
x11.XDrawPoint=XDrawPoint;
x11.XFlush=XFlush;
x11.XSync=XSync;
x11.XBell=XBell;
x11.XLookupString=XLookupString;
x11.XNextEvent=XNextEvent;
x11.XAllocSizeHints=XAllocSizeHints;
x11.XSetWMNormalHints=XSetWMNormalHints;
x11.XResizeWindow=XResizeWindow;
x11.XMapWindow=XMapWindow;
x11.XFree=XFree;
x11.XFreePixmap=XFreePixmap;
x11.XCreatePixmap=XCreatePixmap;
x11.XCopyArea=XCopyArea;
x11.XCreateBitmapFromData=XCreateBitmapFromData;
x11.XAllocColor=XAllocColor;
x11.XOpenDisplay=XOpenDisplay;
x11.XCreateSimpleWindow=XCreateSimpleWindow;
x11.XCreateGC=XCreateGC;
x11.XSelectInput=XSelectInput;
x11.XStoreName=XStoreName;
x11.XGetSelectionOwner=XGetSelectionOwner;
x11.XConvertSelection=XConvertSelection;
x11.XGetWindowProperty=XGetWindowProperty;
x11.XChangeProperty=XChangeProperty;
x11.XSendEvent=XSendEvent;
x11.XPutImage=XPutImage;
#ifndef XPutPixel
x11.XPutPixel=XPutPixel;
#endif
#ifndef XDestroyImage
x11.XDestroyImage=XDestroyImage;
#endif
x11.XCreateImage=XCreateImage;
x11.XSetSelectionOwner=XSetSelectionOwner;
x11.XSetIconName=XSetIconName;
x11.XSynchronize=XSynchronize;
x11.XGetWindowAttributes=XGetWindowAttributes;
#else
#if defined(__APPLE__) && defined(__MACH__) && defined(__POWERPC__)
if((dl=dlopen("/usr/X11R6/lib/libX11.dylib",RTLD_LAZY|RTLD_GLOBAL))==NULL)
#else
if((dl=dlopen("libX11.so",RTLD_LAZY))==NULL)
#endif
return(-1);
if((x11.XChangeGC=dlsym(dl,"XChangeGC"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XCopyPlane=dlsym(dl,"XCopyPlane"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XFillRectangle=dlsym(dl,"XFillRectangle"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XDrawPoint=dlsym(dl,"XDrawPoint"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XFlush=dlsym(dl,"XFlush"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XSync=dlsym(dl,"XSync"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XBell=dlsym(dl,"XBell"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XLookupString=dlsym(dl,"XLookupString"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XNextEvent=dlsym(dl,"XNextEvent"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XAllocSizeHints=dlsym(dl,"XAllocSizeHints"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XSetWMNormalHints=dlsym(dl,"XSetWMNormalHints"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XResizeWindow=dlsym(dl,"XResizeWindow"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XMapWindow=dlsym(dl,"XMapWindow"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XFree=dlsym(dl,"XFree"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XFreePixmap=dlsym(dl,"XFreePixmap"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XCreatePixmap=dlsym(dl,"XCreatePixmap"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XCopyArea=dlsym(dl,"XCopyArea"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XCreateBitmapFromData=dlsym(dl,"XCreateBitmapFromData"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XAllocColor=dlsym(dl,"XAllocColor"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XOpenDisplay=dlsym(dl,"XOpenDisplay"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XCreateSimpleWindow=dlsym(dl,"XCreateSimpleWindow"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XCreateGC=dlsym(dl,"XCreateGC"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XSelectInput=dlsym(dl,"XSelectInput"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XStoreName=dlsym(dl,"XStoreName"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XGetSelectionOwner=dlsym(dl,"XGetSelectionOwner"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XConvertSelection=dlsym(dl,"XConvertSelection"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XGetWindowProperty=dlsym(dl,"XGetWindowProperty"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XChangeProperty=dlsym(dl,"XChangeProperty"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XSendEvent=dlsym(dl,"XSendEvent"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XPutImage=dlsym(dl,"XPutImage"))==NULL) {
dlclose(dl);
return(-1);
}
#ifndef XDestroyImage
if((x11.XDestroyImage=dlsym(dl,"XDestroyImage"))==NULL) {
dlclose(dl);
return(-1);
}
#endif
#ifndef XPutPixel
if((x11.XPutPixel=dlsym(dl,"XPutPixel"))==NULL) {
dlclose(dl);
return(-1);
}
#endif
if((x11.XCreateImage=dlsym(dl,"XCreateImage"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XSetSelectionOwner=dlsym(dl,"XSetSelectionOwner"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XSetIconName=dlsym(dl,"XSetIconName"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XSynchronize=dlsym(dl,"XSynchronize"))==NULL) {
dlclose(dl);
return(-1);
}
if((x11.XGetWindowAttributes=dlsym(dl,"XGetWindowAttributes"))==NULL) {
dlclose(dl);
return(-1);
}
#endif
if(sem_init(&pastebuf_set, 0, 0))
return(-1);
if(sem_init(&pastebuf_used, 0, 0)) {
sem_destroy(&pastebuf_set);
return(-1);
}
if(sem_init(&init_complete, 0, 0)) {
sem_destroy(&pastebuf_set);
sem_destroy(&pastebuf_used);
return(-1);
}
if(sem_init(&mode_set, 0, 0)) {
sem_destroy(&pastebuf_set);
sem_destroy(&pastebuf_used);
sem_destroy(&init_complete);
return(-1);
}
if(pthread_mutex_init(&copybuf_mutex, 0)) {
sem_destroy(&pastebuf_set);
sem_destroy(&pastebuf_used);
sem_destroy(&init_complete);
sem_destroy(&mode_set);
return(-1);
}
_beginthread(x11_event_thread,1<<16,NULL);
sem_wait(&init_complete);
if(!initialized) {
sem_destroy(&pastebuf_set);
sem_destroy(&pastebuf_used);
sem_destroy(&init_complete);
sem_destroy(&mode_set);
pthread_mutex_destroy(&copybuf_mutex);
return(-1);
}
return(0);
}
void x11_drawrect(int xoffset,int yoffset,int width,int height,unsigned char *data)
{
struct x11_local_event ev;
ev.type=X11_LOCAL_DRAWRECT;
if(initialized) {
ev.data.rect.x=xoffset;
ev.data.rect.y=yoffset;
ev.data.rect.width=width;
ev.data.rect.height=height;
ev.data.rect.data=data;
while(write(local_pipe[1], &ev, sizeof(ev))==-1);
}
}
......@@ -40,18 +40,25 @@
#endif
#include "ciolib.h"
#include "console.h"
#include "x_events.h"
#ifdef __cplusplus
extern "C" {
#endif
int x_puttext(int sx, int sy, int ex, int ey, void *fill);
int x_gettext(int sx, int sy, int ex, int ey, void *fill);
void x_textattr(int attr);
int x_kbhit(void);
void x_delay(long msec);
int x_wherey(void);
int x_wherex(void);
int x_putch(int ch);
void x_gotoxy(int x, int y);
void x_initciolib(long inmode);
void x_gettextinfo(struct text_info *info);
void x_setcursortype(int type);
int x_getch(void);
int x_getche(void);
int x_beep(void);
void x_textmode(int mode);
void x_setname(const char *name);
......@@ -62,6 +69,7 @@ int x_setfont(int font, int force);
int x_getfont(void);
int x_loadfont(char *filename);
int x_get_window_info(int *width, int *height, int *xpos, int *ypos);
void x11_drawrect(int xoffset,int yoffset,int width,int height,unsigned char *data);
#ifdef __cplusplus
}
#endif
......
This diff is collapsed.
#ifndef _X_EVENTS_H_
#define _X_EVENTS_H_
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
struct update_rect {
int x;
int y;
int width;
int height;
unsigned char *data;
};
enum x11_local_events {
X11_LOCAL_SETMODE
,X11_LOCAL_SETNAME
,X11_LOCAL_SETTITLE
,X11_LOCAL_COPY
,X11_LOCAL_PASTE
,X11_LOCAL_DRAWRECT
,X11_LOCAL_BEEP
};
struct x11_local_event {
enum x11_local_events type;
union {
int mode;
char name[81];
char title[81];
struct update_rect rect;
} data;
};
/* X functions */
struct x11 {
int (*XChangeGC) (Display*, GC, unsigned long, XGCValues*);
int (*XCopyPlane) (Display*, Drawable, Drawable, GC, int, int, unsigned int, unsigned int, int, int, unsigned long);
int (*XFillRectangle) (Display*, Drawable, GC, int, int, unsigned int, unsigned int);
int (*XDrawPoint) (Display*, Drawable, GC, int, int);
int (*XFlush) (Display*);
int (*XSync) (Display*, Bool);
int (*XBell) (Display*, int);
int (*XLookupString)(XKeyEvent*, char*, int, KeySym*, XComposeStatus*);
int (*XNextEvent) (Display*, XEvent *);
XSizeHints* (*XAllocSizeHints)(void);
void (*XSetWMNormalHints) (Display*, Window, XSizeHints*);
int (*XResizeWindow)(Display*, Window, unsigned int, unsigned int);
int (*XMapWindow) (Display*, Window);
int (*XFree) (void *data);
int (*XFreePixmap) (Display*, Pixmap);
Pixmap (*XCreatePixmap)(Display*, Drawable, unsigned int, unsigned int, unsigned int);
void (*XCopyArea) (Display*, Drawable, Drawable, GC, int, int, unsigned int, unsigned int, int, int);
Pixmap (*XCreateBitmapFromData) (Display*, Drawable, _Xconst char*, unsigned int, unsigned int);
Status (*XAllocColor) (Display*, Colormap, XColor*);
Display*(*XOpenDisplay) (_Xconst char*);
Window (*XCreateSimpleWindow) (Display*, Window, int, int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long);
GC (*XCreateGC) (Display*, Drawable, unsigned long, XGCValues*);
int (*XSelectInput) (Display*, Window, long);
int (*XStoreName) (Display*, Window, _Xconst char*);
Window (*XGetSelectionOwner) (Display*, Atom);
int (*XConvertSelection) (Display*, Atom, Atom, Atom, Window, Time);
int (*XGetWindowProperty) (Display*, Window, Atom, long, long, Bool, Atom, Atom*, int*, unsigned long *, unsigned long *, unsigned char **);
int (*XChangeProperty) (Display*, Window, Atom, Atom, int, int, _Xconst unsigned char*, int);
Status (*XSendEvent) (Display*, Window, Bool, long, XEvent*);
XImage* (*XCreateImage) (Display *, Visual *, unsigned int, int, int, char *,unsigned int, unsigned int, int, int);
#ifndef XPutPixel
void (*XPutPixel) (XImage*,int,int,unsigned long);
#endif
void (*XPutImage) (Display*, Drawable, GC, XImage *, int,int,int,int,unsigned int,unsigned int);
#ifndef XDestroyImage
void (*XDestroyImage)(XImage*);
#endif
int (*XSetSelectionOwner) (Display*, Atom, Window, Time);
int (*XSetIconName) (Display*, Window, _Xconst char *);
int (*XSynchronize) (Display*, Bool);
Status (*XGetWindowAttributes) (Display*,Window,XWindowAttributes*);
};
extern int local_pipe[2]; /* Used for passing local events */
extern int key_pipe[2]; /* Used for passing keyboard events */
extern struct x11 x11;
extern char *copybuf;
extern pthread_mutex_t copybuf_mutex;
extern char *pastebuf;
extern sem_t pastebuf_set;
extern sem_t pastebuf_used;
extern sem_t init_complete;
extern sem_t mode_set;
extern int x11_window_xpos;
extern int x11_window_ypos;
extern int x11_window_width;
extern int x11_window_height;
extern int initialized;
void x11_event_thread(void *args);
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment