Mercurial > pidgin.yaz
annotate finch/libgnt/gntkeys.c @ 29253:f75c1323c996
*** Plucked rev 3976bac9dc1aafa42217dda56118316cb2fed956 (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
If a buddy is deleted less than 11 seconds after they sign on or off, and
there is a conversation open with that buddy, the PurpleBuddy will be
dereferenced after it has been freed. This avoids that by duplicating the
required details from the PurpleBuddy for use in the status_timeout callback.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 07 Jan 2010 23:48:56 +0000 |
parents | 3b6f50b68f5d |
children |
rev | line source |
---|---|
18049
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
1 /** |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
2 * GNT - The GLib Ncurses Toolkit |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
3 * |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
4 * GNT is the legal property of its developers, whose names are too numerous |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
6 * source distribution. |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
7 * |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
8 * This library is free software; you can redistribute it and/or modify |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
11 * (at your option) any later version. |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
12 * |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
16 * GNU General Public License for more details. |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
17 * |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18423
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
18049
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
21 */ |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18000
diff
changeset
|
22 |
24503
e2e57d3c0578
Use glib log functions to show error messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24281
diff
changeset
|
23 #include "gntinternal.h" |
e2e57d3c0578
Use glib log functions to show error messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24281
diff
changeset
|
24 #undef GNT_LOG_DOMAIN |
e2e57d3c0578
Use glib log functions to show error messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24281
diff
changeset
|
25 #define GNT_LOG_DOMAIN "Keys" |
e2e57d3c0578
Use glib log functions to show error messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24281
diff
changeset
|
26 |
15818 | 27 #include "gntkeys.h" |
28 | |
29 #include <glib.h> | |
30 #include <stdlib.h> | |
31 #include <string.h> | |
32 | |
33 char *gnt_key_cup; | |
34 char *gnt_key_cdown; | |
35 char *gnt_key_cleft; | |
36 char *gnt_key_cright; | |
37 | |
38 static const char *term; | |
39 static GHashTable *specials; | |
40 | |
41 void gnt_init_keys() | |
42 { | |
43 const char *controls[] = {"", "c-", "ctrl-", "ctr-", "ctl-", NULL}; | |
44 const char *alts[] = {"", "alt-", "a-", "m-", "meta-", NULL}; | |
45 int c, a, ch; | |
46 char key[32]; | |
47 | |
48 if (term == NULL) { | |
49 term = getenv("TERM"); | |
50 if (!term) | |
51 term = ""; /* Just in case */ | |
52 } | |
53 | |
24098
dc8fac020fad
Fix a bug where some key-bindings wouldn't work with some .
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23420
diff
changeset
|
54 if (strstr(term, "xterm") == term || strcmp(term, "rxvt") == 0) { |
15818 | 55 gnt_key_cup = "\033" "[1;5A"; |
56 gnt_key_cdown = "\033" "[1;5B"; | |
57 gnt_key_cright = "\033" "[1;5C"; | |
58 gnt_key_cleft = "\033" "[1;5D"; | |
24098
dc8fac020fad
Fix a bug where some key-bindings wouldn't work with some .
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23420
diff
changeset
|
59 } else if (strstr(term, "screen") == term || strcmp(term, "rxvt-unicode") == 0) { |
15818 | 60 gnt_key_cup = "\033" "Oa"; |
61 gnt_key_cdown = "\033" "Ob"; | |
62 gnt_key_cright = "\033" "Oc"; | |
63 gnt_key_cleft = "\033" "Od"; | |
64 } | |
65 | |
66 specials = g_hash_table_new(g_str_hash, g_str_equal); | |
67 | |
68 #define INSERT_KEY(k, code) do { \ | |
69 g_hash_table_insert(specials, g_strdup(k), g_strdup(code)); \ | |
70 gnt_keys_add_combination(code); \ | |
71 } while (0) | |
72 | |
73 INSERT_KEY("home", GNT_KEY_HOME); | |
74 INSERT_KEY("end", GNT_KEY_END); | |
75 INSERT_KEY("pageup", GNT_KEY_PGUP); | |
76 INSERT_KEY("pagedown", GNT_KEY_PGDOWN); | |
77 INSERT_KEY("insert", GNT_KEY_INS); | |
78 INSERT_KEY("delete", GNT_KEY_DEL); | |
18000
05d7fe2320a9
(16:39:44) rekkanoryo: i have a feature request
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16044
diff
changeset
|
79 INSERT_KEY("back_tab", GNT_KEY_BACK_TAB); |
15818 | 80 |
81 INSERT_KEY("left", GNT_KEY_LEFT); | |
82 INSERT_KEY("right", GNT_KEY_RIGHT); | |
83 INSERT_KEY("up", GNT_KEY_UP); | |
84 INSERT_KEY("down", GNT_KEY_DOWN); | |
85 | |
86 INSERT_KEY("tab", "\t"); | |
23396
e145f37cb2e2
Allow binding space, escape and return to some action.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
87 INSERT_KEY("escape", "\033"); |
e145f37cb2e2
Allow binding space, escape and return to some action.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
88 INSERT_KEY("space", " "); |
e145f37cb2e2
Allow binding space, escape and return to some action.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
89 INSERT_KEY("return", GNT_KEY_ENTER); |
15818 | 90 INSERT_KEY("menu", GNT_KEY_POPUP); |
91 | |
92 INSERT_KEY("f1", GNT_KEY_F1); | |
93 INSERT_KEY("f2", GNT_KEY_F2); | |
94 INSERT_KEY("f3", GNT_KEY_F3); | |
95 INSERT_KEY("f4", GNT_KEY_F4); | |
96 INSERT_KEY("f5", GNT_KEY_F5); | |
97 INSERT_KEY("f6", GNT_KEY_F6); | |
98 INSERT_KEY("f7", GNT_KEY_F7); | |
99 INSERT_KEY("f8", GNT_KEY_F8); | |
100 INSERT_KEY("f9", GNT_KEY_F9); | |
101 INSERT_KEY("f10", GNT_KEY_F10); | |
102 INSERT_KEY("f11", GNT_KEY_F11); | |
103 INSERT_KEY("f12", GNT_KEY_F12); | |
104 | |
105 #define REM_LENGTH (sizeof(key) - (cur - key)) | |
106 #define INSERT_COMB(k, code) do { \ | |
107 snprintf(key, sizeof(key), "%s%s%s", controls[c], alts[a], k); \ | |
108 INSERT_KEY(key, code); \ | |
24281
23687caad265
Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24098
diff
changeset
|
109 } while (0) |
23687caad265
Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24098
diff
changeset
|
110 #define INSERT_COMB_CODE(k, c1, c2) do { \ |
23687caad265
Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24098
diff
changeset
|
111 char __[32]; \ |
23687caad265
Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24098
diff
changeset
|
112 snprintf(__, sizeof(__), "%s%s", c1, c2); \ |
23687caad265
Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24098
diff
changeset
|
113 INSERT_COMB(k, __); \ |
23687caad265
Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24098
diff
changeset
|
114 } while (0) |
15818 | 115 |
116 /* Lower-case alphabets */ | |
117 for (a = 0, c = 0; controls[c]; c++, a = 0) { | |
118 if (c) { | |
119 INSERT_COMB("up", gnt_key_cup); | |
120 INSERT_COMB("down", gnt_key_cdown); | |
121 INSERT_COMB("left", gnt_key_cleft); | |
122 INSERT_COMB("right", gnt_key_cright); | |
123 } | |
124 | |
125 for (a = 0; alts[a]; a++) { | |
126 for (ch = 0; ch < 26; ch++) { | |
127 char str[2] = {'a' + ch, 0}, code[4] = "\0\0\0\0"; | |
128 int ind = 0; | |
129 if (a) | |
130 code[ind++] = '\033'; | |
131 code[ind] = (c ? 1 : 'a') + ch; | |
132 INSERT_COMB(str, code); | |
133 } | |
24918
06ab3599f0db
Fix rebinding the arrow keys and tab.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24503
diff
changeset
|
134 if (c == 0 && a) { |
23396
e145f37cb2e2
Allow binding space, escape and return to some action.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
135 INSERT_COMB("tab", "\033\t"); |
24281
23687caad265
Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24098
diff
changeset
|
136 INSERT_COMB_CODE("up", "\033", GNT_KEY_UP); |
23687caad265
Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24098
diff
changeset
|
137 INSERT_COMB_CODE("down", "\033", GNT_KEY_DOWN); |
23687caad265
Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24098
diff
changeset
|
138 INSERT_COMB_CODE("left", "\033", GNT_KEY_LEFT); |
23687caad265
Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24098
diff
changeset
|
139 INSERT_COMB_CODE("right", "\033", GNT_KEY_RIGHT); |
23396
e145f37cb2e2
Allow binding space, escape and return to some action.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
140 } |
15818 | 141 } |
142 } | |
143 c = 0; | |
144 for (a = 0; alts[a]; a++) { | |
145 /* Upper-case alphabets */ | |
146 for (ch = 0; ch < 26; ch++) { | |
147 char str[2] = {'A' + ch, 0}, code[] = {'\033', 'A' + ch, 0}; | |
148 INSERT_COMB(str, code); | |
149 } | |
150 /* Digits */ | |
151 for (ch = 0; ch < 10; ch++) { | |
152 char str[2] = {'0' + ch, 0}, code[] = {'\033', '0' + ch, 0}; | |
153 INSERT_COMB(str, code); | |
154 } | |
155 } | |
156 } | |
157 | |
23219
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
158 void gnt_keys_refine(char *text) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
159 { |
24281
23687caad265
Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24098
diff
changeset
|
160 while (*text == 27 && *(text + 1) == 27) |
23687caad265
Allow binding meta-arrow keys for actions. Requested by essobi in #pidgin
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24098
diff
changeset
|
161 text++; |
23219
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
162 if (*text == 27 && *(text + 1) == '[' && |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
163 (*(text + 2) >= 'A' && *(text + 2) <= 'D')) { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
164 /* Apparently this is necessary for urxvt and screen and xterm */ |
24098
dc8fac020fad
Fix a bug where some key-bindings wouldn't work with some .
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23420
diff
changeset
|
165 if (strstr(term, "screen") == term || strcmp(term, "rxvt-unicode") == 0 || |
25058
135ee310d62c
Need some refining for vt100 too, apparently. Fixes #8335.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24918
diff
changeset
|
166 strstr(term, "xterm") == term || |
135ee310d62c
Need some refining for vt100 too, apparently. Fixes #8335.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24918
diff
changeset
|
167 strstr(term, "vt100") == term) |
23219
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
168 *(text + 1) = 'O'; |
28268
3b6f50b68f5d
Make gnt_keys_refine UTF8-compatible. Note, the rest of the tests don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25058
diff
changeset
|
169 } else if (g_utf8_get_char(text) == 195) { |
24098
dc8fac020fad
Fix a bug where some key-bindings wouldn't work with some .
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23420
diff
changeset
|
170 if (*(text + 2) == 0 && strstr(term, "xterm") == term) { |
23219
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
171 *(text) = 27; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
172 *(text + 1) -= 64; /* Say wha? */ |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
173 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
174 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
175 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
176 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
177 const char *gnt_key_translate(const char *name) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
178 { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
179 return name ? g_hash_table_lookup(specials, name) : NULL; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
180 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
181 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
182 typedef struct { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
183 const char *name; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
184 const char *key; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
185 } gntkey; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
186 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
187 static void |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
188 get_key_name(gpointer key, gpointer value, gpointer data) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
189 { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
190 gntkey *k = data; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
191 if (k->name) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
192 return; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
193 if (g_utf8_collate(value, k->key) == 0) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
194 k->name = key; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
195 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
196 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
197 const char *gnt_key_lookup(const char *key) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
198 { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
199 gntkey k = {NULL, key}; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
200 g_hash_table_foreach(specials, get_key_name, &k); |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
201 return k.name; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
202 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
203 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
204 /** |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
205 * The key-bindings will be saved in a tree. When a keystroke happens, GNT will |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
206 * find the sequence that matches a binding and return the length. |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
207 * A sequence should not be a prefix of another sequence. If it is, then only |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
208 * the shortest one will be processed. If we want to change that, we will need |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
209 * to allow getting the k-th prefix that matches the input, and pay attention |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
210 * to the return value of gnt_wm_process_input in gntmain.c. |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
211 */ |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
212 #define SIZE 256 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
213 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
214 #define IS_END 1 << 0 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
215 struct _node |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
216 { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
217 struct _node *next[SIZE]; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
218 int ref; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
219 int flags; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
220 }; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
221 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
222 static struct _node root = {.ref = 1, .flags = 0}; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
223 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
224 static void add_path(struct _node *node, const char *path) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
225 { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
226 struct _node *n = NULL; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
227 if (!path || !*path) { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
228 node->flags |= IS_END; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
229 return; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
230 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
231 while (*path && node->next[(unsigned char)*path]) { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
232 node = node->next[(unsigned char)*path]; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
233 node->ref++; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
234 path++; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
235 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
236 if (!*path) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
237 return; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
238 n = g_new0(struct _node, 1); |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
239 n->ref = 1; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
240 node->next[(unsigned char)*path++] = n; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
241 add_path(n, path); |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
242 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
243 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
244 void gnt_keys_add_combination(const char *path) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
245 { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
246 add_path(&root, path); |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
247 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
248 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
249 static void del_path(struct _node *node, const char *path) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
250 { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
251 struct _node *next = NULL; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
252 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
253 if (!*path) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
254 return; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
255 next = node->next[(unsigned char)*path]; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
256 if (!next) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
257 return; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
258 del_path(next, path + 1); |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
259 next->ref--; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
260 if (next->ref == 0) { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
261 node->next[(unsigned char)*path] = NULL; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
262 g_free(next); |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
263 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
264 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
265 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
266 void gnt_keys_del_combination(const char *path) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
267 { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
268 del_path(&root, path); |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
269 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
270 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
271 int gnt_keys_find_combination(const char *path) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
272 { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
273 int depth = 0; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
274 struct _node *n = &root; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
275 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
276 root.flags &= ~IS_END; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
277 while (*path && n->next[(unsigned char)*path] && !(n->flags & IS_END)) { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
278 if (!g_ascii_isspace(*path) && |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
279 !g_ascii_iscntrl(*path) && |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
280 !g_ascii_isgraph(*path)) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
281 return 0; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
282 n = n->next[(unsigned char)*path++]; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
283 depth++; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
284 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
285 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
286 if (!(n->flags & IS_END)) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
287 depth = 0; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
288 return depth; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
289 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
290 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
291 static void |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
292 print_path(struct _node *node, int depth) |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
293 { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
294 int i; |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
295 for (i = 0; i < SIZE; i++) { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
296 if (node->next[i]) { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
297 g_printerr("%*c (%d:%d)\n", depth * 4, i, node->next[i]->ref, |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
298 node->next[i]->flags); |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
299 print_path(node->next[i], depth + 1); |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
300 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
301 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
302 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
303 |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
304 /* this is purely for debugging purposes. */ |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
305 void gnt_keys_print_combinations(void); |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
306 void gnt_keys_print_combinations() |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
307 { |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
308 g_printerr("--------\n"); |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
309 print_path(&root, 1); |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
310 g_printerr("--------\n"); |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
311 } |
7b7af53e136a
disapproval of revision '79699160e06b69f70db91eef65287f15685ec2bf'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23218
diff
changeset
|
312 |