Subversion Repositories HelenOS

Rev

Rev 4377 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4377 Rev 4692
Line 25... Line 25...
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
/** @addtogroup kbd
29
/** @addtogroup kbd
30
 * @brief   US QWERTY leyout.
30
 * @brief Czech QWERTZ layout.
31
 * @{
31
 * @{
32
 */
32
 */
33
 
33
 
34
#include <kbd.h>
34
#include <kbd.h>
35
#include <kbd/kbd.h>
35
#include <io/console.h>
36
#include <kbd/keycode.h>
36
#include <io/keycode.h>
37
#include <bool.h>
37
#include <bool.h>
38
#include <layout.h>
38
#include <layout.h>
39
 
39
 
40
static void layout_reset(void);
40
static void layout_reset(void);
41
static wchar_t layout_parse_ev(kbd_event_t *ev);
41
static wchar_t layout_parse_ev(console_event_t *ev);
42
 
42
 
43
enum m_state {
43
enum m_state {
44
    ms_start,
44
    ms_start,
45
    ms_hacek,
45
    ms_hacek,
46
    ms_carka   
46
    ms_carka
47
};
47
};
48
 
48
 
49
static enum m_state mstate;
49
static enum m_state mstate;
50
 
50
 
51
layout_op_t cz_op = {
51
layout_op_t cz_op = {
Line 270... Line 270...
270
    if (key >= map_length)
270
    if (key >= map_length)
271
        return 0;
271
        return 0;
272
    return map[key];
272
    return map[key];
273
}
273
}
274
 
274
 
275
static wchar_t parse_ms_hacek(kbd_event_t *ev)
275
static wchar_t parse_ms_hacek(console_event_t *ev)
276
{
276
{
277
    wchar_t c;
277
    wchar_t c;
278
 
278
 
279
    mstate = ms_start;
279
    mstate = ms_start;
280
 
280
 
Line 288... Line 288...
288
        c = translate(ev->key, map_hacek_lcase, sizeof(map_hacek_lcase) / sizeof(wchar_t));
288
        c = translate(ev->key, map_hacek_lcase, sizeof(map_hacek_lcase) / sizeof(wchar_t));
289
 
289
 
290
    return c;
290
    return c;
291
}
291
}
292
 
292
 
293
static wchar_t parse_ms_carka(kbd_event_t *ev)
293
static wchar_t parse_ms_carka(console_event_t *ev)
294
{
294
{
295
    wchar_t c;
295
    wchar_t c;
296
 
296
 
297
    mstate = ms_start;
297
    mstate = ms_start;
298
 
298
 
Line 306... Line 306...
306
        c = translate(ev->key, map_carka_lcase, sizeof(map_carka_lcase) / sizeof(wchar_t));
306
        c = translate(ev->key, map_carka_lcase, sizeof(map_carka_lcase) / sizeof(wchar_t));
307
 
307
 
308
    return c;
308
    return c;
309
}
309
}
310
 
310
 
311
static wchar_t parse_ms_start(kbd_event_t *ev)
311
static wchar_t parse_ms_start(console_event_t *ev)
312
{
312
{
313
    wchar_t c;
313
    wchar_t c;
314
 
314
 
315
    /* Produce no characters when Ctrl or Alt is pressed. */
315
    /* Produce no characters when Ctrl or Alt is pressed. */
316
    if ((ev->mods & (KM_CTRL | KM_ALT)) != 0)
316
    if ((ev->mods & (KM_CTRL | KM_ALT)) != 0)
Line 381... Line 381...
381
static void layout_reset(void)
381
static void layout_reset(void)
382
{
382
{
383
    mstate = ms_start;
383
    mstate = ms_start;
384
}
384
}
385
 
385
 
386
static wchar_t layout_parse_ev(kbd_event_t *ev)
386
static wchar_t layout_parse_ev(console_event_t *ev)
387
{
387
{
388
    if (ev->type != KE_PRESS)
388
    if (ev->type != KEY_PRESS)
389
        return '\0';
389
        return 0;
390
 
390
   
391
    if (key_is_mod(ev->key))
391
    if (key_is_mod(ev->key))
392
        return '\0';
392
        return 0;
393
 
393
   
394
    switch (mstate) {
394
    switch (mstate) {
-
 
395
    case ms_start:
395
    case ms_start: return parse_ms_start(ev);
396
        return parse_ms_start(ev);
-
 
397
    case ms_hacek:
396
    case ms_hacek: return parse_ms_hacek(ev);
398
        return parse_ms_hacek(ev);
-
 
399
    case ms_carka:
397
    case ms_carka: return parse_ms_carka(ev);
400
        return parse_ms_carka(ev);
398
    }
401
    }
-
 
402
   
-
 
403
    return 0;
399
}
404
}
400
 
405
 
401
/**
406
/**
402
 * @}
407
 * @}
403
 */
408
 */