delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/09/09/09:44:10

From: rda AT eng DOT cam DOT ac DOT uk
Date: Thu, 9 Sep 93 13:59:09 CST
Sender: rda AT eng DOT cam DOT ac DOT uk
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: backspace <--> delete

In Message Thu, 9 Sep 93 11:07:54 BST,
  Chris Boucher <C DOT C DOT Boucher AT southampton DOT ac DOT uk> writes:

>John E. Davis writes:
>>    I am compiling a program with djgpp/gcc and so far, all has gone well.
>> However, I would like to distinguish between pressing the ^H key and the
>> backspace key.  Can I do this?  In addition, I want to distinguish between
>> spacebar and Control-spacebar.
>
>The trick is to look at the keyboard modifiers (INT 16 AH=02) every time
>you read in a key - if you get a ^H and the control key isn't down then
>it was backspace.
>
>Chris.

This works OK most of the time, but it tends to fail in some applications if
the user types ahead - unless you can guarantee that the application is
going to read keys immediately you may be OK, but if not, you can end up
reading the modifiers long _after_ the key was pressed.

Example:
    In Demacs & OEmacs (DOS/WINDOWS/DJGPP versions of GNU Emacs)

    Some commands start with Meta(=ALT)-X, Emacs checks to see if ALT is
      pressed when the key is read.
    Emacs does not check for keypresses when busy executing command, eg.
      reading a file.
    Try reading in a medium-large file, type ahead a command like
         <ALT-X>auto-fill-mode<RET>
    Result -> delay in reading the X keypress means ALT is no longer down
      and everything goes horribly wrong.

This sort of behaviour is bad IMHO - editors ought to be able to cope with a
few characters type-ahead.

What is really needed is an INT-09 handler in GO32 which reads the modifiers
_when the key is pressed_ and buffers keypress events as (say) keycode +
modifier (+ timestamp ?) for the application (ditto for mouse events).

I think the current event library could be modified to do this, but I can't
find any docs for it.

I've toyed with the idea of implementing this myself, but I think maybe we
need some discussion of exactly what is needed first, else the effort would
be wasted. (I also need to get to grips with the lastest GO32 version).

Any ideas anyone ?

-ray
<rda AT eng DOT cam DOT ac DOT uk>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019