Subversion Repositories HelenOS

Rev

Rev 4035 | Rev 4240 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4035 Rev 4036
Line 190... Line 190...
190
    [KC_NPERIOD] = '.'
190
    [KC_NPERIOD] = '.'
191
};
191
};
192
 
192
 
193
static int translate(unsigned int key, char *map, size_t map_length)
193
static int translate(unsigned int key, char *map, size_t map_length)
194
{
194
{
195
    if (key >= map_length) return 0;
195
    if (key >= map_length)
-
 
196
        return 0;
196
    return map[key];   
197
    return map[key];
197
}
198
}
198
 
199
 
199
char layout_parse_ev(kbd_event_t *ev)
200
char layout_parse_ev(kbd_event_t *ev)
200
{
201
{
Line 203... Line 204...
203
    /* Produce no characters when Ctrl or Alt is pressed. */
204
    /* Produce no characters when Ctrl or Alt is pressed. */
204
    if ((ev->mods & (KM_CTRL | KM_ALT)) != 0)
205
    if ((ev->mods & (KM_CTRL | KM_ALT)) != 0)
205
        return 0;
206
        return 0;
206
 
207
 
207
    c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char));
208
    c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char));
208
    if (c != 0) return c;
209
    if (c != 0)
-
 
210
        return c;
209
 
211
 
210
    if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
212
    if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
211
        c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(char));
213
        c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(char));
212
    else
214
    else
213
        c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(char));
215
        c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(char));
214
 
216
 
215
    if (c != 0) return c;
217
    if (c != 0)
-
 
218
        return c;
216
 
219
 
217
    if ((ev->mods & KM_SHIFT) != 0)
220
    if ((ev->mods & KM_SHIFT) != 0)
218
        c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char));
221
        c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char));
219
    else
222
    else
220
        c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char));
223
        c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char));
221
 
224
 
222
    if (c != 0) return c;
225
    if (c != 0)
-
 
226
        return c;
223
 
227
 
224
    if ((ev->mods & KM_NUM_LOCK) != 0)
228
    if ((ev->mods & KM_NUM_LOCK) != 0)
225
        c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char));
229
        c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char));
226
    else
230
    else
227
        c = 0;
231
        c = 0;