Disabling certain keys in certain applications
Posted: Sun Apr 12, 2009 3:56 am
Hello.
In my OS,I have certain applications where I need only certain keys to work and in other all keys to work.
Like in my notepad-like application,I want all keys to work.
But in my X and O application, I want only '\t' & '\n' to work.
I had thought of keeping an array corresponding to keyboard scancodes.
When any application starts,I would make all the entries '1' whose corresponding scancodes I would like to accept.
When a keyboard interrupt occurs, I would 'AND' the value with the above array's corresponding entry. If non-zero, I would accept the key else reject it.
Is the above approach fine.
Please point out any problems in the above or any improvements/changes.
Thanks and regards.
In my OS,I have certain applications where I need only certain keys to work and in other all keys to work.
Like in my notepad-like application,I want all keys to work.
But in my X and O application, I want only '\t' & '\n' to work.
I had thought of keeping an array corresponding to keyboard scancodes.
When any application starts,I would make all the entries '1' whose corresponding scancodes I would like to accept.
When a keyboard interrupt occurs, I would 'AND' the value with the above array's corresponding entry. If non-zero, I would accept the key else reject it.
Is the above approach fine.
Please point out any problems in the above or any improvements/changes.
Thanks and regards.