Subject: FVWM: Alternative menu positions

From: Marcus Lundblad <[email-masked]>
Date: Thu, 25 Jul 2002 12:41:55 +0200 (CEST)

When using the Menu and Popup commands it's possible to specify a position
for the menu.
I was wondering if its possible to get an alternative position if the
first one isn't possible.
For exaplle , I have a menu for icons that normally pops up above the
icon, this is good, because normally my icons reside at the bottom of the
scrren. But sxometimes I put icons at the top (for various reasons). In
this case there is no room for the menu all above the icon, so the menu
pops up over the icon (as far up as possible). What I would like in this
case is to have a "fall back" so in case the intended position doesn't
"work" I coud get a menu to display below the icon.
Is this possible?

//Marcus

--
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: Dominik Vogt <[email-masked]>
Date: Thu, 25 Jul 2002 13:33:51 +0200

> "work" I coud get a menu to display below the icon.

You can write a shell script and use it with PipeRead:

  Mouse 1 I N PipeRead "my_iconmenu.sh WindowMenu $[i.x] $[i.y] $[i.width] $[i.height]"

--------------------------- my_iconmenu.sh -----------------------
if [[ $3 -lt 500 ]]; then
  echo Menu $1 rectangle "$4"x"$5"+"$2"+"$3" c +100
else
  echo Menu $1 rectangle "$4"x"$5"+"$2"+"$3" c -100m
fi
------------------------------------------------------------------

You may wonder why the "icon" context rectangle doesn't work.  I'm
not sure yet, but it looks like a bug.

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, mail: [email-masked], phone: 0721/91374-382
Schlund + Partner AG, Erbprinzenstr. 4-12, D-76133 Karlsruhe
--
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: Marcus Lundblad <[email-masked]>
Date: Thu, 25 Jul 2002 14:49:17 +0200 (CEST)

>   echo Menu $1 rectangle "$4"x"$5"+"$2"+"$3" c -100m

OK, thanks!
> not sure yet, but it looks like a bug.

Hmm, I actually use the icon cntext, like: icon 0 -100 (I'm not sure
exactly, as I'm visiting my parents and am forced to use Windows *shudder*
and a 56 kbit modem (so therefore there is some spelling errors, because
it lags so much in pine :-()

And as far as I can tell the icon contex works as I expect it (maybe
luck...)

Bye

---

From: Mikhael Goikhman <[email-masked]>
Date: Thu, 25 Jul 2002 13:07:34 +0000

> And as far as I can tell the icon contex works as I expect it (maybe

"Context" context works directly, but not using PipeRead or SendToModule.
It is fixed by Dominik as I write this message.

You may rewrite this without additional files (start FvwmPerl somewhere):

Mouse 1 I A SendToModule FvwmPerl eval command( \
        "Menu WindowMenu rectangle $[i.width]x$[i.height]+$[i.x]x+$[i.y] c " \
        . ($[i.y] > 500? "-100m-4p": "+100+4p")

One problem with SendToModule (but not with PipeRead) is that the menu
commands are invoked without any window context. Currently it is possible
to write "WindowId $w" before "Menu" to work around it.

Regards,
Mikhael.

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 25 Jul 2002 15:16:47 +0200

> It is fixed by Dominik as I write this message.

This depended on the icon layout:

  Only a pixmap: worked fine
  Pixmap+Title:  only pixmap was taken into account
  Only title:    the pointer position was used instead

With the fix, the whole icon geometry is taken into account.

Bye

Dominik ^_^  ^_^

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 25 Jul 2002 15:13:49 +0200

>   echo Menu $1 rectangle "$4"x"$5"+"$2"+"$3" c -100m

Or with the now fixed code in the 2.5 branch:

  Mouse 1 I N PipeRead "my_iconmenu.sh WindowMenu $[i.y] $[vp.height]"

--------------------------- my_iconmenu.sh -----------------------
#!/bin/sh

if [ $[$2 + $2] -lt $3 ]; then
  echo Menu $1 icon c +100
else
  echo Menu $1 icon c -100m
fi
------------------------------------------------------------------

Bye

Dominik ^_^  ^_^