}
}
}
+
+// decodes an XPM from C syntax
+char **XPM_DecodeString(const char *in)
+{
+ static char *tokens[257];
+ static char lines[257][512];
+ size_t line = 0;
+
+ // skip until "{" token
+ while(COM_ParseToken_QuakeC(&in, false) && strcmp(com_token, "{"));
+
+ // now, read in succession: string, comma-or-}
+ while(COM_ParseToken_QuakeC(&in, false))
+ {
+ tokens[line] = lines[line];
+ strlcpy(lines[line++], com_token, sizeof(lines[0]));
+ if(!COM_ParseToken_QuakeC(&in, false))
+ return NULL;
+ if(!strcmp(com_token, "}"))
+ break;
+ if(strcmp(com_token, ","))
+ return NULL;
+ if(line >= sizeof(tokens) / sizeof(tokens[0]))
+ return NULL;
+ }
+
+ return tokens;
+}
void FindFraction(double val, int *num, int *denom, int denomMax);
+// decodes XPM file to XPM array (as if #include'd)
+char **XPM_DecodeString(const char *in);
+
#endif
XVisualInfo *visinfo;
int MajorVersion, MinorVersion;
const char *drivername;
+ char *xpm;
+ char **idata;
vid_isfullscreen = false;
vid_isnetwmfullscreen = false;
win = XCreateWindow(vidx11_display, root, 0, 0, mode->width, mode->height, 0, visinfo->depth, InputOutput, visinfo->visual, mask, &attr);
+ xpm = (char *) FS_LoadFile("darkplaces-icon.xpm", tempmempool, false, NULL);
+ idata = NULL;
+ if(xpm)
+ idata = XPM_DecodeString(xpm);
+ if(!idata)
+ idata = ENGINE_ICON;
+
wmhints = XAllocWMHints();
if(XpmCreatePixmapFromData(vidx11_display, win,
- (gamemode == GAME_NEXUIZ) ? nexuiz_xpm : darkplaces_xpm,
+ idata,
&wmhints->icon_pixmap, &wmhints->icon_mask, NULL) == XpmSuccess)
wmhints->flags |= IconPixmapHint | IconMaskHint;
+ if(xpm)
+ Mem_Free(xpm);
+
clshints = XAllocClassHint();
clshints->res_name = strdup(gamename);
clshints->res_class = strdup("DarkPlaces");
int thenone = -1;
static SDL_Color palette[256];
unsigned short palenc[256]; // store color id by char
-
- char **idata = ENGINE_ICON;
- char *data = idata[0];
+ char *xpm;
+ char **idata, *data;
+
+ xpm = (char *) FS_LoadFile("darkplaces-icon.xpm", tempmempool, false, NULL);
+ idata = NULL;
+ if(xpm)
+ idata = XPM_DecodeString(xpm);
+ if(!idata)
+ idata = ENGINE_ICON;
+ if(xpm)
+ Mem_Free(xpm);
+
+ data = idata[0];
if(sscanf(data, "%i %i %i %i", &width, &height, &colors, &isize) != 4)
{