Topics

Best Way to Avoid Saving Some Gestures


Luke Davis
 

Hello

I have written an add-on that, under certain circumstances, overrides a bunch of NVDA's default keyboard gestures.

While that add-on is running, if the user (or even another add-on) saves the gesture map to disk, some or all of those overridden gestures will be saved.

This is undesirable, because if the add-on is deleted, or NVDA is started without add-ons, the gesture map can be in a non-default state.

I need a way to make sure that my overridden gestures are never saved.

It would be nice if gestures could have an ethereal, or noSave flag, but there is no such thing (although I suspect that might come in handy for people doing layer commands as well).


The only really workable thing I have thought of so far, is to patch inputCore.manager.userGestureMap.save(), so that before it runs, it calls a method of my add-on which resets those gestures to their defaults (or whatever they were when the map was first loaded from disk), then calls the real save(), then resets the gestures to whatever my add-on wanted them to be.

In that way, save() never actually sees the munged gestures.

But I am wondering if there is some better way that i haven't thought of, and therefore wanted to ask here before I attempted that.

Thanks in advance for any ideas.

Luke


Brian's Mail list account
 

Have you asked on the add on list? I think more people might be on there who might have already solved your issue.
Brian

bglists@...
Sent via blueyonder.
Please address personal E-mail to:-
briang1@..., putting 'Brian Gaff'
in the display name field.
Newsgroup monitored: alt.comp.blind-users

----- Original Message -----
From: "Luke Davis" <luke@...>
To: <nvda-devel@groups.io>
Sent: Wednesday, September 02, 2020 7:59 AM
Subject: [nvda-devel] Best Way to Avoid Saving Some Gestures


Hello

I have written an add-on that, under certain circumstances, overrides a bunch of NVDA's default keyboard gestures.

While that add-on is running, if the user (or even another add-on) saves the gesture map to disk, some or all of those overridden gestures will be saved.

This is undesirable, because if the add-on is deleted, or NVDA is started without add-ons, the gesture map can be in a non-default state.

I need a way to make sure that my overridden gestures are never saved.

It would be nice if gestures could have an ethereal, or noSave flag, but there is no such thing (although I suspect that might come in handy for people doing layer commands as well).


The only really workable thing I have thought of so far, is to patch inputCore.manager.userGestureMap.save(), so that before it runs, it calls a method of my add-on which resets those gestures to their defaults (or whatever they were when the map was first loaded from disk), then calls the real save(), then resets the gestures to whatever my add-on wanted them to be.

In that way, save() never actually sees the munged gestures.

But I am wondering if there is some better way that i haven't thought of, and therefore wanted to ask here before I attempted that.

Thanks in advance for any ideas.

Luke