Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OT?] Problem with keyboard layout states (bug?)



This might be off topic, but I did not find a more appropriate list. Feel free to redirect my question somewhere else.

Given the following minimal keyboard layout:

><?xml version="1.0" encoding="UTF-8"?>
><!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
><keyboard group="126" id="-18948" name="Test">
>    <layouts>
>        <layout first="0" last="0" modifiers="mod" mapSet="map" />
>    </layouts>
>    <modifierMap id="mod" defaultIndex="0">
>        <keyMapSelect mapIndex="0">
>            <modifier keys="" />
>        </keyMapSelect>
>    </modifierMap>
>    <keyMapSet id="map">
>        <keyMap index="0">
>            <key code= "36" output="&#x000d;" /> <!-- CR (for dead keys to work) -->
>            <key code=  "7" action="x" />
>            <key code= "16" action="y" />
>            <key code= "49" action=" " />
>        </keyMap>
>    </keyMapSet>
>    <actions>
>        <action id="x">
>            <when state="none" next="x" />
>        </action>
>        <action id="y">
>            <when state="none" output="y" next="y" />
>        </action>
>        <action id=" ">
>            <when state="none" output=" " />
>            <when state="x" output="x(x)" />
>            <when state="y" output="(y)" />
>        </action>
>    </actions>
>    <terminators>
>        <when state="x" output="x" />
>    </terminators>
></keyboard>

The keys x, y and space are associated with the actions x, y and " ", respectively.

Whenever x is pressed, the keyboard enters the state x regardless of the previous state, as expected.

When y is pressed, the keyboard enters state y unless it was previously in state x, whereas I would have expected state y in all cases.

Test cases: 1) yy+space => "yy(y)".  2) x+y+space => "xy " and not "xy(y)".

The distinguishing feature seems to be whether the state is associated with a terminator (in which case the keyboard always enters the next state as specified) or not (in which case the keyboard unexpectedly enters the state none if it was previously in a state associated with a terminator).

This behaviour surprises me, and it does not seem to be documented in TN2056. Is this a bug or a feature?

-- 
Øistein E. Andersen
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.