diff --git a/engine/qux/m_x.c b/engine/qux/m_x.c index 53347aa81..83e161f94 100644 --- a/engine/qux/m_x.c +++ b/engine/qux/m_x.c @@ -588,7 +588,7 @@ nextmessage: { cl->requestnum++; -/* if (req->reqType < 0 || req->reqType >= 256 || !XRequests[req->reqType]) + if (/*req->reqType < 0 || req->reqType >= 256 ||*/ !XRequests[req->reqType]) { // Con_Printf("X request %i, len %i - NOT SUPPORTED\n", req->reqType, rlen*4); @@ -597,12 +597,12 @@ nextmessage: // cl->tobedropped = true; } else -*/ { // Con_Printf("X request %i, len %i\n", req->reqType, rlen*4); //Con_Printf("Request %i\n", req->reqType); // Z_CheckSentinals(); + XS_CheckResourceSentinals(); if (!req->length) { int rt, data; @@ -620,6 +620,7 @@ nextmessage: } else XRequests[req->reqType](cl, req); + XS_CheckResourceSentinals(); // Z_CheckSentinals(); //Con_Printf("Done request\n"); } @@ -900,6 +901,8 @@ void XWindows_Startup(void) //initialise the server socket and do any initial se XS_CreateInitialResources(); } + XS_CheckResourceSentinals(); + //quakie stuph key_dest = key_menu; m_state = m_xwindows; @@ -1613,6 +1616,7 @@ void X_EvalutateFocus(int movemode) void XWindows_Draw(void) { + XS_CheckResourceSentinals(); { X_EvalutateCursorOwner(NotifyNormal); } @@ -1648,11 +1652,14 @@ void XWindows_Draw(void) Con_DrawNotify(); XWindows_TendToClients(); + XS_CheckResourceSentinals(); } void XWindows_Key(int key) { extern qboolean keydown[256]; + XS_CheckResourceSentinals(); + if (key == 'q' || (key == K_BACKSPACE && keydown[K_CTRL] && keydown[K_ALT])) //kill off the server { m_state = m_none; @@ -1741,9 +1748,11 @@ void XWindows_Key(int key) else if (XS_GetResource(ev.u.keyButtonPointer.child, (void**)&wnd) == x_window) X_SendInputNotification(&ev, wnd, (ev.u.u.type==ButtonPress)?ButtonPressMask:KeyPressMask); } + XS_CheckResourceSentinals(); } void XWindows_Keyup(int key) { + XS_CheckResourceSentinals(); { xEvent ev; xwindow_t *wnd; @@ -1824,6 +1833,7 @@ void XWindows_Keyup(int key) X_SendInputNotification(&ev, wnd, (ev.u.u.type==ButtonRelease)?ButtonReleaseMask:KeyReleaseMask); } } + XS_CheckResourceSentinals(); } #else diff --git a/engine/qux/qux.h b/engine/qux/qux.h index 571d40477..33af15bca 100644 --- a/engine/qux/qux.h +++ b/engine/qux/qux.h @@ -144,6 +144,7 @@ xpixmap_t *XS_CreatePixmap(int id, xclient_t *owner, int width, int height, int void XS_CreateInitialResources(void); void XS_DestroyResource(xresource_t *res); void XS_DestroyResourcesOfClient(xclient_t *cl); +void XS_CheckResourceSentinals(void); void XW_ExposeWindow(xwindow_t *root, int x, int y, int width, int height); diff --git a/engine/qux/x_reqs.c b/engine/qux/x_reqs.c index c84ccb79d..1aff5c5ce 100644 --- a/engine/qux/x_reqs.c +++ b/engine/qux/x_reqs.c @@ -172,7 +172,7 @@ void XW_ExposeWindowRegionInternal(xwindow_t *root, int x, int y, int width, int if (root->buffer && root != rootwindow) { - XW_ClearArea(root, 0, 0, root->width, root->height); +// XW_ClearArea(root, 0, 0, root->width, root->height); // free(root->buffer); // root->buffer = NULL; } @@ -1587,8 +1587,8 @@ void XW_ClearArea(xwindow_t *wnd, int xp, int yp, int width, int height) { //when do we stop? xs = wnd->backpixmap->width; - if (xs > wnd->width-x) - xs = wnd->width-x; + if (xs > wnd->width-x-1) + xs = wnd->width-x-1; for (; xs > 0; xs--) { out[x+xs] = in[xs+ys*wnd->backpixmap->width]; @@ -2734,8 +2734,8 @@ void Draw_CharToDrawable (int num, unsigned int *drawable, int x, int y, int wid { for (i=s ; ifgcolour, drawable[i], gc->function, drawable[i], d_8to24rgbtable[source[i]]); - drawable[i] = gc->fgcolour;//d_8to24rgbtable[source[i]]; + GCFunc(gc->fgcolour, drawable[i], gc->function, drawable[i], d_8to24rgbtable[source[i]]); +// drawable[i] = gc->fgcolour;//d_8to24rgbtable[source[i]]; source += 128; drawable += width; } diff --git a/engine/qux/x_res.c b/engine/qux/x_res.c index c36ea5183..a20abe68d 100644 --- a/engine/qux/x_res.c +++ b/engine/qux/x_res.c @@ -62,6 +62,20 @@ Atom XS_FindAtom(char *name) return None; } +void XS_CheckResourceSentinals(void) +{ +/* xresource_t *res; + for (res = resources; res; res = res->next) + { + if (res->restype == x_window) + { + if (((xwindow_t*)res)->buffer) + BZ_CheckSentinals(((xwindow_t*)res)->buffer); + } + } + */ +} + void XS_DestroyResource(xresource_t *res) { qboolean nofree = false; @@ -369,6 +383,8 @@ xwindow_t *XS_CreateWindow(int wid, xclient_t *owner, xwindow_t *parent, short x XS_SetParent(neww, parent); XS_LinkResource(&neww->res); + + XS_CheckResourceSentinals(); return neww; } @@ -441,6 +457,8 @@ void XS_CreateInitialResources(void) xscreenheight = 480; xscreen = realloc(xscreen, xscreenwidth*4 * xscreenheight); + XS_CheckResourceSentinals(); + XS_DestroyResourcesOfClient(NULL); memset(resbuckets, 0, sizeof(resbuckets)); @@ -521,6 +539,8 @@ void XS_CreateInitialResources(void) rootwindow = XS_CreateWindow(baseres++, NULL, NULL, 0, 0, xscreenwidth, xscreenheight); rootwindow->mapped = true; + XS_CheckResourceSentinals(); + memset(&pm, 0, sizeof(pm)); pm.linked = true; @@ -535,6 +555,8 @@ void XS_CreateInitialResources(void) XW_ClearArea(rootwindow, 0, 0, rootwindow->width, rootwindow->height); + XS_CheckResourceSentinals(); + xrefreshed = true; }