blob: 04e3caa80c771e7b6178093655ceaacac2d1c5d5 (
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
|
/*
* 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
*
* SPDX-License-Identifier: LGPL-2.1
*
*/
#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);
}
|