Subject: FVWM: mfvwm

From: Phil Stracchino <[email-masked]>
Date: Thu, 13 May 2004 17:23:25 -0400

Simple question:
Can a vector button have multiple vectors on it?  (I'd like to create a
vector button with multiple raised areas.)
If so, how?
If not, I guess I'll have to work around it with a long serpentine
polyline, or perhaps a bitmap.

-- 
 .*********  Fight Back!  It may not be just YOUR life at risk.  *********.
 : phil stracchino : unix ronin : renaissance man : mystic zen biker geek :
 :  [email-masked][email-masked][email-masked]  :
 :   2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)   :
 :    Linux Now!   ...Because friends don't let friends use Microsoft.    :
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
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: Dan Espen <[email-masked]>
Date: Thu, 13 May 2004 17:36:01 -0400

> polyline, or perhaps a bitmap.

Have you been here:

http://www.fvwm.org/screenshots/windowdecors/

-- 
Dan Espen                           E-mail: [email-masked]

---

From: Phil Stracchino <[email-masked]>
Date: Thu, 13 May 2004 21:25:29 -0400

> http://www.fvwm.org/screenshots/windowdecors/

I have.  It doesn't answer my question.

In the meantime, I've been playing around and have learned a few things.
It seemed at first as though I could have no more than 16 points, but
this appears not to be the case, as I've now successfully created a
vector button with 45 points.  I have figured out the following:

  - A button without a function assigned to it will not be drawn, even
    if assigned a style.
  - A button can only have a single vector chain.  This isn't
    necessarily a problem, because vector segments can be made
    effectively invisible.
  - An error in the point list may cause the button not to be drawn, or
    may cause it to be drawn using a different ButtonStyle, depending
    on the nature of the error.  The error may or may not be logged in
    .xsession-errors, and if logged, the message may or may not tell you
    anything useful about what the actual error was.
  - I don't know if there's an upper limit to the number of points, but
    if so, it's at least 45.
  - Although vector coordinates are on a scale of 1..100 (increments of
    1%), the useful resolution is closer to increments of 5%, unless you
    have really friggin' HUGE buttons.

Anyway, after playing with this for a while, I've got two titlebar
buttons and two sets of functions for sending windows to a specified
page or a specified desk.  The COMPLETE code, with vector buttons and
window menu entries, follows.  Note that I've now made the placement of
the button panels smarter, as necessitated for titlebar button use; the
old version of SendWindowToPage, if used on a titlebar button, would
often appear partly offscreen.  This version fixes that.

Anyway, here's the code, and the attached PNG shows the appearance of
the new buttons.

##### Button panels
DestroyModuleConfig PageButtonGrid
*PageButtonGrid: columns 4
*PageButtonGrid: rows 4
*PageButtonGrid: (Title "0",  Action "MoveLastWindowToPage 0 0")
*PageButtonGrid: (Title "1",  Action "MoveLastWindowToPage 1 0")
*PageButtonGrid: (Title "2",  Action "MoveLastWindowToPage 2 0")
*PageButtonGrid: (Title "3",  Action "MoveLastWindowToPage 3 0")
*PageButtonGrid: (Title "4",  Action "MoveLastWindowToPage 0 1")
*PageButtonGrid: (Title "5",  Action "MoveLastWindowToPage 1 1")
*PageButtonGrid: (Title "6",  Action "MoveLastWindowToPage 2 1")
*PageButtonGrid: (Title "7",  Action "MoveLastWindowToPage 3 1")
*PageButtonGrid: (Title "8",  Action "MoveLastWindowToPage 0 2")
*PageButtonGrid: (Title "9",  Action "MoveLastWindowToPage 1 2")
*PageButtonGrid: (Title "10", Action "MoveLastWindowToPage 2 2")
*PageButtonGrid: (Title "11", Action "MoveLastWindowToPage 3 2")
*PageButtonGrid: (Title "12", Action "MoveLastWindowToPage 0 3")
*PageButtonGrid: (Title "13", Action "MoveLastWindowToPage 1 3")
*PageButtonGrid: (Title "14", Action "MoveLastWindowToPage 2 3")
*PageButtonGrid: (Title "15", Action "MoveLastWindowToPage 3 3")

DestroyModuleConfig DeskButtonGrid
*DeskButtonGrid: columns 4
*DeskButtonGrid: rows 1
*DeskButtonGrid: (Title "0",  Action "MoveLastWindowToDesk 0")
*DeskButtonGrid: (Title "1",  Action "MoveLastWindowToDesk 1")
*DeskButtonGrid: (Title "2",  Action "MoveLastWindowToDesk 2")
*DeskButtonGrid: (Title "3",  Action "MoveLastWindowToDesk 3")

##### Window movement functions
DestroyFunc .
AddToFunc .
+		I	SendToModule FvwmPerl preprocess -c -- $*

DestroyFunc SendWindowToPage
AddToFunc SendWindowToPage
+		I	SetEnv LAST_WIN_ID $[w.id]
+		I	. FvwmButtons \
                        -g 144x96+%{ \
					($[pointer.x]-$[page.nx]*36) < 35 \
					? 1 \
					: $[pointer.x]-$[page.nx]*36-34 \
				}%+%{ \
					($[pointer.y]-$[page.ny]*24)<21 \
					? 1 \
					: $[pointer.y]-$[page.ny]*24-20 \
				}% -transient PageButtonGrid

DestroyFunc SendWindowToDesk
AddToFunc SendWindowToDesk
+		I	SetEnv LAST_WIN_ID $[w.id]
+		I	. FvwmButtons \
                        -g 144x24+%{ \
					($[pointer.x]-$[desk.n]*36) < 35 \
					? 1 \
					: $[pointer.x]-$[desk.n]*36-34 \
				}%+%{ \
					$[pointer.y]-20 \
				}% -transient DeskButtonGrid

DestroyFunc MoveLastWindowToPage
AddToFunc MoveLastWindowToPage
+		I	WindowId $[LAST_WIN_ID] MoveToPage $0 $1

DestroyFunc MoveLastWindowToDesk
AddToFunc MoveLastWindowToDesk
+		I	WindowId $[LAST_WIN_ID] MoveToDesk 0 $0

##### Buttons

# Send-to-page button
ButtonStyle 3 Vector 45 10x10@2 10x30@2 30x30@0 30x10@0 10x10@1 \
                        40x10@2 40x30@2 60x30@0 60x10@0 40x10@1 \
                        70x10@2 70x30@2 90x30@0 90x10@0 70x10@1 \
                        10x40@2 10x60@2 30x60@0 30x40@0 10x40@1 \
                        40x40@2 40x60@2 60x60@0 60x40@0 40x40@1 \
                        70x40@2 70x60@2 90x60@0 90x40@0 70x40@1 \
                        10x70@2 10x90@2 30x90@0 30x70@0 10x70@1 \
                        40x70@2 40x90@2 60x90@0 60x70@0 40x70@1 \
                        70x70@2 70x90@2 90x90@0 90x70@0 70x70@1 \
                        -- Raised
Style * Button 3
Mouse 1 3 A SendWindowToPage

# Send-to-desk button
ButtonStyle 5 Vector 15 30x65@2 30x75@2 90x75@0 90x40@0 80x40@1 \
                        20x55@2 20x65@2 80x65@0 80x25@0 70x25@1 \
                        10x10@2 10x50@2 70x50@0 70x10@0 10x10@1 \
                        -- Raised
Style * Button 5
Mouse 1 5 A SendWindowToDesk

##### Menu additions:
AddToMenu Window-Ops	"Window Ops"		Title		
...
+			"(Un)Maximize"		Maximize
+			""			Nop
+			"Send to &Page..."	SendWindowToPage
+			"Send to D&esk..."	SendWindowToDesk
+			"Delete"		Delete
...

AddToMenu Window-Ops2	"&Move"			Move
...
+                       "(Un)Ma&ximize" 	Maximize
+			""			Nop
+			"Send to &Page..."	SendWindowToPage
+			"Send to D&esk..."	SendWindowToDesk
+			"&Delete"		Delete
...

---

From: Mikhael Goikhman <[email-masked]>
Date: Fri, 14 May 2004 02:03:20 +0000

> I have.  It doesn't answer my question.

Well, configs of some samples do answer your question. AFAIR.

> vector button with 45 points.

The number of points was increased in 2.5.x two years ago. This is why
specifying fvwm version is always important.

> I have figured out the following:
> 

I think this is in FAQ.

>     necessarily a problem, because vector segments can be made

No, you may apply multiple AddButtonStyle as needed.

>     anything useful about what the actual error was.

Well, you don't draw buttons very often to justify a complete syntax
error diagnostics system, do you? :)

>   - I don't know if there's an upper limit to the number of points, but

It is 10000.

>     have really friggin' HUGE buttons.

This is possibly because you use 3-d like relief that is 2 pixels wide.
If you use flat decorations, then entire 100% is available. I think.

> Anyway, here's the code, and the attached PNG shows the appearance of

No time to read/play with this config for now. Maybe later.
Or you may just post a screenshot url.

Regards,
Mikhael.

---

From: Phil Stracchino <[email-masked]>
Date: Fri, 14 May 2004 00:01:38 -0400

> Well, configs of some samples do answer your question. AFAIR.

OK, let me rephrase that:  "I did not see any button configs in those
button samples that answered the questions I had."

> specifying fvwm version is always important.

Out of curiosity, what was the old limit?

> No, you may apply multiple AddButtonStyle as needed.

OK, none of the examples illustrates this, and it's not apparent from
the documentation (unless I missed something, which is entirely
possible).

> error diagnostics system, do you? :)

Very true.  :)  I guess my point was, "If one of these things happens,
it probably means you have a subtle error in your point list.  Look at it
more carefully, but don't necessarily expect to be able to figure it out
from the .xsession-errors output."

Hmmmm......   I find myself pondering a vector-button-drawing tool that
lets you draw a button, then outputs the vector list to generate it.
I'll give it some thought.

> If you use flat decorations, then entire 100% is available. I think.

I think it's more that the buttons just plain *aren't very big* if your
titlebar font is a reasonable size.  There's only just so many pixels
available.  No matter what you do, you can't get 100 points of physical
resolution across a button that's only 20 pixels wide.

> Or you may just post a screenshot url.

Well, that's what the PNG was -- a partial window screenshot showing the
left side of the titlebar.

(Oh, and I meant to elide repetitive rows in the PageButtonGrid
definition ....  sorry about that.)

---

From: Nicholas Paul Johnson <[email-masked]>
Date: Fri, 14 May 2004 02:12:57 -0400 (EDT)

> vector button with 45 points.  I have figured out the following:
Technically speaking, each point is a vector.  Thus, yes, you can have 
multiple vectors.  Am I misunderstanding you use of vector?
 
>                         70x70@2 70x90@2 90x90@0 90x70@0 70x70@1 \
This appears to be 5x9-1==45-1==44 vectors.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  Nicholas Paul Johnson
  o nickjohnson \at\ virginia \dot\ edu
  o 3ebf10a7 subkeys.pgp.net
  o http://manjac.ath.cx/nick
  o "When all you've got is a hammer,
    everything looks like a nail.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

---

From: Phil Stracchino <[email-masked]>
Date: Fri, 14 May 2004 02:33:03 -0400

> multiple vectors.  Am I misunderstanding you use of vector?

Well, partly this is lack of clarity on my part, and partly, no, a point
is not a vector.  A point is a point.  I was trying to use the term
'vector chain' to refer to a single figure, if you will, or connected
series of figures, drawn on the button by vector means.  I should
probably more correctly have used the term polyline (and in fact,
Polyline would be a more accurate term for fvwm to use than Vector). 
The style below, with 45 points, properly contains 44 vectors forming a
single polyline.

What I was trying to ask was whether I could have a button on which two
separate polylines were drawn, since at the time I was under the
impression that a polyline in a Vector style specification could not
include more than 16 points.  In that case, if one wanted a button
design containing more than 16 points, it would be necessary to use
multiple vector chain specifications.

Mikhael (I think) subsequently pointed out that multiple styles can be
added to a button using AddButtonStyle.  However, since button style
polylines in fvwm-2.5 can contain up to 10000 points, I don't anticipate
ever needing to do so, as that's sufficient points to draw a line in
each possible vector color from every pixel on the button to every other
pixel on the button.  :)

> This appears to be 5x9-1==45-1==44 vectors.

Correct, in a single polyline.

---

From: Tavis Ormandy <[email-masked]>
Date: Fri, 14 May 2004 10:43:06 +0100

>     necessarily a problem, because vector segments can be made

I have several chains per button in my configuration, one draws the emblem,
another draws a shadow for it and another draws a border.

for example:

AddButtonStyle  8 Active Vector 9 40x40@2 45x35@2 55x35@2 60x40@2 60x45@2
50x50@2 50x55@2 50x65@4 50x65@2 -- Flat
AddButtonStyle  8 InActive Vector 9 40x40@3 45x35@3 55x35@3 60x40@3 60x45@3
50x50@3 50x55@3 50x65@4 50x65@3 -- Flat
AddButtonStyle  8 AllUp Vector 7 40x45@1 45x40@1 55x40@1 60x50@4 50x60@1
50x75@4 50x75@1 -- Flat
AddButtonStyle  All Active Vector 9 80x60@4 80x40@2 60x20@2 40x20@2 20x40@2
20x60@2 40x80@2 60x80@2 80x60@2 -- Flat
AddButtonStyle  All Inactive Vector 9 80x60@4 80x40@2 60x20@2 40x20@2
20x40@2 20x60@2 40x80@2 60x80@2 80x60@2 -- Flat

(This is supposed to be a Question mark :)

my fvwm2rc is here if you would like to see it in context,
http://dev.gentoo.org/~taviso/fvwm2rc.html

-- 
-------------------------------------
[email-masked] | finger me for my gpg key.
-------------------------------------------------------

---

From: Mikhael Goikhman <[email-masked]>
Date: Fri, 14 May 2004 11:53:13 +0000

On 14 May 2004 00:01:38 -0400, Phil Stracchino wrote:
> > The number of points was increased in 2.5.x two years ago.
> 

32.

> the documentation (unless I missed something, which is entirely

Last 2 samples on the web use AddButtonStyle (it is not really needed in
the last sample, I think).

> I'll give it some thought.

Did you see the script posted a day ago that enables drawing using xfig?

> left side of the titlebar.

Looks good. Although I don't like "bg" colors that have corresponding "hi"
color that is actually darker. I like light (even if white) "hi" colors.
But this is much less annoying than meaningless subject lines in threads.

Regards,
Mikhael.

---

From: Phil Stracchino <[email-masked]>
Date: Fri, 14 May 2004 13:58:37 -0400

> the last sample, I think).

Sorry, I must have missed it.

> Did you see the script posted a day ago that enables drawing using xfig?

No, I don't think I did.  I'll have to scan back and look for it.

> color that is actually darker. I like light (even if white) "hi" colors.

*shrug*  it makes my window decorations look the way I want them to.

> But this is much less annoying than meaningless subject lines in threads.

Sorry about that...  I typo'd in my mailer, meant to correct it before I
sent, then forgot to do so because it was so long between starting the
message and actually sending it (about 4 hours).

---

From: Dan Espen <[email-masked]>
Date: Fri, 14 May 2004 14:14:44 -0400

> No, I don't think I did.  I'll have to scan back and look for it.

Look closely at the fvwm web page for window decorations.
There is a link to the tool there.

---

From: Marcus Lundblad <[email-masked]>
Date: Sat, 15 May 2004 14:19:48 +0200 (CEST)

> polyline, or perhaps a bitmap.

You can use the syntax like:

50+1px

to get a point at 50% plus 1 pixel.
So you would draw each line 2 times with +/- 1 pixel on either X or Y
direction.

Look at the man-page and examples on the homepage.

//Marcus