Subject: FVWM: bug in fvwm_button_pxp8.diff ?

From: Patrice Fortier <[email-masked]>
Date: Fri, 31 May 1996 15:40:15 +0200 (MET DST)

I have a strange problem using the fvwm_button_pxp8.* patch.
I use a pixmap in the 1st left button:
ButtonStyle 1 Pixmap xfoo.xpm

xfoo.xpm is 22x14 pixels and the button size is 19x18 pixels (without
the 3d borders). So the pixmap is larger than the button.

  My request trashes the left 3d border drawing.
I've included a small xpm to show the result, as my english isn't very
good :)

  As I really wanted this xpm to fit in the buttonbox, I cropped it
to 20x14 (the xpm was still larger than the button), and everything
worked perfectly.

  I don't know if it's a bug, or if I shouldn't display a pixmap
larger than a titlebar button, but if someone can tell it to me :)

---------------------cut here--------------------------

/* XPM */
static char *fvwm-bug[] = {
/* width height num_colors chars_per_pixel */
"    26    24       10            1",
/* colors */
". c #000000",
"# c #305060",
"a c #3060a0",
"b c #60a0c0",
"c c #808080",
"d c #88e0f8",
"e c #909090",
"f c #a0a0a0",
"g c #f0f0f0",
"h c #f8ece8",
/* pixels */
"bbbbbbbbbbbbbbbbbbbbbb#dbb",
"b#########################",
"b#dddddddddddddddddddd#ddd",
"b#dbbbbbbbbbbbbbbbbbbb#dbb",
"b#dbbbbbbbbbbbbbbbbbbb#dbb",
"b#ffffgggggggggggaeeee#dbb",
"b#ffffgaaaaaaaaaf.eeee#dbb",
"b#fefegagca....af.eeec#dbb",
"b#efffgac......af.eeee#dbb",
"b#fefegaa......af.ecee#dbb",
"b#efefga.......af.eeee#dbb",
"b#eeeega.......af.ccec#dbb",
"b#efeefffffffffff.cece#dbb",
"b#feeea...........ccec#dbb",
"b#eegggggggggggggggfce#dbb",
"b#eegffffffffffffffacc#dbb",
"b#eegcccacaca...acf.cc#dbb",
"b#eefffffffffffffcc.cc#dbb",
"b#ee................cc#dbb",
"b#bbbbbbbbbbbbbbbbbbbb#dbb",
"b#bbbbbbbbbbbbbbbbbbbb#dbb",
"b#d####################d##",
"##########################",
"d#hhhhhhhhhhhhhhhhhhhhhhhh"
};

---------------------cut here--------------------------

Lokh.
--
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 [email-masked].
To report problems, send mail to [email-masked].

---

From: Andrew Veliath <[email-masked]>
Date: Fri, 31 May 1996 16:50:06 -0400

Patrice>   My request trashes the left 3d border drawing.  I've
    Patrice> included a small xpm to show the result, as my english
    Patrice> isn't very good :)

    Patrice>   As I really wanted this xpm to fit in the buttonbox, I
    Patrice> cropped it to 20x14 (the xpm was still larger than the
    Patrice> button), and everything worked perfectly.

    Patrice>   I don't know if it's a bug, or if I shouldn't display a
    Patrice> pixmap larger than a titlebar button, but if someone can
    Patrice> tell it to me :)

It shouldn't do this, I haven't updated that patch to the latest fixes
yet, but I will check it out and fix it if necessary.

Could you tell me what type of commands (if any) you have in your window style
and title style, of the type Flat or MWMButton?

Thanks

---

From: Andrew Veliath <[email-masked]>
Date: Fri, 31 May 1996 17:27:40 -0400

Patrice> 	I have a strange problem using the fvwm_button_pxp8.*
    Patrice> patch.  I use a pixmap in the 1st left button:
    Patrice> ButtonStyle 1 Pixmap xfoo.xpm

    Patrice> xfoo.xpm is 22x14 pixels and the button size is 19x18
    Patrice> pixels (without the 3d borders). So the pixmap is larger
    Patrice> than the button.

Thanks for this detailed report.  The problem is the result of a
subtle signed/unsigned addition gone awry.  I will post a new patch in
a few days, but here is a quick patch to pxp8 which I think should
alleviate the problem.

Sincerely,
Andrew

diff -cr fvwm-2.0.42.pxp8/fvwm/borders.c fvwm-2.0.42.pxp8a/fvwm/borders.c
*** fvwm-2.0.42.pxp8/fvwm/borders.c	Fri May 31 17:19:21 1996
--- fvwm-2.0.42.pxp8a/fvwm/borders.c	Fri May 31 17:21:33 1996
***************
*** 422,437 ****
  	x = border;
  	if (bf->style&HOffCenter) {
  	    if (bf->style&HRight)
! 		x += width - p->width;
  	} else
! 	    x += (width - p->width) / 2;
  
  	y = border;
  	if (bf->style&VOffCenter) {
  	    if (bf->style&VBottom)
! 		y += height - p->height;
  	} else
! 	    y += (height - p->height) / 2;
  
  	if (x < border) x = border;
  	if (y < border) y = border; 
--- 422,437 ----
  	x = border;
  	if (bf->style&HOffCenter) {
  	    if (bf->style&HRight)
! 		x += (int)(width - p->width);
  	} else
! 	    x += (int)(width - p->width) / 2;
  
  	y = border;
  	if (bf->style&VOffCenter) {
  	    if (bf->style&VBottom)
! 		y += (int)(height - p->height);
  	} else
! 	    y += (int)(height - p->height) / 2;
  
  	if (x < border) x = border;
  	if (y < border) y = border; 
--
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 [email-masked].
To report problems, send mail to [email-masked].