[squeak-dev] The Inbox: Kernel-mt.1287.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Mon Dec 16 10:24:02 UTC 2019


Hi all! :-)

I do not propose a loss of information, just a more consistent view on it with fewer special cases in the lower abstraction levels.

The goal is to provide a clean object representation for input events. So, we should simplify the data exchange between VM and image but keep it cross-platform compatible.

If anybody wants to implement a terminal-like application within Squeak, it is very simple to convert "anEvent controlKeyPressed and: [anEvent keyValue >= 64]" to that non-printable ascii range. However, I argue that this detail should not bleed into applications by default. And as long as VMs send those control characters for [ctrl]-combinations, EventSensor could unpack those to make typing [ctrl]+[0] behave like typing [ctrl]+[c].

I argue for a consistent representation of modifiers (ctrl, cmd/alt, shift, (opt), ...) and key characters. The following example is not possible at the moment but should:


MyMorph >> #handlesKeyboard: evt
   ^ true
MyMorph >> #keyStroke: evt
  (evt controlKeyPressed and: [evt keyCharacter = $c])
      ifTrue: [self terminateApplication].

Why? Because there might be the requirement to "terminate on ctrl+c" for some application and it would be nice if one could just implement it that way. :-)

But maybe I am confusing "characters" and "keys" again. Happens way too quickly.

Maybe "ctrl" is no modifier at all? Sigh.

Best,
Marcel

P.S.: I want function keys, too! :-D
Am 16.12.2019 07:13:04 schrieb K K Subbu <kksubbu.ml at gmail.com>:
On 15/12/19 6:02 PM, Jakob Reschke wrote:
> Did I get that wrong or are you really suggesting to make Ctrl
> unavailable as a modifier inside of Squeak?
>
> Many "normal" applications map Ctrl combinations. Most do so before they
> begin to map Alt. At least on Windows and Linux. Ctrl to them is what
> Cmd is to Mac, that's how I observed it.

Yes. My strawman proposal is to simplify code (VM and Image) through
separation of concerns and eliminate confusion across platforms. I don't
expect it to affect Squeak keyboard habits much [1]

VM input plugins will use modifiers like CTRL, SHIFT, CAPLOCK to decode
key presses and pass a "soft" keycode to the Image. For instance, when
you press Ctrl+C, the VM will decode this into 16r03 and pass it to the
Image. The Image will treat this as a "copy" command.Within the image,
non-printable codes will map directly to commands like cut (ctrl-x),
copy (ctrl-c), paste (ctrl-v), print (ctrl-p), open (ctrl-o), save
(ctrl-s), close (ctrl-w), quit (ctrl-q). ALT modifier is used to
interpret printable keys as commands like doit (alt-d), browse (alt-b) etc.

[1] Platforms often use modifier combinations to bypass apps, enter
accented characters or Unicode. Eg. CTRL+ALT on Linux, CMD+Option on
Mac) bypass applications and send commands directly to boot, host os or
the window manager. Other combinations like CTRL+SHIFT (Linux) or Option
(Mac) or ALT+Numeric+ (Windows) are used to enter any 4-nibble Unicode.
The Image should not have to deal with such low level detail. Let VM
input plugins handle these escapes gracefully.

Regards .. Subbu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191216/b8a21ad8/attachment.html>


More information about the Squeak-dev mailing list