Re: FVWM: mfvwm

From: Phil Stracchino <alaric_at_caerllewys.net>
Date: Thu, 13 May 2004 21:25:29 -0400

On Thu, May 13, 2004 at 05:36:01PM -0400, Dan Espen wrote:
> Phil Stracchino <alaric_at_caerllewys.net> writes:
> > 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.
>
> Have you been here:
>
> 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_at_2 10x30_at_2 30x30_at_0 30x10_at_0 10x10_at_1 \
                        40x10_at_2 40x30_at_2 60x30_at_0 60x10_at_0 40x10_at_1 \
                        70x10_at_2 70x30_at_2 90x30_at_0 90x10_at_0 70x10_at_1 \
                        10x40_at_2 10x60_at_2 30x60_at_0 30x40_at_0 10x40_at_1 \
                        40x40_at_2 40x60_at_2 60x60_at_0 60x40_at_0 40x40_at_1 \
                        70x40_at_2 70x60_at_2 90x60_at_0 90x40_at_0 70x40_at_1 \
                        10x70_at_2 10x90_at_2 30x90_at_0 30x70_at_0 10x70_at_1 \
                        40x70_at_2 40x90_at_2 60x90_at_0 60x70_at_0 40x70_at_1 \
                        70x70_at_2 70x90_at_2 90x90_at_0 90x70_at_0 70x70_at_1 \
                        -- Raised
Style * Button 3
Mouse 1 3 A SendWindowToPage

# Send-to-desk button
ButtonStyle 5 Vector 15 30x65_at_2 30x75_at_2 90x75_at_0 90x40_at_0 80x40_at_1 \
                        20x55_at_2 20x65_at_2 80x65_at_0 80x25_at_0 70x25_at_1 \
                        10x10_at_2 10x50_at_2 70x50_at_0 70x10_at_0 10x10_at_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
...




-- 
 .*********  Fight Back!  It may not be just YOUR life at risk.  *********.
 : phil stracchino : unix ronin : renaissance man : mystic zen biker geek :
 :  alaric_at_caerllewys.net|phil-stracchino_at_earthlink.net|phil_at_novylen.net  :
 :   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 majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.

newbuttons.png
(image/png attachment: newbuttons.png)

Received on Thu May 13 2004 - 20:28:37 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:56 BST