Subject: FVWM: Turn on title on WindowShade

From: Frank Gruellich <[email-masked]>
Date: Fri, 5 Nov 2004 01:38:29 +0100

Hello,

I use this to shade my windows with mouse wheel:
,-----
|Mouse 4 FISW N WindowShade True
|Mouse 5 FISW N WindowShade False
'-----
Mouse 4 works pretty fine, but as I have:
,-----
|Style * NoTitle, NoHandles, BorderWidth 1
'-----
it's kinda hard to get pointer in context FISW to unshade with Mouse 5
(in fact I am thinking about BorderWidth 0, which will make me real
trouble).

Is there another way to enlarge a window while shaded?  Can I add a
border for this state only?  Or can I set 'Title' for shade windows
only?  And: is there anything fvwm can't do?

Thanks in advance,
 regards, Frank.
-- 
Sigmentation fault
--
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: Scott Smedley <[email-masked]>
Date: Fri, 5 Nov 2004 13:43:11 +1100

Hi Frank,

> only?

How about something like:

AddToFunc MyWinShade
+ I ThisWindow WindowStyle Title
+ I ThisWindow WindowShade True
AddToFunc MyWinShadeOff
+ I ThisWindow WindowStyle NoTitle
+ I ThisWindow WindowShade False
Key G A M MyWinShade
Key H A M MyWinShadeOff

Now Alt-G will shade the window & add a title, & Alt-H will unshade the
window & remove the title.

Of course, you can bind to mouse buttons instead of keys.

> And: is there anything fvwm can't do?

Usually not when Dominik is around. :)

SCoTT. :)

---

From: Frank Gruellich <[email-masked]>
Date: Fri, 5 Nov 2004 11:58:04 +0100

Hello,

> > Or can I set 'Title' for shade windows only?
> AddToFunc MyWinShade

Thank you very much, I missed the WindowStyle.  With this and the stuff
from the last night I have this:
,-----
|DestroyFunc ToggleShade
|AddToFunc ToggleShade
|+ I ThisWindow (Shaded) WindowStyle NoTitle
|+ I ThisWindow (Shaded) WindowShade false
|+ I TestRc (1) Break
|+ I ThisWindow (!Shaded) WindowStyle Title
|+ I ThisWindow (!Shaded) WindowShade $0
'-----
and bind it to
,-----
|Key h TFISW CS Current ToggleShade West
|Key j TFISW CS Current ToggleShade South
|Key k TFISW CS Current ToggleShade North
|Key l TFISW CS Current ToggleShade East
'-----

This works (BTW: I could use something like 'TitleSide North'), but
looks kinda strange: when shading, first the window is shaded and then
the title is added (fine); when unshading, first the window is unshaded
and then the title is removed.  Both seem to happen in the wrong order,
don't they?  (It doesn't matter much, but some as it resizes the windows
content a bit this messes up some applications, that doesn't like this,
eg. my vim in GNU screen in xterm.)

Anyway, because this doesn't help very much for 'ToggleShade West' I
replaced 'NoTitle' with 'BorderWidth 1' and 'Title' with 'BorderWidth
8'.  This way another strange effect occurs (beside the wrong order):
then shading to North or East the top right corner (the border, not the
window content) of shaded and unshaded window stay the same place at
screen, which make the lower or left border, respectively, jump around
in a strange way; then shading West/South the right/top border of the
shaded window jump to the position of the left/bottom border of the
unshaded window.  Both goes for unshading, too.  Look at it then
unshading with WindowShadeSteps 25, the window content will jump around.

(Now I do a very bold assumption: this behavior is not configurable.)

I would appreciate something like this: preserve the position of window
content in all circumstances (Of course not in the direction of shade:
left/right for North/South and top/bottom for West/East.) and add the
window borders to the exterior.

> Usually not when Dominik is around. :)

I know.  Dominik?  If this is not configurable, I would appreciate some
hints to the code and see, what I can do.

Thanks in advance,
 regards, Frank.

---

From: Mikhael Goikhman <[email-masked]>
Date: Fri, 5 Nov 2004 11:32:29 +0000

> eg. my vim in GNU screen in xterm.)

Please indent the commands with 2 spaces, to simplify copy-paste.

Try this function definition instead:

  DestroyFunc ToggleShade 
  AddToFunc ToggleShade 
  + I ThisWindow (Shaded) WindowStyle NoTitle 
  + I ThisWindow (Shaded) UpdateStyles
  + I ThisWindow (Shaded) WindowShade false
  + I TestRc (1) Break
  + I WindowShade $0
  + I WindowStyle Title

> window borders to the exterior.

I am not sure I understand all you mean, but in order to get titles at
the left/right too, try this config:

  Key h TFISW CS Current ToggleShade Left
  Key j TFISW CS Current ToggleShade Bottom
  Key k TFISW CS Current ToggleShade Top
  Key l TFISW CS Current ToggleShade Right

  DestroyFunc ToggleShade
  AddToFunc   ToggleShade
  + I ThisWindow (Shaded) WindowStyle !Title
  + I ThisWindow (Shaded) UpdateStyles
  + I ThisWindow (Shaded) WindowShade false
  + I TestRc (1) Break
  + I WindowStyle TitleAt$0
  + I UpdateStyles
  + I WindowShade
  + I WindowStyle Title

Regards,
Mikhael.

---

From: Frank Gruellich <[email-masked]>
Date: Sat, 6 Nov 2004 14:32:53 +0100

>   + I ThisWindow (Shaded) WindowShade false

Thank you, I missed the UpdateStyles.

> I am not sure I understand all you mean,

The described problem seems to be more complex I thought (and has
nothing to do with the original subject).  By default a windows origin
(shaded or unshaded) used when moving, positioning etc. is the most
topleft corner of the window.  From my (very special) point of view it
would be more logical to position the topleft corner of the windows
content.  Now I have a switch somewhere in my config changing this
default to something I don't understand.  I will search for this, maybe
ask and describe the problem again.

> but in order to get titles at the left/right too, try this config:

Well, I am going to shade to any direction, the title is just a mean to
enlarge windows (viagra vor X) to catch shaded ones and unshade them, in
fact I don't need it.  Important is, that I am able to shade windows in
all direction: North, South, East, West.

>   + I WindowStyle TitleAt$0

Uh, I can concatenate commands from parameters?  Nice!  But WindowShade
without direction will only shade to a default direction (North,
AFAICS), won't it?  I could do something like

  Key h TFISW CS Current ToggleShade Left East
  # etc.

  DestroyFunc ToggleShade
  AddToFunc   ToggleShade
  + I WindowShade $1
  + I WindowStyle Title

which seems a bit inelegant to me, but should work.

BTW: what's the difference of Current and ThisWindow?

Thanks again,
 regards, Frank.

---

From: Mikhael Goikhman <[email-masked]>
Date: Sat, 6 Nov 2004 18:05:33 +0000

On 06 Nov 2004 14:32:53 +0100, Frank Gruellich wrote:
> AFAICS), won't it?

Yes and no. The default direction is the title direction and you change
it in TitleAt<Something> command, so WindowShade does not need any param.

> I could do something like
> 

To make it elegant, remove the second param from ToggleShade function and
do "WindowShade $0".  "Left" is an alias for "East", so it will work too.
Or like in my sample, just do "WindowShade".  You may remove "false" too.

> BTW: what's the difference of Current and ThisWindow?

Well, I copied your config, but you may freely remove the Current word.

Key already makes the focused window to be the context window. And for
example PointerKey or Mouse make the window under the pointer to be the
context window. ThisWindow works on the context window.

If you need to check some window condition in a function, ThisWindow is
usually a more correct and safe way. Unless you really need to work on
the focused window regardless of the context window, then do "Current".

Regards,
Mikhael.