[Oberon] Re: Keyboard substituting for mouse.
peter at easthope.ca
peter at easthope.ca
Thu Jan 14 18:26:47 CET 2016
From: joerg.straube at iaeth.ch (Joerg), Tue, 12 Jan 2016 11:31:53 +0100
> ... unfortunate that Project Oberon has no standardized definitions of the
> key codes for the up, left, right and down keys. As I like to move around the caret
> with my keyboard instead of the mouse ...
A general solution which simplifies Mouse* and facilitates support for
other input hardware.
MODULE Input;
...
< ELSIF c = 046X THEN (* Scroll make *)
< LedKey(flags, ScrollLock, c, k);
< state := DisableInterrupts();
< IF ScrollLock IN flags THEN
< IF Kernel.timer = NIL THEN Kernel.timer := timerproc END
< ELSE
< IF Kernel.timer = timerproc THEN Kernel.timer := NIL END
< END;
< RestoreInterrupts(state)
> ELSIF c = 046X THEN (* Scroll make *)
> LedKey(flags, ScrollLock, c, k);
> state := DisableInterrupts();
> IF ScrollLock IN flags THEN (* Keypad input extant. *)
> RemoveMouse(GetKeypadEvent);
> AddMouse(GetMouseEvent);
> IF Kernel.timer = NIL THEN Kernel.timer := timerproc END
> ELSE (* Mouse input extant. *)
> RemoveMouse(GetMouseEvent);
> AddMouse(GetKeypadEvent);
> IF Kernel.timer = timerproc THEN Kernel.timer := NIL END
> END;
> RestoreInterrupts(state)
< PROCEDURE Mouse*(ind: SHORTINT; VAR keys: SET; VAR x, y: INTEGER);
< ...
< IF ScrollLock IN flags THEN
< keys := {};
< IF 11 IN kpmap THEN INCL(keys, 2) END;
< IF 5 IN kpmap THEN INCL(keys, 1) END;
< IF 12 IN kpmap THEN INCL(keys, 0) END;
< state := DisableInterrupts();
< INC(m.mouseX, LONG(kdx));
< INC(m.mouseY, LONG(kdy));
< kdx := 0; kdy := 0;
< RestoreInterrupts(state)
< ELSE
> PROCEDURE GetKeypadEvent(VAR keys: SET; VAR dx, dy, dz: INTEGER): BOOLEAN;
> ...
> keys := {};
> IF 11 IN kpmap THEN INCL(keys, 2) END;
> IF 5 IN kpmap THEN INCL(keys, 1) END;
> IF 12 IN kpmap THEN INCL(keys, 0) END;
> state := DisableInterrupts();
> INC(m.mouseX, LONG(kdx));
> INC(m.mouseY, LONG(kdy));
> kdx := 0; kdy := 0;
> RestoreInterrupts(state)
> ...
A week or more until I can test it.
Regards, ... Lyall E.
--
123456789 123456789 123456789 123456789 123456789 123456789 123456789 12
Tel +1 360 639 0202
http://easthope.ca/Peter.html Bcc: peter at easthope. ca
More information about the Oberon
mailing list