Re: ctwm "forgets" keybindings after a while

2021-10-11 Thread Rhialto
On Sun 10 Oct 2021 at 15:52:04 -0700, Jonathan Thornburg wrote:
> Brilliant!  You are indeed both correct -- my problem was mainly Num-Lock
> (which on my keyboard is needed in order to enable the numeric keypad),
> but when I tested, Caps-Lock also causes my bindigs to be ignored.

One shortcoming with the solution is that it doesn't work for the case
when you have *both* of these modifiers active.

This stems from the somewhat annoying fact that to make key mappings
work, they have to be "grabbed" from the X server, including all
modifiers that apply to them correctly set. So if you have a key mapping
for plain 'X' and you ignore CapsLock and NumLock, ctwm needs to grab
'X', CapsLock+'X', NumLock+'X', and CapsLock+NumLock+'X'. If you were to
ignore 3 modifiers, it would need to grab 8 different keys. Of course
this gets out of hand very very quickly.

And the person who wrote the IgnoreModifier code didn't think of this
anyway, since it only grabs the keys with 1 modifier at a time...

I don't know if there is a better solution than what I sketeched above.
Because I dislike it so much, I haven't made such a change. I'm not sure
if there is a better solution though...

-Olaf.
-- 
___ "Buying carbon credits is a bit like a serial killer paying someone else to
\X/  have kids to make his activity cost neutral." -The BOFHfalu.nl@rhialto



signature.asc
Description: PGP signature


Re: ctwm "forgets" keybindings after a while

2021-10-10 Thread Jonathan Thornburg


I wrote (about keybindings for F1 and F12)
> [[...]] after running ctwm for a while (anywhere from a few
> minutes to some hours, depending on my usage), these keys stop working
> (they no longer raise/lower the current window).  I've checked with
> 'xev' and these keys are still generating keypress X events.

On Sat, 9 Oct 2021 14:48:10 +0200
Rhialto  wrote:
> The most common thing that causes such a symptom is having Caps Lock
> pressed. It counts as a modifier, so pressing CapsLock + F1 doesn't
> match your mapping.

On Sat, Oct 09, 2021 at 10:12:09PM +0200, Carl Svensson wrote:
> I personally find Num Lock to be at least as great a culprit.
> I've added the following to my .ctwmrc (Num Lock may be a
> different modifier on your system):
> 
> # Ignore Num Lock and Caps Lock
> IgnoreModifier {
>   lock
>   m2
> }

Brilliant!  You are indeed both correct -- my problem was mainly Num-Lock
(which on my keyboard is needed in order to enable the numeric keypad),
but when I tested, Caps-Lock also causes my bindigs to be ignored.
I've added Carl's suggested stanza to my ~/.ctwmrc and my keybindings now
work perfectly regardless of either Num-lock or Caps-Lock.

Thanks 1L<<20 to both of you!
All the best, keep safe and COVID-free,
--
-- "Jonathan Thornburg [remove color- to reply]" 
   on the west coast of Canada, eh?
   "There was of course no way of knowing whether you were being watched
at any given moment.  How often, or on what system, the Thought Police
plugged in on any individual wire was guesswork.  It was even conceivable
that they watched everybody all the time."  -- George Orwell, "1984"



Re: ctwm "forgets" keybindings after a while

2021-10-09 Thread Carl Svensson


On Sat, 9 Oct 2021 14:48:10 +0200
Rhialto  wrote:

> On Fri 08 Oct 2021 at 23:18:00 -0700, Jonathan Thornburg wrote:
> > 
> > I'm using ctwm 4.0.3
> > > (bzr:fulle...@over-yonder.net-20190721212859-1hko50q7rrvqttfb)
> > 
> > The problem is, after running ctwm for a while (anywhere from a few
> > minutes to some hours, depending on my usage), these keys stop working
> > (they no longer raise/lower the current window).  I've checked with
> > 'xev' and these keys are still generating keypress X events.
> 
> The most common thing that causes such a symptom is having Caps Lock
> pressed. It counts as a modifier, so pressing CapsLock + F1 doesn't
> match your mapping.
> 

I personally find Num Lock to be at least as great a culprit.
I've added the following to my .ctwmrc (Num Lock may be a
different modifier on your system):

# Ignore Num Lock and Caps Lock
IgnoreModifier {
  lock
  m2
}

-- 
Carl Svensson



Re: ctwm "forgets" keybindings after a while

2021-10-09 Thread Rhialto
On Fri 08 Oct 2021 at 23:18:00 -0700, Jonathan Thornburg wrote:
> 
> I'm using ctwm 4.0.3
> > (bzr:fulle...@over-yonder.net-20190721212859-1hko50q7rrvqttfb)
> on OpenBSD 7.0 (2021-Sep-27 snapshot).  My .ctwmrc contains the lines
> 
> "F1"=  : window : f.raise
> "F1"=  : title  : f.raise
> 
> "F12"   =  : window : f.lower
> "F12"   =  : title  : f.lower
> 
> When I start ctwm, these work fine -- the F1 key raises the current
> window to the front, and the F12 lowers the current window to the back.
> 
> The problem is, after running ctwm for a while (anywhere from a few
> minutes to some hours, depending on my usage), these keys stop working
> (they no longer raise/lower the current window).  I've checked with
> 'xev' and these keys are still generating keypress X events.

The most common thing that causes such a symptom is having Caps Lock
pressed. It counts as a modifier, so pressing CapsLock + F1 doesn't
match your mapping.

> Is this a known issue with ctwm?  If not, are there debug features
> I could activate to help in tracking down the problem?

If that is not it, there is a #define DEBUG_EVENTS that you could
enable in event_handlers.c, and recompile ctwm. Unfortunately it doesn't
add any output for key presses... but you could add some printf
statements inside the function HandleKeyPress() to check how far it
gets. If you restart the modified ctwm (ctwm --replace) from a text
console, it can freely print its stuff, unhindered by X.

-Olaf.
-- 
___ "Buying carbon credits is a bit like a serial killer paying someone else to
\X/  have kids to make his activity cost neutral." -The BOFHfalu.nl@rhialto



signature.asc
Description: PGP signature


ctwm "forgets" keybindings after a while

2021-10-09 Thread Jonathan Thornburg


I'm using ctwm 4.0.3
> (bzr:fulle...@over-yonder.net-20190721212859-1hko50q7rrvqttfb)
on OpenBSD 7.0 (2021-Sep-27 snapshot).  My .ctwmrc contains the lines

"F1"=  : window : f.raise
"F1"=  : title  : f.raise

"F12"   =  : window : f.lower
"F12"   =  : title  : f.lower

When I start ctwm, these work fine -- the F1 key raises the current
window to the front, and the F12 lowers the current window to the back.

The problem is, after running ctwm for a while (anywhere from a few
minutes to some hours, depending on my usage), these keys stop working
(they no longer raise/lower the current window).  I've checked with
'xev' and these keys are still generating keypress X events.

The only way I've found to restore these keys' function is to kill and
restart ctwm. :(

Is this a known issue with ctwm?  If not, are there debug features
I could activate to help in tracking down the problem?

--
-- "Jonathan Thornburg [remove color- to reply]" 
   on the west coast of Canada, eh?
   "There was of course no way of knowing whether you were being watched
at any given moment.  How often, or on what system, the Thought Police
plugged in on any individual wire was guesswork.  It was even conceivable
that they watched everybody all the time."  -- George Orwell, "1984"