From 4cc1341b221365689d26e2ad59b2182e9a3acc7a Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 10 Oct 2012 22:58:51 +0000 Subject: [PATCH] couple of fixes for q2 + berkelium. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4122 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_main.c | 2 +- engine/client/client.h | 2 +- engine/client/m_mp3.c | 3 + engine/client/menu.h | 2 +- engine/client/r_surf.c | 4 +- engine/common/bothdefs.h | 9 ++- engine/common/gl_q2bsp.c | 22 +++++- engine/common/plugin.c | 2 +- engine/common/pr_bgcmd.c | 167 +++++++++++++++++++++++++++++---------- engine/d3d/d3d_backend.c | 3 +- engine/d3d/vid_d3d.c | 2 +- engine/gl/gl_shader.c | 4 +- engine/gl/gl_shadow.c | 2 - plugins/xsv/m_x.c | 23 ++++-- plugins/xsv/x_reqs.c | 22 ++++-- plugins/xsv/x_res.c | 4 + 16 files changed, 204 insertions(+), 69 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index a053bbbd5..b7a29b7f2 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -3658,7 +3658,7 @@ double Host_Frame (double time) SV_Frame(); RSpeedEnd(RSPEED_SERVER); host_frametime = ohft; - if (cls.protocol != CP_QUAKE3) + if (cls.protocol != CP_QUAKE3 && cls.protocol != CP_QUAKE2) CL_ReadPackets (); //q3's cgame cannot cope with input commands with the same time as the most recent snapshot value } #endif diff --git a/engine/client/client.h b/engine/client/client.h index e98441355..e15793116 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -683,7 +683,7 @@ typedef struct int teamplay; int deathmatch; - qboolean teamfortress; //*sigh*. This is used for teamplay stuff. This sucks. + qboolean teamfortress; // *sigh*. This is used for teamplay stuff. This sucks. qboolean hexen2pickups; qboolean sendprespawn; diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index 0c2c8db5b..44720d569 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -1394,6 +1394,9 @@ qboolean Media_UnregisterDecoder(struct plugin_s *plug, media_decoder_funcs_t *f static qboolean Media_Plugin_DecodeFrame(cin_t *cin, qboolean nosound) { struct plugin_s *oldplug = currentplug; + if (!cin->plugin.funcs->decodeframe) + return false; //plugin closed or something + currentplug = cin->plugin.plug; cin->outdata = cin->plugin.funcs->decodeframe(cin->plugin.ctx, nosound, &cin->outtype, &cin->outwidth, &cin->outheight); currentplug = oldplug; diff --git a/engine/client/menu.h b/engine/client/menu.h index 99141eeb3..bc64cefb6 100644 --- a/engine/client/menu.h +++ b/engine/client/menu.h @@ -57,7 +57,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //mt_custom - Just an option with callbacks. This is the basis of the top/bottom color seletion, and could be used for all sorts of things. -//Sample menu creation, entirly within /* and */ +//Sample menu creation, entirly within / * and * / //Note that most of FTE's menus are more complicated, as FTE runs on Q1/Q2/H2 data, and it's choice of menu images reflects this. //Most of the normal menus also have more items too, of course. diff --git a/engine/client/r_surf.c b/engine/client/r_surf.c index 3dc710fe1..43cdf668c 100644 --- a/engine/client/r_surf.c +++ b/engine/client/r_surf.c @@ -2206,9 +2206,11 @@ void Surf_DrawWorld (void) { int leafnum; int clientarea; -#ifdef QUAKE2 +#ifdef Q2CLIENT if (cls.protocol == CP_QUAKE2) //we can get server sent info + { memcpy(areabits, cl.q2frame.areabits, sizeof(areabits)); + } else #endif { //generate the info each frame. diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index 1bb93ce14..b946733a5 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -85,7 +85,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define AVAIL_OGGVORBIS -// #define AVAIL_OPENAL /* Jogi's OpenAL support */ + /* Jogi's OpenAL support */ +// #define AVAIL_OPENAL #endif #if defined(MINGW) || defined(MACOSX) @@ -109,7 +110,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define D3D9QUAKE #endif -#if (defined(D3D9QUAKE) || defined(D3D11Quake)) && !defined(D3DQUAKE) +#if (defined(D3D9QUAKE) || defined(D3D11QUAKE)) && !defined(D3DQUAKE) #define D3DQUAKE #endif @@ -270,6 +271,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #endif +#if defined(RTLIGHTS) && !defined(GLQUAKE) && !defined(D3D9QUAKE) +#undef RTLIGHTS +#endif + #ifndef _WIN32 #undef QTERM //not supported - FIXME: move to native plugin #endif diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index cc171cb79..ee6308e83 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -331,7 +331,7 @@ static qbyte portalopen[MAX_Q2MAP_AREAPORTALS]; //memset will work if it's a qby static int mapisq3; -cvar_t map_noareas = SCVAR("map_noareas", "1"); //1 for lack of mod support. +cvar_t map_noareas = SCVAR("map_noareas", "0"); //1 for lack of mod support. cvar_t map_noCurves = SCVARF("map_noCurves", "0", CVAR_CHEAT); cvar_t map_autoopenportals = SCVAR("map_autoopenportals", "1"); //1 for lack of mod support. cvar_t r_subdivisions = SCVAR("r_subdivisions", "2"); @@ -2318,6 +2318,13 @@ qboolean CModQ3_LoadFogs (lump_t *l) { out->planes[j] = brushsides[j].plane; } + + if (!out->shader->fog_dist) + { + //invalid fog shader, don't use. + out->shader = NULL; + out->numplanes = 0; + } } return true; @@ -2858,7 +2865,7 @@ qboolean CModRBSP_LoadRFaces (lump_t *l) R_BuildDefaultTexnums(&out->texinfo->texture->shader->defaulttextures, out->texinfo->texture->shader); } - if (in->fognum < 0 || in->fognum >= map_numfogs) + if (in->fognum < 0 || in->fognum >= map_numfogs || !map_fogs[in->fognum].shader) out->fog = NULL; else out->fog = map_fogs + in->fognum; @@ -5840,6 +5847,17 @@ int CM_WriteAreaBits (model_t *mod, qbyte *buffer, int area) } +void CM_InitPortalState(void) +{ + int i; + //if we're not running q2, force all q2 portals open. + if (svs.gametype != GT_QUAKE2 && !mapisq3) + { + for (i = 0; i < numareas; i++) + map_q2areas[i].floodnum = 0; + } +} + /* =================== CM_WritePortalState diff --git a/engine/common/plugin.c b/engine/common/plugin.c index 362d63897..f492b1681 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -477,7 +477,7 @@ static qintptr_t VARGS Plug_ExportNative(void *offset, quintptr_t mask, const qi else if (!strcmp(name, "Media_VideoDecoder")) { Media_RegisterDecoder(currentplug, func); - currentplug->blockcloses++; +// currentplug->blockcloses++; } #endif diff --git a/engine/common/pr_bgcmd.c b/engine/common/pr_bgcmd.c index 2e720cb17..23894d075 100644 --- a/engine/common/pr_bgcmd.c +++ b/engine/common/pr_bgcmd.c @@ -285,11 +285,16 @@ void QCBUILTIN PF_getsurfacetexture(progfuncs_t *prinst, struct globalvars_s *pr // #438 float(entity e, vector p) getsurfacenearpoint (DP_QC_GETSURFACE) void QCBUILTIN PF_getsurfacenearpoint(progfuncs_t *prinst, struct globalvars_s *pr_globals) { +#define TriangleNormal(a,b,c,n) ( \ + (n)[0] = ((a)[1] - (b)[1]) * ((c)[2] - (b)[2]) - ((a)[2] - (b)[2]) * ((c)[1] - (b)[1]), \ + (n)[1] = ((a)[2] - (b)[2]) * ((c)[0] - (b)[0]) - ((a)[0] - (b)[0]) * ((c)[2] - (b)[2]), \ + (n)[2] = ((a)[0] - (b)[0]) * ((c)[1] - (b)[1]) - ((a)[1] - (b)[1]) * ((c)[0] - (b)[0]) \ + ) + model_t *model; wedict_t *ent; msurface_t *surf; int i; - float planedist; float *point; vec3_t edgedir; @@ -312,53 +317,130 @@ void QCBUILTIN PF_getsurfacenearpoint(progfuncs_t *prinst, struct globalvars_s * if (!model || model->type != mod_brush) return; - if (model->fromgame != fg_quake) - return; - - - surf = model->surfaces + model->firstmodelsurface; - for (i = 0; i < model->nummodelsurfaces; i++, surf++) + if (model->fromgame == fg_quake) { - planedist = DotProduct(point, surf->plane->normal) - surf->plane->dist; - //don't care about SURF_PLANEBACK, the maths works out the same. + //all polies, we can skip parts. special case. - if (planedist*planedist < bestdist) - { //within a specific range - //make sure it's within the poly - VectorMA(point, planedist, surf->plane->normal, cpoint); - for (e = surf->firstedge+surf->numedges; e > surf->firstedge; edge++) - { - edge = model->surfedges[--e]; - if (edge < 0) - { - v1 = &model->vertexes[model->edges[-edge].v[0]]; - v2 = &model->vertexes[model->edges[-edge].v[1]]; - } - else - { - v2 = &model->vertexes[model->edges[edge].v[0]]; - v1 = &model->vertexes[model->edges[edge].v[1]]; - } - - VectorSubtract(v1->position, v2->position, edgedir); - CrossProduct(edgedir, surf->plane->normal, edgenormal); - if (!(surf->flags & SURF_PLANEBACK)) - { - VectorNegate(edgenormal, edgenormal); - } - VectorNormalize(edgenormal); + surf = model->surfaces + model->firstmodelsurface; + for (i = 0; i < model->nummodelsurfaces; i++, surf++) + { + dist = DotProduct(point, surf->plane->normal) - surf->plane->dist; + //don't care about SURF_PLANEBACK, the maths works out the same. - dist = DotProduct(v1->position, edgenormal) - DotProduct(cpoint, edgenormal); - if (dist < 0) - VectorMA(cpoint, dist, edgenormal, cpoint); + if (dist*dist < bestdist) + { //within a specific range + //make sure it's within the poly + VectorMA(point, dist, surf->plane->normal, cpoint); + for (e = surf->firstedge+surf->numedges; e > surf->firstedge; edge++) + { + edge = model->surfedges[--e]; + if (edge < 0) + { + v1 = &model->vertexes[model->edges[-edge].v[0]]; + v2 = &model->vertexes[model->edges[-edge].v[1]]; + } + else + { + v2 = &model->vertexes[model->edges[edge].v[0]]; + v1 = &model->vertexes[model->edges[edge].v[1]]; + } + + VectorSubtract(v1->position, v2->position, edgedir); + CrossProduct(edgedir, surf->plane->normal, edgenormal); + if (!(surf->flags & SURF_PLANEBACK)) + { + VectorNegate(edgenormal, edgenormal); + } + VectorNormalize(edgenormal); + + dist = DotProduct(v1->position, edgenormal) - DotProduct(cpoint, edgenormal); + if (dist < 0) + VectorMA(cpoint, dist, edgenormal, cpoint); + } + + VectorSubtract(cpoint, point, temp); + dist = DotProduct(temp, temp); + if (dist < bestdist) + { + bestsurf = i; + bestdist = dist; + } } + } + } + else + { + int j; + float *v1, *v2; + vec3_t trinorm; - VectorSubtract(cpoint, point, temp); - dist = DotProduct(temp, temp); - if (dist < bestdist) + //if performance is needed, I suppose we could try walking bsp nodes a bit + surf = model->surfaces + model->firstmodelsurface; + for (i = 0; i < model->nummodelsurfaces; i++, surf++) + { + mesh_t *mesh = surf->mesh; +/* vec3_t mins, maxs; + + //calc the surface bounds + ClearBounds(mins, maxs); + for (j = 0; j < mesh->numvertexes; j++) + AddPointToBounds(mesh->xyz_array[j], mins, maxs); + + //clip the point to within those bounds + for (j = 0; j < 3; j++) { - bestsurf = i; - bestdist = dist; + if (cpoint[j] < mins[j]) + cpoint[j] = mins[j]; + else + cpoint[j] = point[j]; + + if (cpoint[j] > maxs[j]) + cpoint[j] = maxs[j]; + } + //if the point got clipped to too far away, we can't do much + VectorSubtract(point, cpoint, temp); + dist = DotProduct(temp, temp); + if (dist*dist > bestdist) + continue; +*/ + for (j = 0; j < mesh->numindexes; j+=3) + { + //calculate the distance from the plane + TriangleNormal(mesh->xyz_array[mesh->indexes[j+2]], mesh->xyz_array[mesh->indexes[j+1]], mesh->xyz_array[mesh->indexes[j+0]], trinorm); + if (!trinorm[0] && !trinorm[1] && !trinorm[2]) + continue; + VectorNormalize(trinorm); + dist = DotProduct(point, trinorm) - DotProduct(mesh->xyz_array[mesh->indexes[j+0]], trinorm); + if (dist*dist < bestdist) + { + //set cpoint to be the point on the plane + VectorMA(point, -dist, trinorm, cpoint); + + //clip to each edge of the triangle + for (e = 0; e < 3; e++) + { + v1 = mesh->xyz_array[mesh->indexes[j+e]]; + v2 = mesh->xyz_array[mesh->indexes[j+((e+1)%3)]]; + + VectorSubtract(v1, v2, edgedir); + CrossProduct(edgedir, trinorm, edgenormal); + VectorNormalize(edgenormal); + + dist = DotProduct(cpoint, edgenormal) - DotProduct(v1, edgenormal); + if (dist < 0) + VectorMA(cpoint, -dist, edgenormal, cpoint); + } + + //if the point is closer, we win. + VectorSubtract(cpoint, point, temp); + dist = DotProduct(temp, temp); + if (dist < bestdist) + { + bestsurf = i; + bestdist = dist; + //can't break, one of the other tris might be closer. + } + } } } } @@ -368,6 +450,7 @@ void QCBUILTIN PF_getsurfacenearpoint(progfuncs_t *prinst, struct globalvars_s * // #439 vector(entity e, float s, vector p) getsurfaceclippedpoint (DP_QC_GETSURFACE) void QCBUILTIN PF_getsurfaceclippedpoint(progfuncs_t *prinst, struct globalvars_s *pr_globals) { + Con_Printf("PF_getsurfaceclippedpoint not implemented\n"); } // #628 float(entity e, float s) getsurfacenumtriangles diff --git a/engine/d3d/d3d_backend.c b/engine/d3d/d3d_backend.c index e9a7d5de4..ed651fdc7 100644 --- a/engine/d3d/d3d_backend.c +++ b/engine/d3d/d3d_backend.c @@ -2019,7 +2019,8 @@ static void BE_DrawMeshChain_Internal(void) switch (shaderstate.mode) { case BEM_LIGHT: - BE_RenderMeshProgram(shaderstate.shader_rtlight, vertcount, idxfirst, idxcount); + if (shaderstate.shader_rtlight->prog) + BE_RenderMeshProgram(shaderstate.shader_rtlight, vertcount, idxfirst, idxcount); break; case BEM_DEPTHONLY: shaderstate.lastpasscount = 0; diff --git a/engine/d3d/vid_d3d.c b/engine/d3d/vid_d3d.c index acf8c63f0..f61321ef2 100644 --- a/engine/d3d/vid_d3d.c +++ b/engine/d3d/vid_d3d.c @@ -5,7 +5,7 @@ #include "glquake.h" -#ifdef D3DQUAKE +#ifdef D3D9QUAKE #include "winquake.h" #if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500) diff --git a/engine/gl/gl_shader.c b/engine/gl/gl_shader.c index 1d355d909..b97a1b410 100644 --- a/engine/gl/gl_shader.c +++ b/engine/gl/gl_shader.c @@ -1515,7 +1515,7 @@ static void Shader_LoadGeneric(sgeneric_t *g, int qrtype) else if (qrenderer == QR_DIRECT3D9) FS_LoadFile(va("hlsl/%s.hlsl", basicname), &file); else if (qrenderer == QR_DIRECT3D11) - FS_LoadFile(va("hlsl/%s.hlsl", basicname), &file); + FS_LoadFile(va("hlsl11/%s.hlsl", basicname), &file); else if (qrenderer == QR_OPENGL) { #ifdef GLQUAKE @@ -1625,7 +1625,7 @@ void Shader_WriteOutGenerics_f(void) else if (sbuiltins[i].qrtype == QR_DIRECT3D9) name = va("hlsl/%s.hlsl", sbuiltins[i].name); else if (sbuiltins[i].qrtype == QR_DIRECT3D11) - name = va("hlsl/%s.hlsl", sbuiltins[i].name); + name = va("hlsl11/%s.hlsl", sbuiltins[i].name); if (name) { diff --git a/engine/gl/gl_shadow.c b/engine/gl/gl_shadow.c index 208ad0571..4b10caee7 100644 --- a/engine/gl/gl_shadow.c +++ b/engine/gl/gl_shadow.c @@ -9,7 +9,6 @@ model meshes are interpolated multiple times per frame //#define DBG_COLOURNOTDEPTH -#if defined(GLQUAKE) || defined(D3D9QUAKE) #ifdef RTLIGHTS #include "glquake.h" @@ -3080,4 +3079,3 @@ void Sh_DrawLights(qbyte *vis) // memset(&bench, 0, sizeof(bench)); } #endif -#endif diff --git a/plugins/xsv/m_x.c b/plugins/xsv/m_x.c index fdd271a31..15f54c50a 100644 --- a/plugins/xsv/m_x.c +++ b/plugins/xsv/m_x.c @@ -1,4 +1,9 @@ -//network interface +//network interface+main module + +//this code should work okay as a host server for Xepher. +//issue these two commands and Xephyr will do all the stuff we don't support properly. +//DISPLAY=127.0.0.1:0 Xephyr :1 +//wmaker -display :1 (or xterm or whatever) #include "../plugin.h" #include "../engine.h" @@ -13,6 +18,7 @@ static qhandle_t xlistensocket=NULL; xwindow_t *xfocusedwindow; qboolean xrefreshed; +qboolean xscreenmodified; //texture updated xclient_t *xgrabbedclient; //clients can ask the server to ignore other clients extern xwindow_t *xpgrabbedwindow; @@ -1355,10 +1361,9 @@ void X_EvalutateCursorOwner(int movemode) if (mx != x_mousex || my != x_mousey) { + mask |= PointerMotionMask; if (mousestate) mask |= ButtonMotionMask; - else - mask |= PointerMotionMask; } if ((mousestate^x_mousestate) & Button1Mask) mask |= Button1MotionMask; @@ -1669,6 +1674,7 @@ void XWindows_Draw(void) { XWindows_RefreshWindow(rootwindow); xrefreshed = false; + xscreenmodified = true; // Con_Printf("updated screen\n"); } @@ -1915,7 +1921,7 @@ int Plug_MenuEvent(int *args) return 0; } -int Plug_ExecuteCommand(int *args) +qintptr_t Plug_ExecuteCommand(qintptr_t *args) { char cmd[256]; Cmd_Argv(0, cmd, sizeof(cmd)); @@ -1927,7 +1933,7 @@ int Plug_ExecuteCommand(int *args) return 0; } -int Plug_Tick(int *args) +qintptr_t Plug_Tick(qintptr_t *args) { XWindows_TendToClients(); return 0; @@ -1950,6 +1956,10 @@ qbyte *XWindows_DisplayFrame(void *ctx, qboolean nosound, enum uploadfmt *fmt, i *fmt = TF_BGRX32; *width = xscreenwidth; *height = xscreenheight; + + if (!xscreenmodified) + return NULL; + xscreenmodified = false; return xscreen; } @@ -1971,6 +1981,7 @@ static qboolean XWindows_SetSize (void *ctx, int width, int height) xscreen = ns; xscreenwidth = width; xscreenheight = height; + xscreenmodified = true; //FIXME: resize root window + send notify @@ -2015,7 +2026,7 @@ media_decoder_funcs_t decoderfuncs = }; -int Plug_Init(int *args) +qintptr_t Plug_Init(qintptr_t *args) { if (!Plug_Export("ExecuteCommand", Plug_ExecuteCommand) || // !Plug_Export("MenuEvent", Plug_MenuEvent) || diff --git a/plugins/xsv/x_reqs.c b/plugins/xsv/x_reqs.c index 719a7c4f4..cc535300c 100644 --- a/plugins/xsv/x_reqs.c +++ b/plugins/xsv/x_reqs.c @@ -1437,7 +1437,7 @@ void XR_GetKeyboardMapping (xclient_t *cl, xReq *request) void XR_QueryPointer (xclient_t *cl, xReq *request) { - extern int mousecursor_x, mousecursor_y; + extern int x_mousex, x_mousey, x_mousestate; xQueryPointerReply rep; rep.type = X_Reply; @@ -1446,14 +1446,25 @@ void XR_QueryPointer (xclient_t *cl, xReq *request) rep.length = 0; rep.root = rootwindow->res.id; rep.child = rootwindow->res.id; - rep.rootX = mousecursor_x; - rep.rootY = mousecursor_y; - rep.winX = mousecursor_x; - rep.winY = mousecursor_y; + rep.rootX = x_mousex; + rep.rootY = x_mousey; + rep.winX = x_mousex; + rep.winY = x_mousey; rep.mask = 0; rep.pad1 = 0; rep.pad = 0; + if ((x_mousestate) & Button1Mask) + rep.mask |= Button1MotionMask; + if ((x_mousestate) & Button2Mask) + rep.mask |= Button2MotionMask; + if ((x_mousestate) & Button3Mask) + rep.mask |= Button3MotionMask; + if ((x_mousestate) & Button4Mask) + rep.mask |= Button4MotionMask; + if ((x_mousestate) & Button5Mask) + rep.mask |= Button5MotionMask; + X_SendData(cl, &rep, sizeof(rep)); } @@ -2127,7 +2138,6 @@ void XR_CreatePixmap(xclient_t *cl, xReq *request) // X_SendError(cl, BadValue, req->depth, X_CreatePixmap, 0); // return; } - req->depth = 24; if (XS_GetResource(req->pid, (void**)&newpix) != x_none) { diff --git a/plugins/xsv/x_res.c b/plugins/xsv/x_res.c index 39c8d4bbd..1c1cc92af 100644 --- a/plugins/xsv/x_res.c +++ b/plugins/xsv/x_res.c @@ -12,6 +12,7 @@ xwindow_t *rootwindow; xresource_t *resources; qbyte *xscreen; +qboolean xscreenmodified; short xscreenwidth; short xscreenheight; @@ -392,6 +393,7 @@ xwindow_t *XS_CreateWindow(int wid, xclient_t *owner, xwindow_t *parent, short x neww->width = width; neww->height = height; neww->buffer = NULL; + neww->depth = 24; XS_SetParent(neww, parent); @@ -561,6 +563,7 @@ void XS_CreateInitialResources(void) xscreenwidth = 640; xscreenheight = 480; xscreen = realloc(xscreen, xscreenwidth*4 * xscreenheight); + xscreenmodified = true; XS_CheckResourceSentinals(); @@ -643,6 +646,7 @@ void XS_CreateInitialResources(void) XS_CreateAtom(baseres++, "WM_TRANSIENT_FOR", NULL); rootwindow = XS_CreateWindow(baseres++, NULL, NULL, 0, 0, xscreenwidth, xscreenheight); + rootwindow->depth = 24; rootwindow->mapped = true; XS_CheckResourceSentinals();