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

Update to use batched flush

parent c2fd3f02
No related branches found
No related tags found
No related merge requests found
......@@ -432,3 +432,12 @@ void x11_drawrect(int xoffset,int yoffset,int width,int height,unsigned char *da
while(write(local_pipe[1], &ev, sizeof(ev))==-1);
}
}
void x11_flush(void)
{
struct x11_local_event ev;
ev.type=X11_LOCAL_FLUSH;
if(x11_initialized)
while(write(local_pipe[1], &ev, sizeof(ev))==-1);
}
......@@ -70,6 +70,7 @@ 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);
void x11_flush(void);
#ifdef __cplusplus
}
#endif
......
......@@ -229,7 +229,6 @@ static int init_window()
x11.XSelectInput(dpy, win, KeyReleaseMask | KeyPressMask |
ExposureMask | ButtonPressMask
| ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
// x11.XFlush(dpy);
x11.XGetWindowAttributes(dpy,win,&attr);
memcpy(&visual,attr.visual,sizeof(visual));
......@@ -302,7 +301,7 @@ static int video_init()
return(-1);
vstat.scaling=1;
bitmap_init(x11_drawrect);
bitmap_init(x11_drawrect, x11_flush);
/* Initialize mode 3 (text, 80x25, 16 colors) */
if(init_mode(3)) {
......@@ -381,7 +380,6 @@ static void local_draw_rect(struct update_rect *rect)
}
#endif
#endif
x11.XFlush(dpy);
free(rect->data);
}
......@@ -866,6 +864,9 @@ void x11_event_thread(void *args)
case X11_LOCAL_DRAWRECT:
local_draw_rect(&lev.data.rect);
break;
case X11_LOCAL_FLUSH:
x11.XFlush(dpy);
break;
case X11_LOCAL_BEEP:
x11.XBell(dpy, 100);
break;
......
......@@ -21,6 +21,7 @@ enum x11_local_events {
,X11_LOCAL_COPY
,X11_LOCAL_PASTE
,X11_LOCAL_DRAWRECT
,X11_LOCAL_FLUSH
,X11_LOCAL_BEEP
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment