XPM support for X11; WM_CLASS and WM_COMMAND are now set too
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 10 Nov 2007 09:34:18 +0000 (09:34 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 10 Nov 2007 09:34:18 +0000 (09:34 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7680 d7cf8633-e32d-0410-b094-e92efae38249

darkplaces.xpm [new file with mode: 0644]
makefile.inc
nexuiz.xpm [new file with mode: 0644]
vid_glx.c

diff --git a/darkplaces.xpm b/darkplaces.xpm
new file mode 100644 (file)
index 0000000..befce12
--- /dev/null
@@ -0,0 +1,142 @@
+/* XPM */
+static char * darkplaces_xpm[] = {
+"48 48 91 1",
+"      c None",
+".     c #020300",
+"+     c #120303",
+"@     c #180202",
+"#     c #200301",
+"$     c #340100",
+"%     c #410000",
+"&     c #2D0704",
+"*     c #11120F",
+"=     c #4F0701",
+"-     c #3F0F00",
+";     c #251615",
+">     c #780000",
+",     c #2D1514",
+"'     c #1D1C1A",
+")     c #680F01",
+"!     c #431A10",
+"~     c #3B221D",
+"{     c #2B2725",
+"]     c #601B02",
+"^     c #9D0A00",
+"/     c #55220A",
+"(     c #3D2B25",
+"_     c #53291D",
+":     c #4E2E1B",
+"<     c #333432",
+"[     c #4C2F26",
+"}     c #812301",
+"|     c #3F332F",
+"1     c #6B321A",
+"2     c #3F3F3D",
+"3     c #7E320E",
+"4     c #563B35",
+"5     c #4B3E39",
+"6     c #533F39",
+"7     c #6D3A2F",
+"8     c #943508",
+"9     c #514541",
+"0     c #654132",
+"a     c #474845",
+"b     c #6D442B",
+"c     c #7C4328",
+"d     c #504F4D",
+"e     c #674A43",
+"f     c #644F47",
+"g     c #5E514B",
+"h     c #B64005",
+"i     c #91472F",
+"j     c #575654",
+"k     c #AD4A11",
+"l     c #82533C",
+"m     c #5F5E5B",
+"n     c #745C54",
+"o     c #6C5E5A",
+"p     c #A25329",
+"q     c #825C54",
+"r     c #676664",
+"s     c #816A62",
+"t     c #70706E",
+"u     c #986951",
+"v     c #7D706C",
+"w     c #C66935",
+"x     c #7E7C79",
+"y     c #FA6400",
+"z     c #937B73",
+"A     c #9E796A",
+"B     c #B97557",
+"C     c #A67B5D",
+"D     c #878581",
+"E     c #8F8D8B",
+"F     c #AF8A7D",
+"G     c #A58D83",
+"H     c #9C8F8C",
+"I     c #979693",
+"J     c #B79590",
+"K     c #A59F9C",
+"L     c #DD9472",
+"M     c #B39D97",
+"N     c #EB9462",
+"O     c #C1A391",
+"P     c #D19F8D",
+"Q     c #D1A184",
+"R     c #B6B0AD",
+"S     c #C8C2BF",
+"T     c #DDC0BC",
+"U     c #E1C2B0",
+"V     c #F8BE99",
+"W     c #DDD3CE",
+"X     c #EFE4E0",
+"Y     c #FEE4C7",
+"Z     c #FDFEFA",
+"                                                ",
+"                  ID                            ",
+"                  tvr                           ",
+"                  59aI                          ",
+"                  4v2t                          ",
+"                  4I2r                          ",
+"                 E[Xaj                          ",
+"                 z7Xda     RHrqsE               ",
+"                 f2XjaD    Itj93][zH            ",
+"                 92Wd2x     Ixja2,pQDI          ",
+"                 92Xx2t        Irjb&FIx         ",
+"                 5aZx5r          Dj{,ORx        ",
+"             xsja,eXt2r            t'+XIt       ",
+"          Mu/+|<<;[Xr2r             j!AXjt      ",
+"        Kq3=[222a,5Xt2r              5;SSdI     ",
+"       H;0A5222j ~oZr2t              t+CWjr     ",
+"      z37(2<2ax  <aXm2x               5/ZEaE    ",
+"      ,ARd22jD   5|Wr2x               s3YRar    ",
+"     90XM22jI    f,Sr2D               z)FZaj    ",
+"    H#UZj<dx     m*Er2x               D-OZaa    ",
+"    [0ZI2at      a_Frax               I]QZ2aR   ",
+"    cOXr2a     Ev{00sgr               D/OZa2R   ",
+"   v3uva2t     Ijaa222aD              v]WX2aR   ",
+"   giUI2aK      tjaaaajjtxtDKKR       e]UM2aR   ",
+"   c8OS2j           I  D<#8/djjD      ]kCr2j    ",
+"   (!OS2j               r;0v22ax      =3c52j    ",
+"   4-TS2r                'gRa<r      5/!c2at    ",
+"   n8US2r                'jXaaD     D[&192jS    ",
+"   v]OMaj                'jZaaI     SEKr22x     ",
+"   I+sA9j                |oZaaI    HZRra2j      ",
+"    ~eHdaD               [nZa2I  H[Avv22jD      ",
+"    r&uWdr               *{oa2DIe)#f522aD       ",
+"     40u0aI              +zj{j{;+:5a<ajD        ",
+"     xBL3gr             K<ZS{j{<2<22arX         ",
+"      vc[Omx            IvKZd<22ajjt            ",
+"       j1czxD           I[RZa2jtDD              ",
+"        j<pLoD          IoDZa2x                 ",
+"         r50[0zDI        zSSa2E                 ",
+"          Djaa55|dxI     0SRaa                  ",
+"            xjjaadrx     g|vaa                  ",
+"               RRR       reD<j                  ",
+"                         D4r2r                  ",
+"                          [j2t                  ",
+"                          faaD                  ",
+"                          gajI                  ",
+"                          xjr                   ",
+"                           DI                   ",
+"                                                "};
index ae1cc02..b3eaf5d 100644 (file)
@@ -172,7 +172,7 @@ LDFLAGS_RELEASE=$(OPTIM_RELEASE)
 OBJ_GLX= builddate.c sys_linux.o vid_glx.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
 
 LDFLAGS_UNIXCOMMON=-lm
-LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
+LDFLAGS_UNIXCL=-L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86dga -lXxf86vm $(LIB_SOUND)
 LDFLAGS_UNIXCL_PRELOAD=-lz -ljpeg -lpng -lvorbis -lvorbisfile -lcurl
 LDFLAGS_UNIXSV_PRELOAD=-lz -lcurl
 LDFLAGS_UNIXSDL_PRELOAD=-lz -ljpeg -lpng -lvorbis -lvorbisfile -lcurl
@@ -226,7 +226,7 @@ OBJ_SUNOSCD=$(OBJ_NOCD)
 CFLAGS_SUNOS=-I/usr/lib/oss/include -DBSD_COMP -DSUNOS
 
 # Link
-LDFLAGS_SUNOSCL=$(LDFLAGS_UNIXCOMMON) -ldl -lsocket -lnsl -R$(UNIX_X11LIBPATH) -L$(UNIX_X11LIBPATH) -lX11 -lXext -lXxf86vm $(LIB_SOUND)
+LDFLAGS_SUNOSCL=$(LDFLAGS_UNIXCOMMON) -ldl -lsocket -lnsl -R$(UNIX_X11LIBPATH) -L$(UNIX_X11LIBPATH) -lX11 -lXpm -lXext -lXxf86vm $(LIB_SOUND)
 LDFLAGS_SUNOSSV=$(LDFLAGS_UNIXCOMMON) -ldl -lsocket -lnsl
 LDFLAGS_SUNOSSDL=$(LDFLAGS_UNIXCOMMON) -ldl -lsocket -lnsl $(LDFLAGS_UNIXSDL)
 
diff --git a/nexuiz.xpm b/nexuiz.xpm
new file mode 100644 (file)
index 0000000..47a2172
--- /dev/null
@@ -0,0 +1,142 @@
+/* XPM */
+static char * nexuiz_xpm[] = {
+"48 48 91 1",
+"      c None",
+".     c #000000",
+"+     c #040404",
+"@     c #070707",
+"#     c #090909",
+"$     c #0B0B0B",
+"%     c #0E0E0E",
+"&     c #121212",
+"*     c #161616",
+"=     c #181818",
+"-     c #212121",
+";     c #242424",
+">     c #262626",
+",     c #282828",
+"'     c #2A2A2A",
+")     c #2D2D2D",
+"!     c #313131",
+"~     c #343434",
+"{     c #383838",
+"]     c #3A3A3A",
+"^     c #3E3E3E",
+"/     c #414141",
+"(     c #434343",
+"_     c #454545",
+":     c #474747",
+"<     c #4B4B4B",
+"[     c #515151",
+"}     c #595959",
+"|     c #5C5C5C",
+"1     c #5E5E5E",
+"2     c #606060",
+"3     c #626262",
+"4     c #656565",
+"5     c #696969",
+"6     c #6B6B6B",
+"7     c #6E6E6E",
+"8     c #727272",
+"9     c #747474",
+"0     c #777777",
+"a     c #7B7B7B",
+"b     c #7F7F7F",
+"c     c #828282",
+"d     c #848484",
+"e     c #868686",
+"f     c #888888",
+"g     c #8B8B8B",
+"h     c #8D8D8D",
+"i     c #8F8F8F",
+"j     c #929292",
+"k     c #949494",
+"l     c #969696",
+"m     c #989898",
+"n     c #9C9C9C",
+"o     c #9F9F9F",
+"p     c #A3A3A3",
+"q     c #A6A6A6",
+"r     c #AAAAAA",
+"s     c #ACACAC",
+"t     c #AEAEAE",
+"u     c #B1B1B1",
+"v     c #B3B3B3",
+"w     c #B5B5B5",
+"x     c #B7B7B7",
+"y     c #BABABA",
+"z     c #BCBCBC",
+"A     c #BFBFBF",
+"B     c #C3C3C3",
+"C     c #C5C5C5",
+"D     c #C7C7C7",
+"E     c #C9C9C9",
+"F     c #CCCCCC",
+"G     c #CFCFCF",
+"H     c #D2D2D2",
+"I     c #D5D5D5",
+"J     c #D7D7D7",
+"K     c #D9D9D9",
+"L     c #DBDBDB",
+"M     c #DDDDDD",
+"N     c #DFDFDF",
+"O     c #E2E2E2",
+"P     c #E4E4E4",
+"Q     c #E7E7E7",
+"R     c #E9E9E9",
+"S     c #EBEBEB",
+"T     c #EEEEEE",
+"U     c #F2F2F2",
+"V     c #F4F4F4",
+"W     c #F6F6F6",
+"X     c #F8F8F8",
+"Y     c #FBFBFB",
+"Z     c #FEFEFE",
+"                                                ",
+"               ZWQQVZZ                          ",
+"               YI02kFQYZ                        ",
+"               ZJ~..+2vQY                       ",
+"               ZS7.....0OZ                      ",
+"                Yx......nU                      ",
+"                ZI$.....<P    ZZYYZZ            ",
+"                ZF......^OZZXUPIByEMTYZ         ",
+"                Yw......3KOHuc:%...'0xMUZZ      ",
+"                Vk....../6_$..........~fGX      ",
+"             ZYVK1......................-I      ",
+"         ZYUQKAk}........................A      ",
+"      ZYUNBj|;...........................B      ",
+"    ZWNBh^...............................G      ",
+"    YG2.................................;L      ",
+"    XC:......................)2gd.......4R      ",
+"    ZUGh)................]0rFMRTx.......oW      ",
+"      ZUKva!.........&fvFMTXZZ Yt.......DY      ",
+"        ZXTMEp9).....hRYZZ     Vm......~MZ      ",
+"           ZZWPd.....DY        Ta......7S       ",
+"              S6....~MZ        Q}......lV       ",
+"             ZM)....0T         M~......AY       ",
+"             YC.....wY        ZI&.....'LZ       ",
+"             Wo....>KZ        ZE......7S        ",
+"             S7....0T         Yz......pW        ",
+"            ZK,....tX         Ys......BY        ",
+"            Yw....-JZ         Vk.....'LZ        ",
+"            T9....aT          T8.....7S         ",
+"           ZJ-....BY          O:.....rX         ",
+"           Xs....[PZ         ZJ=....@GZ         ",
+"          ZM_....xX          YB.....<PZ         ",
+"          Wq....5QZ          Wp.....eU          ",
+"         YI{...>GY           T0.....AY          ",
+"        ZTd....uW           ZO/....^MZ          ",
+"        YA+...iTZ           YE.....kU           ",
+"       YJ(...fQZ            Uj....*HZ           ",
+"      ZSb...fQZ            ZN^....bT            ",
+"      Wu#.%nQZ             YA....*GY            ",
+"     YG<.^AUZ             ZQ5....eT             ",
+"     To}eIXZ           ZZYWu....)IY             ",
+"     WHITY             ZSCu,....pV              ",
+"     ZXZZ              Ww,.....}NZ              ",
+"                       YC+....=DY               ",
+"                       ZQ2....pV                ",
+"                        YA...0QZ                ",
+"                        ZQ5.|JY                 ",
+"                         YQGPY                  ",
+"                                                "};
index 0bd0351..35f70de 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <X11/keysym.h>
 #include <X11/cursorfont.h>
+#include <X11/xpm.h>
 
 #include <X11/extensions/XShm.h>
 #if !defined(__APPLE__) && !defined(__MACH__) && !defined(SUNOS)
@@ -36,6 +37,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "quakedef.h"
 
+#include "nexuiz.xpm"
+#include "darkplaces.xpm"
+
 // Tell startup code that we have a client
 int cl_available = true;
 
@@ -622,6 +626,8 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate
        int i;
        int attrib[32];
        XSetWindowAttributes attr;
+       XClassHint *clshints;
+       XWMHints wmhints;
        unsigned long mask;
        Window root;
        XVisualInfo *visinfo;
@@ -759,7 +765,19 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate
                mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
 
        win = XCreateWindow(vidx11_display, root, 0, 0, width, height, 0, visinfo->depth, InputOutput, visinfo->visual, mask, &attr);
-       XStoreName(vidx11_display, win, gamename);
+
+       wmhints.flags = 0;
+       if(XpmCreatePixmapFromData(vidx11_display, win,
+               (gamemode == GAME_NEXUIZ) ? nexuiz_xpm : darkplaces_xpm,
+               &wmhints.icon_pixmap, &wmhints.icon_mask, NULL) == XpmSuccess)
+               wmhints.flags |= IconPixmapHint | IconMaskHint;
+
+       clshints = XAllocClassHint();
+       clshints->res_name = strdup(gamename);
+       clshints->res_class = strdup("DarkPlaces");
+
+       XmbSetWMProperties(vidx11_display, win, gamename, gamename, (char **) com_argv, com_argc, NULL, &wmhints, clshints);
+       //XStoreName(vidx11_display, win, gamename);
        XMapWindow(vidx11_display, win);
 
        // LordHavoc: making the close button on a window do the right thing