Hello,
If there's somebody interested: here is a little (and actually very crude)
patch for those poor souls like myself who still have to run 256 colors
mode but like FvwmWharf module. It somewhat reduces its hunger for colours
(not completely, but with this and with texture buttons and with the
original AfterStep icons my fvwm uses 88 colours instead of 200++). It
requires the original ColorLimit patch, of course.
If somebody would make this better (what, I suppose, is not difficult for
any competent programmer - I'm definitely _not_ the one) please answer me
by e-mail, 'cause unfortunately I'm not on this list.
BTW, if there's somebody using fvwm95, I've got this patch for it as well,
but it's a bit bigger - about 20 kb.
Regards,
Vladimir
/*------------------------Start patch---------------------------------*/
diff -c FvwmWharf.c.orig FvwmWharf.c
*** FvwmWharf.c.orig Fri Nov 28 13:10:08 1997
--- FvwmWharf.c Fri Nov 28 16:17:55 1997
***************
*** 82,87 ****
--- 82,90 ----
#define ANIM_STEP_MAIN 1 /* same for the main folder */
#define ANIM_DELAY 10
+ /* Color limit */
+ int save_color_limit; /* color limit from config */
+
#ifdef ENABLE_SOUND
#define WHEV_PUSH 0
#define WHEV_CLOSE_FOLDER 1
***************
*** 261,267 ****
}
display_width = DisplayWidth(dpy, screen);
display_height = DisplayHeight(dpy, screen);
!
d_depth = DefaultDepth(dpy, screen);
SetMessageMask(fd, M_NEW_DESK | M_END_WINDOWLIST | M_MAP | M_WINDOW_NAME |
--- 264,271 ----
}
display_width = DisplayWidth(dpy, screen);
display_height = DisplayHeight(dpy, screen);
!
! InitPictureCMap(dpy,Root);
d_depth = DefaultDepth(dpy, screen);
SetMessageMask(fd, M_NEW_DESK | M_END_WINDOWLIST | M_MAP | M_WINDOW_NAME |
***************
*** 1688,1693 ****
--- 1692,1703 ----
{
CopyString(&pixmapPath,&tline[10]);
}
+ else if ((strlen(&tline[0])>1)&&(mymymymystrncasecmp(tline,"ColorLimit",10)==0))
+ {
+ len=sscanf(&tline[Clength+11],"%d",&save_color_limit);
+ if(len < 1)
+ save_color_limit = 256;
+ }
#ifdef ENABLE_SOUND
else if((strlen(&tline[0])>1)&&(mymymymystrncasecmp(tline,"*AudioDir",9)==0))
{
*** icons.c.orig Mon Jun 23 08:53:34 1997
--- icons.c Sat Nov 29 16:22:25 1997
***************
*** 39,45 ****
#ifdef XPM
#include <X11/xpm.h>
! #endif /* XPM */
#include "stepgfx.h"
--- 39,47 ----
#ifdef XPM
#include <X11/xpm.h>
! extern int save_color_limit;
! #endif
!
#include "stepgfx.h"
***************
*** 208,214 ****
XWindowAttributes root_attr;
XpmAttributes xpm_attributes;
char *path = NULL;
!
path = findIconFile(Buttons[button].icons[ico].file, pixmapPath,R_OK);
if(path == NULL) return 0;
XGetWindowAttributes(dpy,Root,&root_attr);
--- 210,218 ----
XWindowAttributes root_attr;
XpmAttributes xpm_attributes;
char *path = NULL;
! int rc;
! XpmImage my_image;
!
path = findIconFile(Buttons[button].icons[ico].file, pixmapPath,R_OK);
if(path == NULL) return 0;
XGetWindowAttributes(dpy,Root,&root_attr);
***************
*** 216,238 ****
xpm_attributes.closeness = 40000;
xpm_attributes.valuemask = XpmSize | XpmReturnPixels|XpmColormap
|XpmCloseness;
! if(XpmReadFileToPixmap(dpy, Root, path,
! &Buttons[button].icons[ico].icon,
! &Buttons[button].icons[ico].mask,
! &xpm_attributes) == XpmSuccess)
! {
! Buttons[button].icons[ico].w = xpm_attributes.width;
! Buttons[button].icons[ico].h = xpm_attributes.height;
! Buttons[button].icons[ico].depth = d_depth;
! free(path);
! } else {
free(path);
Buttons[button].icons[ico].icon=None;
return 0;
}
if (button==BACK_BUTTON) {
! BUTTONWIDTH = xpm_attributes.width;
! BUTTONHEIGHT = xpm_attributes.height;
if (ForceSize && (BUTTONWIDTH > 64 || BUTTONHEIGHT > 64)) {
Pixmap resized;
--- 220,253 ----
xpm_attributes.closeness = 40000;
xpm_attributes.valuemask = XpmSize | XpmReturnPixels|XpmColormap
|XpmCloseness;
!
! rc = XpmReadFileToXpmImage(path, &my_image, NULL);
! if (rc != XpmSuccess) {
! fprintf(stderr, "Problem reading pixmap %s, rc %d\n", path, rc);
! free(path);
! return;
! }
! color_reduce_pixmap(&my_image,save_color_limit);
! rc = XpmCreatePixmapFromXpmImage(dpy,Root, &my_image,
! &Buttons[button].icons[ico].icon,
! &Buttons[button].icons[ico].mask,
! &xpm_attributes);
!
! if (rc != XpmSuccess)
! {
! fprintf(stderr, "Problem creating pixmap from image, rc %d\n", rc);
free(path);
Buttons[button].icons[ico].icon=None;
return 0;
+ } else {
+ Buttons[button].icons[ico].w = my_image.width;
+ Buttons[button].icons[ico].h = my_image.height;
+ Buttons[button].icons[ico].depth = d_depth;
+ free(path);
}
if (button==BACK_BUTTON) {
! BUTTONWIDTH = my_image.width;
! BUTTONHEIGHT = my_image.height;
if (ForceSize && (BUTTONWIDTH > 64 || BUTTONHEIGHT > 64)) {
Pixmap resized;
***************
*** 262,285 ****
#ifdef XPM
XWindowAttributes root_attr;
XpmAttributes xpm_attributes;
!
if( button != BACK_BUTTON )
return 0;
XGetWindowAttributes(dpy,Root,&root_attr);
xpm_attributes.colormap = root_attr.colormap;
xpm_attributes.valuemask = XpmSize | XpmReturnPixels|XpmColormap;
! if(XpmCreatePixmapFromData(dpy, Root, data,
! &Buttons[button].icons[0].icon,
! &Buttons[button].icons[0].mask,
! &xpm_attributes) == XpmSuccess)
! {
! BUTTONWIDTH = Buttons[button].icons[0].w = xpm_attributes.width;
! BUTTONHEIGHT = Buttons[button].icons[0].h = xpm_attributes.height;
! Buttons[button].icons[0].depth = d_depth;
! }
! else {
! return 0;
! }
DrawOutline(Buttons[button].icons[0].icon,BUTTONWIDTH,BUTTONHEIGHT);
return 1;
--- 277,313 ----
#ifdef XPM
XWindowAttributes root_attr;
XpmAttributes xpm_attributes;
! XpmImage my_image;
! int rc;
!
if( button != BACK_BUTTON )
return 0;
XGetWindowAttributes(dpy,Root,&root_attr);
xpm_attributes.colormap = root_attr.colormap;
xpm_attributes.valuemask = XpmSize | XpmReturnPixels|XpmColormap;
!
! rc = XpmCreateXpmImageFromData(data, &my_image, NULL);
! color_reduce_pixmap(&my_image,save_color_limit);
! if (rc != XpmSuccess) {
! fprintf(stderr, "Problem creating xpm image from data, rc %d\n", rc);
! return 0;
! }
!
! rc = XpmCreatePixmapFromXpmImage(dpy,Root, &my_image,
! &Buttons[button].icons[0].icon,
! &Buttons[button].icons[0].mask,
! &xpm_attributes);
! if (rc != XpmSuccess) {
! fprintf(stderr, "Problem creating pixmap from xpm image, rc %d\n", rc);
! return 0;
! }
! else
! {
! BUTTONWIDTH = Buttons[button].icons[0].w = my_image.width;
! BUTTONHEIGHT = Buttons[button].icons[0].h = my_image.height;
! Buttons[button].icons[0].depth = d_depth;
! }
!
DrawOutline(Buttons[button].icons[0].icon,BUTTONWIDTH,BUTTONHEIGHT);
return 1;
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Sat Dec 06 1997 - 17:03:26 GMT