Ignore:
Timestamp:
02/16/13 09:02:30 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Implemented hotkey handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/plugin/src/xplra/Protocol.h

    r39 r45  
    107107
    108108    /**
     109     * Command: register a set of hotkeys for the client. Old hotkeys,
     110     * if any, are forgotten.
     111     *
     112     * The command is followed by the following data:
     113     * - The number of the hotkeys defined (U32).
     114     * - The code of the hotkeys (U16*number of the hotkeys).
     115     *   The lower byte is the same as the X-Plane virtual key code
     116     *   (the same as the ASCII code for numbers and upper-case letters),
     117     *   the upper one is a logical OR of the HOTKEY_MODIFIER_XXX
     118     *   codes.
     119     *
     120     * The reply consists of a result code only. It may fail with an
     121     * invalid length code if the number of hotkeys is too large.
     122     */
     123    static const uint8_t COMMAND_REGISTER_HOTKEYS = 0x51;
     124
     125    /**
     126     * Command: query the hotkeys.
     127     *
     128     * The reply consists of a result code, followed by the following
     129     * data, if the result code is RESULT_OK:
     130     * - The number of hotkeys defined (U32).
     131     * - An array of U8 values each being 0 or 1 depending on whether
     132     *   the corresponding hotkey has been pressed since the last
     133     *   query (or the registration, whichever is later). The value at
     134     *   index i corresponds to the hotkey code at index i in the
     135     *   array passed with COMMAND_REGISTER_HOTKEYS.
     136     *
     137     * If not hotkey has been registered, the number of hotkeys is
     138     * returned as 0.
     139     */
     140    static const uint8_t COMMAND_QUERY_HOTKEYS = 0x52;
     141
     142    /**
     143     * Command: unregister the previously registered hotkeys.
     144     *
     145     * The reply is a result code.
     146     */
     147    static const uint8_t COMMAND_UNREGISTER_HOTKEYS = 0x53;
     148
     149    /**
    109150     * Data type: int
    110151     */
     
    185226     */
    186227    static const uint8_t RESULT_OTHER_ERROR = 0xff;
     228
     229    /**
     230     * Hotkey modifier: shift
     231     */
     232    static const uint16_t HOTKEY_MODIFIER_SHIFT = 0x0100;
     233
     234    /**
     235     * Hotkey modifier: control
     236     */
     237    static const uint16_t HOTKEY_MODIFIER_CONTROL = 0x0200;
    187238
    188239    /**
     
    201252     */
    202253    static const float MAX_MESSAGE_DURATION = 5*60;
     254
     255    /**
     256     * The maximal number of hotkeys that can be registered for a
     257     * client.
     258     */
     259    static const size_t MAX_HOTKEY_COUNT = 128;
    203260
    204261    /**
Note: See TracChangeset for help on using the changeset viewer.