Re: FVWM: Problems with special application mapppings

2019-03-21 Thread Dan Espen
Klaus Ethgen  writes:

> Hi,
>
> Am Do den 21. Mär 2019 um 21:53 schrieb Jaimos Skriletz:
>> On Thu, Mar 21, 2019 at 2:40 PM Klaus Ethgen  wrote:
...
>> From the man page:
>> 
>> A '--' action indicates that the event should be propagated to
>> the specified window to handle.  This is only a valid action for
>> window-specific bindings.

As far as I can tell, that reference to '--' in the man page
is an error, there is no such option.
I'm having trouble understanding the second sentence so I can't be sure
if '--' is a typo for '-'.

I checked the source, fvwm/bindings.c.
Unless it's very well hidden, it doesn't parse anything like '--'.
The closest it gets is:

if (
action == NULL || *action == 0 ||
(action[0] == '-' && !is_pass_through))
{
is_unbind_request = True;
}

Basically, it sees the first character of the next action
and turns on is_unbind_request.  So, if the arg was
'--' it would still do the unbind.


-- 
Dan Espen



Re: FVWM: Problems with special application mapppings

2019-03-21 Thread Jaimos Skriletz
On Thu, Mar 21, 2019 at 3:21 PM Klaus Ethgen  wrote:
> But why dows it work when I do `Key (mpv) Up A M -` direct afterwards
> (but not in the config file)?
>

What do you mean by work? I am not able to get it to work as you want
with my tests.

> > Key Up  A   M   Scroll +0   -10
> > Key (mpv) Up A   M--
>
> I tried that too but it does not work.
>

My tests also shows this doesn't work as expected. I'm not quite sure
what is going on then. When I run

PrintInfo Bindings

I do not see a binding show up when I use the -- option (unsure why
this is not showing up). So unsure if the -- binding is not being
listed
correctly or not. It could be I'm overlooking something with the pass
through option

I do know that this really isn't the best way to do things, in general
most applications will not like this. From the man page

Note that Fvwm actually intercepts all events for a
window-specific binding and (if the focused window doesn't match
any of the bindings) sends a synthetic copy of the event to the
window.  This should be transparent to most applications,
however (for security reasons) some programs ignore these
synthetic events.

Really most programs ignore these synthetic events (see FakeKeyPress)
so I would think of another way to achieve your goal. Though if mpv
accepts synthetic events, you could try FakeKeyPress over a pass
through --, and see if that works for you.

My suggestion is find another way to achieve your goal. Some suggestions:

*) Use a modifier on Up/Down that isn't also used by MPV for your bindings.
*) Write a function and bind it to a binding that enables/disables
these scroll bindings. Not ideal, but this way you could disable the
bindings when you wanted to use Meta-Up inside of mpv. You could even
use Schedule to make it so the bindings will automatically enable them
selves after a set period of time.

jaimos



Re: FVWM: Problems with special application mapppings

2019-03-21 Thread Klaus Ethgen
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Hi,

Am Do den 21. Mär 2019 um 21:53 schrieb Jaimos Skriletz:
> On Thu, Mar 21, 2019 at 2:40 PM Klaus Ethgen  wrote:
> > - From the documentation, the following mapping:
> >Key Up  A   M   Scroll +0   -10
> >Key (mpv) Up A M -
> >
> > Should bind alt-Up to the Scroll except in mpv window. But it also
> > scrolls in mpv windown.
> >
> 
> In the second command 'Key (mpv) Up A M -', the - removes the
> keybinding. Since there is no specific key binding for mpv it uses
> your global keybinding. From the documentation:

Ok, that sounds reasonable.

> > So I tried `Key (mpv) Up A M Echo Up` which worked and echos the Up.
> 
> Yes this will work, because now you have a window specific binding
> that fvwm uses.

But why dows it work when I do `Key (mpv) Up A M -` direct afterwards
(but not in the config file)?

> > - - How to do a mapping for everything except in mpv window?
> > - - What is the difference between `-` and `--` in this context?
> 
> From the man page:
> 
> A '--' action indicates that the event should be propagated to
> the specified window to handle.  This is only a valid action for
> window-specific bindings.
> 
> So in conclusion, when using window specific bindings and you want to
> propagate the press to the window you want to use '--', not '-' (which
> tells fvwm to remove the binding).
> 
> Thus I think you should be able to get this to work if you change your
> bindings to
> 
> Key Up  A   M   Scroll +0   -10
> Key (mpv) Up A   M--

I tried that too but it does not work.

Yes, I read about the application to accept the pass through. But with
exact that setting, it does scroll inside the window too; so I don't
think that any event for the application is generated at all.

Regards
   Klaus
- -- 
Klaus Ethgen   http://www.ethgen.ch/
pub  4096R/4E20AF1C 2011-05-16Klaus Ethgen 
Fingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C
-BEGIN PGP SIGNATURE-
Comment: Charset: ISO-8859-1

iQGzBAEBCgAdFiEEMWF28vh4/UMJJLQEpnwKsYAZ9qwFAlyUACkACgkQpnwKsYAZ
9qwK6wv/bkVILcJg1nNgJcglI+hGHQRfqzWkq58psuUayCwtA3UpVkj6jz/ncxIi
ey8fOhX/bL+cHEnKy5YucrBpkOHcPlAK+7+f0wWBCoYyJI60IsXv9O+6K7JxMZxQ
IO2RXUPHVgBMz3EG/vDBodCuAChXJ3INeDV+H46I2qzwJtle+1Ekj290FXACo+uO
wdtfTGQO7UgRTe72Zdif6d34UntU5zSKzVuRq64EHraN9t7hyVRC5o4pZ/etcpC0
jLnjBV4aEALsXJ7WeMbZWUaY66EfgYaUxvJYPTwk++DtjzUOdsJvnrbF9OHPCF2L
r5x6jYjMrjfTQJQV8VXk+N15CddvP/5xOP1Wz84ysYf8OWR0WgSK5kgDdK8yrRsT
ZMeTaotiZgCIpdnKUkn9RWcwsGrlB2FHaP3+NmPwm27iYyapdQenwLbXDzXKaaKQ
S+9hDpVyL+WA+Ofw5SEepdPsjSoMCJImsFewUVwCjHBuoaDkmSnM+BR1/VRsOS/b
9RH6Plo2
=9Lv0
-END PGP SIGNATURE-



Re: FVWM: Problems with special application mapppings

2019-03-21 Thread Jaimos Skriletz
On Thu, Mar 21, 2019 at 2:40 PM Klaus Ethgen  wrote:
> - From the documentation, the following mapping:
>Key Up  A   M   Scroll +0   -10
>Key (mpv) Up A M -
>
> Should bind alt-Up to the Scroll except in mpv window. But it also
> scrolls in mpv windown.
>

In the second command 'Key (mpv) Up A M -', the - removes the
keybinding. Since there is no specific key binding for mpv it uses
your global keybinding. From the documentation:

Key [(window)] Keyname Context Modifiers Function
Binds a keyboard key to a specified fvwm command, or removes the
binding if Function is '-'.

> When I do the scroll mapping as above but from command line I do
> `FvwmCommand 'Key (mpv) Up A M -'`, it does not work.
>

It does work, just not as you expected.

> So I tried `Key (mpv) Up A M Echo Up` which worked and echos the Up.

Yes this will work, because now you have a window specific binding
that fvwm uses.

> - - Is that a known bug?

No.

> - - How to do a mapping for everything except in mpv window?
> - - What is the difference between `-` and `--` in this context?

>From the man page:

A '--' action indicates that the event should be propagated to
the specified window to handle.  This is only a valid action for
window-specific bindings.

So in conclusion, when using window specific bindings and you want to
propagate the press to the window you want to use '--', not '-' (which
tells fvwm to remove the binding).

Thus I think you should be able to get this to work if you change your
bindings to

Key Up  A   M   Scroll +0   -10
Key (mpv) Up A   M--

jaimos



FVWM: Problems with special application mapppings

2019-03-21 Thread Klaus Ethgen
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Hi folks,

I use version 2.6.8 in debian.

- From the documentation, the following mapping:
   Key Up  A   M   Scroll +0   -10
   Key (mpv) Up A M -

Should bind alt-Up to the Scroll except in mpv window. But it also
scrolls in mpv windown.

So I played a bit around.

When I do the scroll mapping as above but from command line I do
`FvwmCommand 'Key (mpv) Up A M -'`, it does not work.

So I tried `Key (mpv) Up A M Echo Up` which worked and echos the Up.
When I do `Key (mpv) Up A M -` afterwards via FvwmCommand, it does as
expected and mpv get the Up key press.

This works reliable so I decided to put that exact sequence in config
file:
   Key Up  A   M   Scroll +0   -10
   Key (mpv) Up A M Echo Up
   Key (mpv) Up A M -

But then it does not work and only the scroll mapping is done.

So:
- - Is that a known bug?
- - How to do a mapping for everything except in mpv window?
- - What is the difference between `-` and `--` in this context?

Regards
   Klaus
- -- 
Klaus Ethgen   http://www.ethgen.ch/
pub  4096R/4E20AF1C 2011-05-16Klaus Ethgen 
Fingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C
-BEGIN PGP SIGNATURE-
Comment: Charset: ISO-8859-1

iQGzBAEBCgAdFiEEMWF28vh4/UMJJLQEpnwKsYAZ9qwFAlyT9oEACgkQpnwKsYAZ
9qynmAv9HC9a+4BZlXg3pmwe3SZck/36KOTwGhbyvZZYV6NRDJY/uAulfDI1YCgN
tHVGlwDrEzgkvc2bouAbaxXEBy2VrvCAqoD2K2dH64GYY3SaDUfvwCzYVJd16fGl
82dJt4l3VvoK8mR2NfBnDDZSlxAhkaDD0sjwl0aXUqO1UFiobL9e8PnvTdLS1one
275BQ+lHkvMcWrKwUGe4/aIb+x0MJz70lDZD017CbZSr4gLaYYyQqcF/Z4IcffXI
u1TsBVUxecKTW52O4RLD8xPSFXNKGu/t8vHIF/K32WfN26HH6s0qEhLQ1fllvGxE
dmvK4rE+JgMKsXMKPX1QRdDJwB/c/l+/cgac4R43mmtbNFsQzV5IH0b2gbEFtp/k
s3ckTDH5Wrtr067UxlB4B7ng2i91yJyhFiczjSE87URWBTGwYzJzANtuTgLz9sas
OQn+JUCHcooAFWVjyDeNMpPaH4faA/0b+GZqqBPyztrsdrVjOVCuI0RYYhjXzkIS
XFYp+lcy
=P1vs
-END PGP SIGNATURE-