wok-6.x rev 13738

xbattle: add 24bits colors patch
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Dec 26 13:16:19 2012 +0100 (2012-12-26)
parents 1e2ad144e0db
children 6c6481d419b2
files xbattle/receipt xbattle/stuff/pseudo_color.u xbattle/stuff/usr/share/applications/xbattle.desktop
line diff
     1.1 --- a/xbattle/receipt	Wed Dec 26 11:05:26 2012 +0100
     1.2 +++ b/xbattle/receipt	Wed Dec 26 13:16:19 2012 +0100
     1.3 @@ -16,6 +16,7 @@
     1.4  compile_rules()
     1.5  {
     1.6  	cd $src
     1.7 +	patch -p0 < $stuff/pseudo_color.u
     1.8  	xmkmf
     1.9  	make && make DESTDIR=$DESTDIR install
    1.10  }
    1.11 @@ -24,4 +25,5 @@
    1.12  genpkg_rules()
    1.13  {
    1.14  	cp -a $install/usr $fs
    1.15 +	cp -a $stuff/*/ $fs
    1.16  }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/xbattle/stuff/pseudo_color.u	Wed Dec 26 13:16:19 2012 +0100
     2.3 @@ -0,0 +1,71 @@
     2.4 +--- window.c
     2.5 ++++ window.c
     2.6 +@@ -708,8 +708,7 @@
     2.7 +   unsigned long valuemask;
     2.8 +   XSetWindowAttributes attrib;
     2.9 +   XVisualInfo vinfo;
    2.10 +-  long event_mask,
    2.11 +-       full_depth;
    2.12 ++  long event_mask;
    2.13 +   Atom wm_delete_window;
    2.14 + 
    2.15 +   /** Open display and screen **/
    2.16 +@@ -742,36 +741,11 @@
    2.17 +   /** Set bitplane depth to default **/
    2.18 + 
    2.19 +   xwindow->depth = DefaultDepth (xwindow->display, xwindow->screen);
    2.20 +-  full_depth = xwindow->depth;
    2.21 + 
    2.22 +   /** Get a visual **/
    2.23 + 
    2.24 +   visual = DefaultVisual (xwindow->display, xwindow->screen);
    2.25 + 
    2.26 +-  /** Try to force the display to 8 planes **/
    2.27 +-
    2.28 +-  if (xwindow->depth != 8)
    2.29 +-  {
    2.30 +-    if (XMatchVisualInfo
    2.31 +-		(xwindow->display, xwindow->screen, 8, PseudoColor, &vinfo))
    2.32 +-    {
    2.33 +-      visual = vinfo.visual;
    2.34 +-      xwindow->depth = 8;
    2.35 +-    }
    2.36 +-  }
    2.37 +-
    2.38 +-  /** If couldn't find an 8 bit visual, try a 16 bit visual **/
    2.39 +-
    2.40 +-  if (xwindow->depth != 8)
    2.41 +-  {
    2.42 +-    if (XMatchVisualInfo
    2.43 +-		(xwindow->display, xwindow->screen, 16, PseudoColor, &vinfo))
    2.44 +-    {
    2.45 +-      visual = vinfo.visual;
    2.46 +-      xwindow->depth = 16;
    2.47 +-    }
    2.48 +-  }
    2.49 +-
    2.50 +   /** If have less than 8 planes, just use a single plane **/
    2.51 + 
    2.52 +   if (xwindow->depth < 8)
    2.53 +@@ -790,20 +764,8 @@
    2.54 + #else
    2.55 +     /** Allocate existing colormap **/
    2.56 + 
    2.57 +-    if (full_depth > 8)
    2.58 ++    if (xwindow->depth > 8)
    2.59 +     {
    2.60 +-      /** XBattle won't work for 24 bit displays with no optional	**/
    2.61 +-      /** visuals with 8 or 16 bits.  This may be the case on some PCs.	**/
    2.62 +-      /** In these cases, it may be possible to reconfigure the display	**/
    2.63 +-      /** to 8 or 16 bits.						**/
    2.64 +-
    2.65 +-      if (xwindow->depth > 16)
    2.66 +-      {
    2.67 +-        throw_warning ("No PseudoColor visual available\n%s",
    2.68 +-		"         Try changing display to <= 16 bits");
    2.69 +-        throw_error ("Unable to continue without colormap", NULL);
    2.70 +-      }
    2.71 +-
    2.72 +       /** If display is 24 bit, have to create a dedicated colormap **/
    2.73 + 
    2.74 +       xwindow->cmap = XCreateColormap (xwindow->display,
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/xbattle/stuff/usr/share/applications/xbattle.desktop	Wed Dec 26 13:16:19 2012 +0100
     3.3 @@ -0,0 +1,8 @@
     3.4 +[Desktop Entry]
     3.5 +Type=Application
     3.6 +Encoding=UTF-8
     3.7 +Name=Xbattle
     3.8 +Exec=xbattle -black me -white unix -armies 4 -bases 2 -towns 2 -militia 2 -hills 7
     3.9 +Terminal=false
    3.10 +Categories=Application;Game;
    3.11 +Comment=Concurrent multi-player battle strategy game