blob: e5e6b2aabaf54e22e2731dca8f98fa9cb4085b91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
* Matchbox Keyboard - A lightweight software keyboard.
*
* Authored By Matthew Allum <mallum@o-hand.com>
* Tomas Frydrych <tomas@sleepfive.com>
*
* Copyright (c) 2005-2012 Intel Corp
* Copyright (c) 2012 Vernier Software & Technology
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU Lesser General Public License,
* version 2.1, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
* more details.
*
*/
#include "matchbox-keyboard.h"
struct MBKeyboardLayout
{
MBKeyboard *kbd;
char *id;
List *rows;
};
MBKeyboardLayout*
mb_kbd_layout_new(MBKeyboard *kbd, const char *id)
{
MBKeyboardLayout *layout = NULL;
layout = util_malloc0(sizeof(MBKeyboardLayout));
layout->kbd = kbd;
layout->id = strdup(id);
return layout;
}
void
mb_kbd_layout_destroy (MBKeyboardLayout *layout)
{
List *l;
if (layout->id)
free (layout->id);
l = layout->rows;
while (l)
{
List *n = l->next;
MBKeyboardRow *r = l->data;
mb_kbd_row_destroy (r);
free (l);
l = n;
}
free (layout);
}
void
mb_kbd_layout_append_row(MBKeyboardLayout *layout,
MBKeyboardRow *row)
{
layout->rows = util_list_append(layout->rows, (pointer)row);
}
List*
mb_kbd_layout_rows(MBKeyboardLayout *layout)
{
return util_list_get_first(layout->rows);
}
|