Debian Codegraph @

src/ui.cpp

raw symbols SCIP
1 /*
2 ui system
3 */
4
5 #include <SDL/SDL.h>
6 #include <stdarg.h>
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <string.h>
10 #include <limits.h>
11
12 #include "config.h"cxx . . $ `<file>/config.h`/
13 #include "snipe2d.h"cxx . . $ `<file>/src/snipe2d.h`/
14 #include "sexpr/sexp.h"cxx . . $ `<file>/src/sexpr/sexp.h`/
15
16 #include "ui.h"cxx . . $ `<file>/src/ui.h`/
17
18
19 #define IS_HEAPEDcxx . . $ `src/ui.cpp:19:9`!(obj) (obj->magic == MAGIC_HEAPED)
20 #define SET_HEAPEDcxx . . $ `src/ui.cpp:20:9`!(obj) obj->magic = MAGIC_HEAPED
21
22 /* types */
23 typedef oesui_propnode_tcxx . . $ oesui_propnode_t# asset_tcxx . . $ asset_t#;
24
25
26 /* globals */
27 extern PREFScxx . . $ PREFS# gPrefscxx . . $ gPrefs.;
28 assetcache_tcxx . . $ assetcache_t# assetcache1cxx . . $ assetcache1.;
29
30
31 /* prototypes */
32 int oesui_widget_paintcxx . . $ oesui_widget_paint(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *, oesui_widget_tcxx . . $ oesui_widget_t# *);
33 int oesui_widget_updatecxx . . $ oesui_widget_update(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *, oesui_widget_tcxx . . $ oesui_widget_t# *);
34 int oesui_widget_signalcxx . . $ oesui_widget_signal(7199d99e2b5f4e49). (oesui_tcxx . . $ oesui_t# *, oesui_widget_tcxx . . $ oesui_widget_t# *, oesui_signal_tcxx . . $ oesui_signal_t# *);
35 int oesui_widget_opencxx . . $ oesui_widget_open(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *, oesui_widget_tcxx . . $ oesui_widget_t# *);
36 int oesui_widget_closecxx . . $ oesui_widget_close(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *, oesui_widget_tcxx . . $ oesui_widget_t# *);
37
38
39 /* functions */
40
41 int
42 hashifycxx . . $ hashify(5c4306d8553b3696). (const char *s)
43 {
44 return 0;
45 }
46
47
48
49 /**********************
50 * Asset cache manager *
51 **********************/
52
53 assetcache_tcxx . . $ assetcache_t# *
54 assetcache_initcxx . . $ assetcache_init(bc28de2e07247de). (assetcache_tcxx . . $ assetcache_t# *self)
55 {
56 if (!self)
57 {
58 self = (assetcache_tcxx . . $ assetcache_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, sizeof(*self));
59 if (!self) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
60 SET_HEAPEDcxx . . $ `src/ui.cpp:20:9`!(self);
61 }
62 self->lencxx . . $ assetcache_t#len. = 1;
63 self->alloccxx . . $ assetcache_t#alloc. = 64;
64 self->cachecxx . . $ assetcache_t#cache. = (asset_tcxx . . $ asset_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(self->alloccxx . . $ assetcache_t#alloc., sizeof(asset_tcxx . . $ asset_t#));
65 return self;
66 }
67
68
69 void
70 assetcache_deletecxx . . $ assetcache_delete(810283f5f18d2e8a). (assetcache_tcxx . . $ assetcache_t# *self)
71 {
72 if (self->cachecxx . . $ assetcache_t#cache.) freecxx . . $ free(bd21765a0afc8e3c).(self->cachecxx . . $ assetcache_t#cache.);
73 self->cachecxx . . $ assetcache_t#cache. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
74 self->lencxx . . $ assetcache_t#len. = 0;
75 self->alloccxx . . $ assetcache_t#alloc. = 0;
76 if (IS_HEAPEDcxx . . $ `src/ui.cpp:19:9`!(self))
77 freecxx . . $ free(bd21765a0afc8e3c).(self);
78 }
79
80
81 void *
82 assetcache_getcxx . . $ assetcache_get(2d401e4c55879679). (assetcache_tcxx . . $ assetcache_t# *self, const char *key)
83 {
84 int i, targhash;
85
86 targhash = hashifycxx . . $ hashify(5c4306d8553b3696).(key);
87 for (i = 1; i < self->lencxx . . $ assetcache_t#len.; i++)
88 {
89 if (self->cachecxx . . $ assetcache_t#cache.[i].hashcxx . . $ oesui_propnode_t#hash. != targhash) continue; /* can't possibly match. */
90 if (strcmp(self->cachecxx . . $ assetcache_t#cache.[i].keycxx . . $ oesui_propnode_t#key., key)) continue; /* not exact match. */
91 return self->cachecxx . . $ assetcache_t#cache.[i].valcxx . . $ oesui_propnode_t#val..pcxx . . $ oesui_atom_t#p.;
92 }
93 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
94 }
95
96
97 void *
98 assetcache_idxcxx . . $ assetcache_idx(56e4b5ed68cb5597). (assetcache_tcxx . . $ assetcache_t# *self, int idx)
99 {
100 if (idx < 0) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
101 if (idx > self->lencxx . . $ assetcache_t#len.) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
102 return self->cachecxx . . $ assetcache_t#cache.[idx].valcxx . . $ oesui_propnode_t#val..pcxx . . $ oesui_atom_t#p.;
103 }
104
105
106 assetcache_tcxx . . $ assetcache_t# *
107 assetcache_registercxx . . $ assetcache_register(84f759feddf7f47d). (assetcache_tcxx . . $ assetcache_t# *self, const char *key, void *obj)
108 {
109 if (!self)
110 self = assetcache_initcxx . . $ assetcache_init(bc28de2e07247de).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
111 if (assetcache_getcxx . . $ assetcache_get(2d401e4c55879679).(self, key)) /* Already registered. */
112 return self;
113 if (self->lencxx . . $ assetcache_t#len. > self->alloccxx . . $ assetcache_t#alloc.)
114 {
115 self->alloccxx . . $ assetcache_t#alloc. += 64;
116 self->cachecxx . . $ assetcache_t#cache. = (asset_tcxx . . $ asset_t#*)realloccxx . . $ realloc(42b2a9dd8f084bf2).(self->cachecxx . . $ assetcache_t#cache., self->alloccxx . . $ assetcache_t#alloc. * sizeof(asset_tcxx . . $ asset_t#));
117 }
118 self->cachecxx . . $ assetcache_t#cache.[self->lencxx . . $ assetcache_t#len.].keycxx . . $ oesui_propnode_t#key. = strdup(key);
119 self->cachecxx . . $ assetcache_t#cache.[self->lencxx . . $ assetcache_t#len.].hashcxx . . $ oesui_propnode_t#hash. = hashifycxx . . $ hashify(5c4306d8553b3696).(key);
120 self->cachecxx . . $ assetcache_t#cache.[self->lencxx . . $ assetcache_t#len.].valtypecxx . . $ oesui_propnode_t#valtype. = OESATOM_PTRcxx . . $ OESATOM_PTR.; //20
121 self->cachecxx . . $ assetcache_t#cache.[self->lencxx . . $ assetcache_t#len.].valcxx . . $ oesui_propnode_t#val..pcxx . . $ oesui_atom_t#p. = obj;
122 self->lencxx . . $ assetcache_t#len.++;
123 return self;
124 }
125
126
127 /* special-case asset-manager wrapper */
128 SDL_Surface *
129 imgasset_registercxx . . $ imgasset_register(998637ddb3131754). (const char *name)
130 {
131 void *obj;
132 SDL_Surface *img;
133
134 obj = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
135 if (!(obj = assetcache_getcxx . . $ assetcache_get(2d401e4c55879679).(&assetcache1cxx . . $ assetcache1., name)))
136 {
137 //printf("caching image '%s'\n", name);
138 if ((img = oes_load_imgcxx . . $ oes_load_img(998637ddb3131754).(name)))
139 {
140 assetcache1cxx . . $ assetcache1..cachecxx . . $ assetcache_t#cache.[assetcache1cxx . . $ assetcache1..lencxx . . $ assetcache_t#len.].hashcxx . . $ oesui_propnode_t#hash. = hashifycxx . . $ hashify(5c4306d8553b3696).(name);
141 assetcache1cxx . . $ assetcache1..cachecxx . . $ assetcache_t#cache.[assetcache1cxx . . $ assetcache1..lencxx . . $ assetcache_t#len.].keycxx . . $ oesui_propnode_t#key. = strdup(name);
142 assetcache1cxx . . $ assetcache1..cachecxx . . $ assetcache_t#cache.[assetcache1cxx . . $ assetcache1..lencxx . . $ assetcache_t#len.].valtypecxx . . $ oesui_propnode_t#valtype. = OESATOM_PTRcxx . . $ OESATOM_PTR.; //20;
143 assetcache1cxx . . $ assetcache1..cachecxx . . $ assetcache_t#cache.[assetcache1cxx . . $ assetcache1..lencxx . . $ assetcache_t#len.].valcxx . . $ oesui_propnode_t#val..pcxx . . $ oesui_atom_t#p. = img;
144 assetcache1cxx . . $ assetcache1..lencxx . . $ assetcache_t#len.++;
145 }
146 }
147 else
148 {
149 //printf("Image '%s' already cached\n", name);
150 img = (SDL_Surface*)obj;
151 }
152 return img;
153 }
154
155
156
157
158
159 /**********************
160 * Properties... list? *
161 **********************/
162
163 oesui_propnode_tcxx . . $ oesui_propnode_t# *
164 oesui_propnode_initcxx . . $ oesui_propnode_init(7a7cb34a240a679b). (oesui_propnode_tcxx . . $ oesui_propnode_t# *self, const char *key)
165 {
166 int n;
167 if (!self)
168 {
169 self = (oesui_propnode_tcxx . . $ oesui_propnode_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, sizeof(*self));
170 if (!self) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
171 SET_HEAPEDcxx . . $ `src/ui.cpp:20:9`!(self);
172 }
173 self->hashcxx . . $ oesui_propnode_t#hash. = hashifycxx . . $ hashify(5c4306d8553b3696).(key);
174 // self->key = strdup(key);
175 n = strlen(key) + 1;
176 if (self->keycxx . . $ oesui_propnode_t#key.)
177 {
178 freecxx . . $ free(bd21765a0afc8e3c).(self->keycxx . . $ oesui_propnode_t#key.);
179 self->keycxx . . $ oesui_propnode_t#key. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
180 }
181 self->keycxx . . $ oesui_propnode_t#key. = (char*)malloccxx . . $ malloc(9f008b2a9698428b).(n);
182 strcpy(self->keycxx . . $ oesui_propnode_t#key., key);
183 return self;
184 }
185
186 void
187 oesui_propnode_deletecxx . . $ oesui_propnode_delete(e81498c30a790d49). (oesui_propnode_tcxx . . $ oesui_propnode_t# *self)
188 {
189 if (self->keycxx . . $ oesui_propnode_t#key.)
190 {
191 freecxx . . $ free(bd21765a0afc8e3c).(self->keycxx . . $ oesui_propnode_t#key.);
192 self->keycxx . . $ oesui_propnode_t#key. = 0;
193 }
194 switch (self->valtypecxx . . $ oesui_propnode_t#valtype.)
195 {
196 case OESATOM_INTcxx . . $ OESATOM_INT.:
197 self->valcxx . . $ oesui_propnode_t#val..icxx . . $ oesui_atom_t#i. = 0;
198 break;
199 case OESATOM_FLOATcxx . . $ OESATOM_FLOAT.:
200 self->valcxx . . $ oesui_propnode_t#val..fcxx . . $ oesui_atom_t#f. = 0;
201 break;
202 case OESATOM_SYMBOLcxx . . $ OESATOM_SYMBOL.:
203 self->valcxx . . $ oesui_propnode_t#val..symcxx . . $ oesui_atom_t#sym. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
204 break;
205 case OESATOM_STRINGcxx . . $ OESATOM_STRING.:
206 freecxx . . $ free(bd21765a0afc8e3c).(self->valcxx . . $ oesui_propnode_t#val..scxx . . $ oesui_atom_t#s.);
207 self->valcxx . . $ oesui_propnode_t#val..scxx . . $ oesui_atom_t#s. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
208 break;
209 case OESATOM_PTRcxx . . $ OESATOM_PTR.:
210 self->valcxx . . $ oesui_propnode_t#val..pcxx . . $ oesui_atom_t#p. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
211 break;
212 }
213 if (IS_HEAPEDcxx . . $ `src/ui.cpp:19:9`!(self))
214 freecxx . . $ free(bd21765a0afc8e3c).(self);
215 }
216
217
218
219
220 oesui_props_tcxx . . $ oesui_props_t# *
221 oesui_props_initcxx . . $ oesui_props_init(db88831998cc2bbb). (oesui_props_tcxx . . $ oesui_props_t# *self)
222 {
223 if (!self)
224 {
225 self = (oesui_props_tcxx . . $ oesui_props_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, sizeof(oesui_props_tcxx . . $ oesui_props_t#));
226 if (!self) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
227 SET_HEAPEDcxx . . $ `src/ui.cpp:20:9`!(self);
228 }
229 // memset(self, 0, sizeof(*self));
230 self->listcxx . . $ oesui_props_t#list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
231 self->tailcxx . . $ oesui_props_t#tail. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
232 return self;
233 }
234
235
236 void
237 oesui_props_deletecxx . . $ oesui_props_delete(797c5a83d53151da). (oesui_props_tcxx . . $ oesui_props_t# *self)
238 {
239 llist_tcxx . . $ llist_t# *iter, *next;
240
241 for (iter = self->listcxx . . $ oesui_props_t#list.; iter; iter = iter->nextcxx . . $ llist_t#next.)
242 {
243 next = iter->nextcxx . . $ llist_t#next.;
244 oesui_propnode_deletecxx . . $ oesui_propnode_delete(e81498c30a790d49).((oesui_propnode_tcxx . . $ oesui_propnode_t#*)(iter->datacxx . . $ llist_t#data.));
245 iter->datacxx . . $ llist_t#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
246 freecxx . . $ free(bd21765a0afc8e3c).(iter);
247 }
248 if (IS_HEAPEDcxx . . $ `src/ui.cpp:19:9`!(self))
249 freecxx . . $ free(bd21765a0afc8e3c).(self);
250 }
251
252
253 oesui_propnode_tcxx . . $ oesui_propnode_t# *
254 oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305). (oesui_props_tcxx . . $ oesui_props_t# *self, const char *key)
255 {
256 oesui_propnode_tcxx . . $ oesui_propnode_t# *temp;
257 llist_tcxx . . $ llist_t# *iter;
258 int targhash;
259
260 if (!self) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
261 targhash = hashifycxx . . $ hashify(5c4306d8553b3696).(key);
262 for (iter = self->listcxx . . $ oesui_props_t#list.; iter; iter = iter->nextcxx . . $ llist_t#next.)
263 {
264 temp = (oesui_propnode_tcxx . . $ oesui_propnode_t#*)(iter->datacxx . . $ llist_t#data.);
265 if (targhash != temp->hashcxx . . $ oesui_propnode_t#hash.)
266 continue; /* can't possibly match */
267 if (strcasecmp(temp->keycxx . . $ oesui_propnode_t#key., key))
268 continue; /* not exact match */
269 return temp;
270 }
271 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
272 }
273
274
275 oesui_props_tcxx . . $ oesui_props_t# *
276 oesui_props_appendcxx . . $ oesui_props_append(9af38d9b57edd76). (oesui_props_tcxx . . $ oesui_props_t# *self, oesui_propnode_tcxx . . $ oesui_propnode_t# *node)
277 {
278 if (!self)
279 self = (oesui_props_tcxx . . $ oesui_props_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, sizeof(*self));
280 if (!self->listcxx . . $ oesui_props_t#list.)
281 {
282 self->listcxx . . $ oesui_props_t#list. = (llist_tcxx . . $ llist_t#*)malloccxx . . $ malloc(9f008b2a9698428b).(sizeof(llist_tcxx . . $ llist_t#));
283 self->listcxx . . $ oesui_props_t#list.->datacxx . . $ llist_t#data. = node;
284 self->listcxx . . $ oesui_props_t#list.->nextcxx . . $ llist_t#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
285 self->tailcxx . . $ oesui_props_t#tail. = self->listcxx . . $ oesui_props_t#list.;
286 }
287 else
288 {
289 self->tailcxx . . $ oesui_props_t#tail.->nextcxx . . $ llist_t#next. = (llist_tcxx . . $ llist_t#*)malloccxx . . $ malloc(9f008b2a9698428b).(sizeof(llist_tcxx . . $ llist_t#));
290 self->tailcxx . . $ oesui_props_t#tail.->nextcxx . . $ llist_t#next.->datacxx . . $ llist_t#data. = node;
291 self->tailcxx . . $ oesui_props_t#tail.->nextcxx . . $ llist_t#next.->nextcxx . . $ llist_t#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
292 self->tailcxx . . $ oesui_props_t#tail. = self->tailcxx . . $ oesui_props_t#tail.->nextcxx . . $ llist_t#next.;
293 }
294 return self;
295 }
296
297
298 oesui_props_tcxx . . $ oesui_props_t# *
299 oesui_props_set_intcxx . . $ oesui_props_set_int(bdf2c61a8b8c2010). (oesui_props_tcxx . . $ oesui_props_t# *self, const char *key, int val)
300 {
301 oesui_propnode_tcxx . . $ oesui_propnode_t# *node;
302
303 node = oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305).(self, key);
304 if (!node)
305 {
306 node = oesui_propnode_initcxx . . $ oesui_propnode_init(7a7cb34a240a679b).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, key);
307 if (!node) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
308 self = oesui_props_appendcxx . . $ oesui_props_append(9af38d9b57edd76). (self, node);
309 }
310 node->valtypecxx . . $ oesui_propnode_t#valtype. = OESATOM_INTcxx . . $ OESATOM_INT.;
311 node->valcxx . . $ oesui_propnode_t#val..icxx . . $ oesui_atom_t#i. = val;
312 return self;
313 }
314
315
316 oesui_props_tcxx . . $ oesui_props_t# *
317 oesui_props_set_floatcxx . . $ oesui_props_set_float(f9390f2fb4865646). (oesui_props_tcxx . . $ oesui_props_t# *self, const char *key, float val)
318 {
319 oesui_propnode_tcxx . . $ oesui_propnode_t# *node;
320
321 node = oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305).(self, key);
322 if (!node)
323 {
324 node = oesui_propnode_initcxx . . $ oesui_propnode_init(7a7cb34a240a679b).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, key);
325 if (!node) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
326 self = oesui_props_appendcxx . . $ oesui_props_append(9af38d9b57edd76). (self, node);
327 }
328 node->valtypecxx . . $ oesui_propnode_t#valtype. = OESATOM_FLOATcxx . . $ OESATOM_FLOAT.;
329 node->valcxx . . $ oesui_propnode_t#val..fcxx . . $ oesui_atom_t#f. = val;
330 return self;
331 }
332
333
334 oesui_props_tcxx . . $ oesui_props_t# *
335 oesui_props_set_symbolcxx . . $ oesui_props_set_symbol(ba24942a41498f31). (oesui_props_tcxx . . $ oesui_props_t# *self, const char *key, const char *val)
336 {
337 oesui_propnode_tcxx . . $ oesui_propnode_t# *node;
338
339 node = oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305).(self, key);
340 if (!node)
341 {
342 node = oesui_propnode_initcxx . . $ oesui_propnode_init(7a7cb34a240a679b).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, key);
343 if (!node) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
344 self = oesui_props_appendcxx . . $ oesui_props_append(9af38d9b57edd76). (self, node);
345 }
346 node->valtypecxx . . $ oesui_propnode_t#valtype. = OESATOM_SYMBOLcxx . . $ OESATOM_SYMBOL.;
347 node->valcxx . . $ oesui_propnode_t#val..symcxx . . $ oesui_atom_t#sym. = val;
348 return self;
349 }
350
351
352 oesui_props_tcxx . . $ oesui_props_t# *
353 oesui_props_set_stringcxx . . $ oesui_props_set_string(4ba516a21339f116). (oesui_props_tcxx . . $ oesui_props_t# *self, const char *key, char *val)
354 {
355 oesui_propnode_tcxx . . $ oesui_propnode_t# *node;
356
357 node = oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305).(self, key);
358 if (!node)
359 {
360 node = oesui_propnode_initcxx . . $ oesui_propnode_init(7a7cb34a240a679b).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, key);
361 if (!node) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
362 self = oesui_props_appendcxx . . $ oesui_props_append(9af38d9b57edd76). (self, node);
363 }
364 node->valtypecxx . . $ oesui_propnode_t#valtype. = OESATOM_STRINGcxx . . $ OESATOM_STRING.;
365 node->valcxx . . $ oesui_propnode_t#val..scxx . . $ oesui_atom_t#s. = val;
366 return self;
367 }
368
369
370 oesui_props_tcxx . . $ oesui_props_t# *
371 oesui_props_set_ptrcxx . . $ oesui_props_set_ptr(c5b3d00dc9fd23a0). (oesui_props_tcxx . . $ oesui_props_t# *self, const char *key, void *val)
372 {
373 oesui_propnode_tcxx . . $ oesui_propnode_t# *node;
374
375 node = oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305).(self, key);
376 if (!node)
377 {
378 node = oesui_propnode_initcxx . . $ oesui_propnode_init(7a7cb34a240a679b).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, key);
379 if (!node) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
380 self = oesui_props_appendcxx . . $ oesui_props_append(9af38d9b57edd76). (self, node);
381 }
382 node->valtypecxx . . $ oesui_propnode_t#valtype. = OESATOM_PTRcxx . . $ OESATOM_PTR.;
383 node->valcxx . . $ oesui_propnode_t#val..pcxx . . $ oesui_atom_t#p. = val;
384 return self;
385 }
386
387
388 int
389 oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee). (oesui_props_tcxx . . $ oesui_props_t# *self, const char *key)
390 {
391 oesui_propnode_tcxx . . $ oesui_propnode_t# *node;
392
393 node = oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305).(self, key);
394 if (!node) return 0;
395 switch (node->valtypecxx . . $ oesui_propnode_t#valtype.)
396 {
397 case OESATOM_INTcxx . . $ OESATOM_INT.: return node->valcxx . . $ oesui_propnode_t#val..icxx . . $ oesui_atom_t#i.; break;
398 case OESATOM_FLOATcxx . . $ OESATOM_FLOAT.: return (int)(node->valcxx . . $ oesui_propnode_t#val..fcxx . . $ oesui_atom_t#f.); break;
399 case OESATOM_SYMBOLcxx . . $ OESATOM_SYMBOL.: /* fallthrough */
400 case OESATOM_STRINGcxx . . $ OESATOM_STRING.: return strtolcxx . . $ strtol(8cc4c7acb13e570c).(node->valcxx . . $ oesui_propnode_t#val..scxx . . $ oesui_atom_t#s., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0); break;
401 case OESATOM_PTRcxx . . $ OESATOM_PTR.: return 0; break;
402 }
403 return 0;
404 }
405
406
407 float
408 oesui_props_get_floatcxx . . $ oesui_props_get_float(31dc42f3bf4ff3d4). (oesui_props_tcxx . . $ oesui_props_t# *self, const char *key)
409 {
410 oesui_propnode_tcxx . . $ oesui_propnode_t# *node;
411
412 node = oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305).(self, key);
413 if (!node) return 0;
414 switch (node->valtypecxx . . $ oesui_propnode_t#valtype.)
415 {
416 case OESATOM_INTcxx . . $ OESATOM_INT.: return (float)(node->valcxx . . $ oesui_propnode_t#val..icxx . . $ oesui_atom_t#i.); break;
417 case OESATOM_FLOATcxx . . $ OESATOM_FLOAT.: return node->valcxx . . $ oesui_propnode_t#val..fcxx . . $ oesui_atom_t#f.; break;
418 case OESATOM_SYMBOLcxx . . $ OESATOM_SYMBOL.: /* fallthrough */
419 case OESATOM_STRINGcxx . . $ OESATOM_STRING.: return atofcxx . . $ atof(9b0361fcbc284e4f).(node->valcxx . . $ oesui_propnode_t#val..scxx . . $ oesui_atom_t#s.); break;
420 case OESATOM_PTRcxx . . $ OESATOM_PTR.: return 0; break;
421 }
422 return 0;
423 }
424
425
426 const char *
427 oesui_props_get_symbolcxx . . $ oesui_props_get_symbol(819b9e5df68d655d). (oesui_props_tcxx . . $ oesui_props_t# *self, const char *key)
428 {
429 oesui_propnode_tcxx . . $ oesui_propnode_t# *node;
430 static char buf[72];
431
432 node = oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305).(self, key);
433 if (!node) return 0;
434 switch (node->valtypecxx . . $ oesui_propnode_t#valtype.)
435 {
436 case OESATOM_INTcxx . . $ OESATOM_INT.:
437 snprintf(buf, sizeof(buf), "%d", node->valcxx . . $ oesui_propnode_t#val..icxx . . $ oesui_atom_t#i.); return buf; break;
438 case OESATOM_FLOATcxx . . $ OESATOM_FLOAT.:
439 snprintf(buf, sizeof(buf), "%f", node->valcxx . . $ oesui_propnode_t#val..fcxx . . $ oesui_atom_t#f.); return buf; break;
440 case OESATOM_SYMBOLcxx . . $ OESATOM_SYMBOL.: return node->valcxx . . $ oesui_propnode_t#val..symcxx . . $ oesui_atom_t#sym.; break;
441 case OESATOM_STRINGcxx . . $ OESATOM_STRING.: return node->valcxx . . $ oesui_propnode_t#val..scxx . . $ oesui_atom_t#s.; break;
442 case OESATOM_PTRcxx . . $ OESATOM_PTR.: return 0; break;
443 }
444 return 0;
445 }
446
447
448 char *
449 oesui_props_get_stringcxx . . $ oesui_props_get_string(2e7e486a62abc7cd). (oesui_props_tcxx . . $ oesui_props_t# *self, const char *key)
450 {
451 oesui_propnode_tcxx . . $ oesui_propnode_t# *node;
452 // static char buf[72];
453 static char buf[1024];
454
455 node = oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305).(self, key);
456 if (!node) return 0;
457 switch (node->valtypecxx . . $ oesui_propnode_t#valtype.)
458 {
459 case OESATOM_INTcxx . . $ OESATOM_INT.:
460 snprintf(buf, sizeof(buf), "%d", node->valcxx . . $ oesui_propnode_t#val..icxx . . $ oesui_atom_t#i.); return buf; break;
461 case OESATOM_FLOATcxx . . $ OESATOM_FLOAT.:
462 snprintf(buf, sizeof(buf), "%f", node->valcxx . . $ oesui_propnode_t#val..fcxx . . $ oesui_atom_t#f.); return buf; break;
463 case OESATOM_SYMBOLcxx . . $ OESATOM_SYMBOL.:
464 snprintf(buf, sizeof(buf), "%s", node->valcxx . . $ oesui_propnode_t#val..symcxx . . $ oesui_atom_t#sym.); return buf; break;
465 case OESATOM_STRINGcxx . . $ OESATOM_STRING.: return node->valcxx . . $ oesui_propnode_t#val..scxx . . $ oesui_atom_t#s.; break;
466 case OESATOM_PTRcxx . . $ OESATOM_PTR.: return 0; break;
467 }
468 return 0;
469 }
470
471
472 void *
473 oesui_props_get_ptrcxx . . $ oesui_props_get_ptr(c7650388727036bf). (oesui_props_tcxx . . $ oesui_props_t# *self, const char *key)
474 {
475 oesui_propnode_tcxx . . $ oesui_propnode_t# *node;
476
477 node = oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305).(self, key);
478 if (!node) return 0;
479 switch (node->valtypecxx . . $ oesui_propnode_t#valtype.)
480 {
481 case OESATOM_INTcxx . . $ OESATOM_INT.: return 0; break;
482 case OESATOM_FLOATcxx . . $ OESATOM_FLOAT.: return 0; break;
483 case OESATOM_SYMBOLcxx . . $ OESATOM_SYMBOL.: /* fallthrough */
484 case OESATOM_STRINGcxx . . $ OESATOM_STRING.: return (void*)(node->valcxx . . $ oesui_propnode_t#val..scxx . . $ oesui_atom_t#s.); break;
485 case OESATOM_PTRcxx . . $ OESATOM_PTR.: return node->valcxx . . $ oesui_propnode_t#val..pcxx . . $ oesui_atom_t#p.; break;
486 }
487 return 0;
488 }
489
490
491
492
493
494 /*****************
495 * Signal message *
496 *****************/
497
498
499 oesui_signal_tcxx . . $ oesui_signal_t# *
500 oesui_signal_initcxx . . $ oesui_signal_init(f8b413e7d0a3d853). (oesui_signal_tcxx . . $ oesui_signal_t# *self, int len)
501 {
502 int chunksize;
503
504 if (!len)
505 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
506 if (!self)
507 {
508 chunksize = sizeof(*self) + (len * sizeof(oesui_atom_tcxx . . $ oesui_atom_t#));
509 self = (oesui_signal_tcxx . . $ oesui_signal_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, chunksize);
510 if (!self) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
511 SET_HEAPEDcxx . . $ `src/ui.cpp:20:9`!(self);
512 }
513 self->lencxx . . $ oesui_signal_t#len. = len;
514 return self;
515 }
516
517
518 void
519 oesui_signal_deletecxx . . $ oesui_signal_delete(f422f32b73787354). (oesui_signal_tcxx . . $ oesui_signal_t# *self)
520 {
521 freecxx . . $ free(bd21765a0afc8e3c).(UISIG_NAMEcxx . . $ `src/ui.h:83:9`!(self));
522 if (IS_HEAPEDcxx . . $ `src/ui.cpp:19:9`!(self))
523 freecxx . . $ free(bd21765a0afc8e3c).(self);
524 }
525
526
527
528
529
530 /*****************
531 * Widget Signals *
532 *****************/
533
534
535 oesui_widget_tcxx . . $ oesui_widget_t# *
536 oesui_signals_initcxx . . $ oesui_signals_init(a4e1d1bc2b106fb3). (oesui_widget_tcxx . . $ oesui_widget_t# *self)
537 {
538 if (!self)
539 {
540 self = (oesui_widget_tcxx . . $ oesui_widget_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, sizeof(*self));
541 if (!self) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
542 SET_HEAPEDcxx . . $ `src/ui.cpp:20:9`!(self);
543 }
544 // memset(self, 0, sizeof(*self));
545 // self->props = oesui_props_set_ptr(self->props, " queue ", 0); /* pending signals */
546 self->propscxx . . $ oesui_widget_t#props. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
547 return self;
548 }
549
550 /* Connect widget to signal. */
551 int
552 oesui_signals_connectcxx . . $ oesui_signals_connect(b35c0b37144f80f2). (oesui_widget_tcxx . . $ oesui_widget_t# *self, const char *signal, int ofs, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
553 {
554 llist_tcxx . . $ llist_t# *chain, *temp, *curr;
555
556 chain = (llist_tcxx . . $ llist_t#*)oesui_props_get_ptrcxx . . $ oesui_props_get_ptr(c7650388727036bf).(self->propscxx . . $ oesui_widget_t#props., signal);
557 if (chain)
558 {
559 if (ofs < 0) ofs = INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!;
560 temp = (llist_tcxx . . $ llist_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, sizeof(*temp));
561 temp->datacxx . . $ llist_t#data. = widget;
562 temp->nextcxx . . $ llist_t#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
563 if (ofs == 0)
564 {
565 temp->nextcxx . . $ llist_t#next. = chain;
566 chain = temp;
567 }
568 else
569 {
570 curr = chain;
571 while (curr->nextcxx . . $ llist_t#next. && (ofs-- > 1))
572 curr = curr->nextcxx . . $ llist_t#next.;
573 temp->nextcxx . . $ llist_t#next. = curr->nextcxx . . $ llist_t#next.;
574 curr->nextcxx . . $ llist_t#next. = temp;
575 }
576 }
577 else
578 { /* empty chain */
579 chain = (llist_tcxx . . $ llist_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, sizeof(*chain));
580 chain->datacxx . . $ llist_t#data. = widget;
581 chain->nextcxx . . $ llist_t#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
582 }
583 self->propscxx . . $ oesui_widget_t#props. = oesui_props_set_ptrcxx . . $ oesui_props_set_ptr(c5b3d00dc9fd23a0).(self->propscxx . . $ oesui_widget_t#props., signal, chain);
584 return 1;
585 }
586
587
588 /* raise signal. */
589 int
590 oesui_signals_raisecxx . . $ oesui_signals_raise(c61fa0e8c4da399d). (oesui_widget_tcxx . . $ oesui_widget_t# *self, int len, const char *signal, ...)
591 {
592 llist_tcxx . . $ llist_t# *chain, *curr, *temp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
593 char *signame;
594 oesui_signal_tcxx . . $ oesui_signal_t# *sig;
595 va_listcxx . . $ va_list# vp;
596 int i, n;
597
598 signame = strdup(signal);
599 chain = (llist_tcxx . . $ llist_t#*)oesui_props_get_ptrcxx . . $ oesui_props_get_ptr(c7650388727036bf).(self->propscxx . . $ oesui_widget_t#props., " queue ");
600
601 if (!(sig = oesui_signal_initcxx . . $ oesui_signal_init(f8b413e7d0a3d853).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, len)))
602 {
603 if (temp) freecxx . . $ free(bd21765a0afc8e3c).(temp);
604 return 0;
605 }
606 UISIG_NAMEcxx . . $ `src/ui.h:83:9`!(sig) = signame;
607 va_startcxx . . $ `<external>/8105065126723003039/stdarg.h:50:9`!(vp, signal);
608 for (i = 1; i < len; i++)
609 {
610 n = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(vp, int);
611 UISIG_ARGcxx . . $ `src/ui.h:82:9`!(sig, 1).icxx . . $ oesui_atom_t#i. = n;
612 }
613 va_endcxx . . $ `<external>/8105065126723003039/stdarg.h:52:9`!(vp);
614
615 if (chain)
616 {
617 //printf("appending signal '%s' (%08X)\n", signame, signame);
618 curr = chain;
619 while (curr->nextcxx . . $ llist_t#next.)
620 curr = curr->nextcxx . . $ llist_t#next.;
621 temp = (llist_tcxx . . $ llist_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, sizeof(*temp));
622 if (!temp) return 0;
623 // temp->data = signame;
624 temp->datacxx . . $ llist_t#data. = sig;
625 temp->nextcxx . . $ llist_t#next. = curr->nextcxx . . $ llist_t#next.;
626 curr->nextcxx . . $ llist_t#next. = temp;
627 }
628 else
629 { /* empty chain */
630 //printf("inserting signal '%s' (%08X)\n", signame, signame);
631 chain = (llist_tcxx . . $ llist_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, sizeof(*chain));
632 // chain->data = signame;
633 chain->datacxx . . $ llist_t#data. = sig;
634 chain->nextcxx . . $ llist_t#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
635 }
636 self->propscxx . . $ oesui_widget_t#props. = oesui_props_set_ptrcxx . . $ oesui_props_set_ptr(c5b3d00dc9fd23a0).(self->propscxx . . $ oesui_widget_t#props., " queue ", chain);
637 return 1;
638 }
639
640
641 /* propagate signals. */
642 int
643 oesui_signals_cyclecxx . . $ oesui_signals_cycle(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *signals)
644 {
645 char *signame;
646 llist_tcxx . . $ llist_t# *queue, *nque, *chain;
647 oesui_widget_tcxx . . $ oesui_widget_t# *widget;
648 oesui_signal_tcxx . . $ oesui_signal_t# *sig;
649 int n;
650
651 //printf("signals_cycle...\n");
652 queue = (llist_tcxx . . $ llist_t#*)oesui_props_get_ptrcxx . . $ oesui_props_get_ptr(c7650388727036bf).(signals->propscxx . . $ oesui_widget_t#props., " queue ");
653 //printf("queue => %08X\n", queue);
654 if (!queue) return 0;
655 nque = queue->nextcxx . . $ llist_t#next.;
656 signals->propscxx . . $ oesui_widget_t#props. = oesui_props_set_ptrcxx . . $ oesui_props_set_ptr(c5b3d00dc9fd23a0).(signals->propscxx . . $ oesui_widget_t#props., " queue ", nque);
657 //printf("next in queue = %08X\n", nque);
658 // signame = (char*)(queue->data);
659 sig = (oesui_signal_tcxx . . $ oesui_signal_t#*)(queue->datacxx . . $ llist_t#data.);
660 signame = UISIG_NAMEcxx . . $ `src/ui.h:83:9`!(sig);
661 //printf("signame => (%08X) %s\n", signame, signame);
662 if (!signame) return 0;
663
664 //printf("Propagating signal '%s'\n", signame);
665 chain = (llist_tcxx . . $ llist_t#*)oesui_props_get_ptrcxx . . $ oesui_props_get_ptr(c7650388727036bf).(signals->propscxx . . $ oesui_widget_t#props., signame);
666 n = 0;
667 for(; chain; chain = chain->nextcxx . . $ llist_t#next.)
668 {
669 widget = (oesui_widget_tcxx . . $ oesui_widget_t#*)(chain->datacxx . . $ llist_t#data.);
670 if (oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "enabled"))
671 n = oesui_widget_signalcxx . . $ oesui_widget_signal(7199d99e2b5f4e49).(gui, widget, sig);
672 if (n) break; //return 1;
673 }
674
675 /* unblocked signal. */
676 if (n == 0)
677 {
678 //printf("unblocked signal '%s'\n", signame);
679 n = gui->sighandlercxx . . $ oesui_t#sighandler.(gui, sig);
680 }
681
682 // free(signame);
683 oesui_signal_deletecxx . . $ oesui_signal_delete(f422f32b73787354).(sig);
684 freecxx . . $ free(bd21765a0afc8e3c).(queue); /* Next-in-queue already saved to property */
685 return n;
686 }
687
688
689
690
691
692 /***********************************
693 * Translation of data into widgets *
694 ***********************************/
695
696
697 llist_tcxx . . $ llist_t# *
698 sexp_to_widgetlistcxx . . $ sexp_to_widgetlist(592f72d00a6d9fdd). (oesui_tcxx . . $ oesui_t# *gui, sexp_tcxx . . $ sexp_t# *descrlist)
699 {
700 llist_tcxx . . $ llist_t# *wlist, *tail = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
701 oesui_widget_tcxx . . $ oesui_widget_t# *widget;
702 sexp_tcxx . . $ sexp_t# *descr;
703 //char buf[1024];
704
705 //print_sexp(buf, sizeof(buf), descrlist);
706 //printf("descrlist = %s\n", buf);
707 wlist = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
708 for (; descrlist; descrlist = descrlist->nextcxx . . $ elt#next.)
709 {
710 descr = descrlist->listcxx . . $ elt#list.;
711 widget = sexp_to_widgetcxx . . $ sexp_to_widget(d6e1caa4f9ad8b35).(gui, descr);
712 // wlist = llist_add(wlist, widget);
713 if (!wlist)
714 {
715 wlist = (llist_tcxx . . $ llist_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, sizeof(*wlist));
716 tail = wlist;
717 wlist->datacxx . . $ llist_t#data. = widget;
718 wlist->nextcxx . . $ llist_t#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
719 }
720 else
721 {
722 tail->nextcxx . . $ llist_t#next. = (llist_tcxx . . $ llist_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, sizeof(*wlist));
723 tail->nextcxx . . $ llist_t#next.->datacxx . . $ llist_t#data. = widget;
724 tail->nextcxx . . $ llist_t#next.->nextcxx . . $ llist_t#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
725 tail = tail->nextcxx . . $ llist_t#next.;
726 }
727 }
728 return wlist;
729 }
730
731
732 oesui_widget_tcxx . . $ oesui_widget_t# *
733 sexp_to_widgetcxx . . $ sexp_to_widget(d6e1caa4f9ad8b35). (oesui_tcxx . . $ oesui_t# *gui, sexp_tcxx . . $ sexp_t# *descrlist)
734 {
735 sexp_tcxx . . $ sexp_t# *alist, *pair;
736 llist_tcxx . . $ llist_t# *wlist;
737 oesui_widget_tcxx . . $ oesui_widget_t# *widget;
738 const char *key, *val;
739 //char buf[1024];
740
741 //print_sexp(buf, sizeof(buf), descrlist);
742 //printf("widgetlist = %s\n", buf);
743 widget = (oesui_widget_tcxx . . $ oesui_widget_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, sizeof(*widget));
744 widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_intcxx . . $ oesui_props_set_int(bdf2c61a8b8c2010).(widget->propscxx . . $ oesui_widget_t#props., "enabled", 0);
745 /* alist */
746 alist = descrlist;
747 //print_sexp(buf, sizeof(buf), alist);
748 //printf("alist = %s\n", buf);
749 if ((descrlist->tycxx . . $ elt#ty. == SEXP_LISTcxx . . $ SEXP_LIST.) && (descrlist->nextcxx . . $ elt#next. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!))
750 alist = descrlist->listcxx . . $ elt#list.;
751 for (; alist; alist = alist->nextcxx . . $ elt#next.)
752 {
753 //print_sexp(buf, sizeof(buf), alist);
754 //printf("attrib pair = %s\n", buf);
755 if (alist->tycxx . . $ elt#ty. != SEXP_LISTcxx . . $ SEXP_LIST.) continue;
756 pair = alist->listcxx . . $ elt#list.;
757 key = pair->valcxx . . $ elt#val.;
758 if (0);
759 else if (0 == strcasecmp(key, "connect"))
760 {
761 sexp_tcxx . . $ sexp_t# *sigs;
762 sigs = pair->nextcxx . . $ elt#next.;
763 for (sigs = pair->nextcxx . . $ elt#next.; sigs; sigs = sigs->nextcxx . . $ elt#next.)
764 {
765 val = sigs->valcxx . . $ elt#val.;
766 //printf("will connect to signal '%s'\n", val);
767 oesui_signals_connectcxx . . $ oesui_signals_connect(b35c0b37144f80f2).(gui->signalscxx . . $ oesui_t#signals., val, -1, widget);
768 }
769 // widget->props = oesui_props_set_ptr(widget->props, "connect", sigs);
770 }
771 else if (0 == strcasecmp(key, "container"))
772 {
773 //printf("container...\n");
774 wlist = sexp_to_widgetlistcxx . . $ sexp_to_widgetlist(592f72d00a6d9fdd).(gui, pair->nextcxx . . $ elt#next.);
775 widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_ptrcxx . . $ oesui_props_set_ptr(c5b3d00dc9fd23a0).(widget->propscxx . . $ oesui_widget_t#props., key, wlist);
776 }
777 else
778 {
779 /* normal key/value pair */
780 val = "";
781 if (pair->nextcxx . . $ elt#next.)
782 val = pair->nextcxx . . $ elt#next.->valcxx . . $ elt#val.;
783 //printf("attrib %s = %s || widget->props = %08X\n", key, val, widget->props);
784 widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_stringcxx . . $ oesui_props_set_string(4ba516a21339f116).(widget->propscxx . . $ oesui_widget_t#props., key, strdup(val));
785 }
786 }
787 //printf("proplist dump:\n");
788 #if 0
789 oesui_propnode_t *prop;
790 for (wlist = widget->props->list; wlist; wlist = wlist->next)
791 {
792 prop = (oesui_propnode_t*)(wlist->data);
793 printf(" key = %s => %s\n", prop->key, prop->valtype == OESATOM_STRING ? prop->val.s : "-");
794 }
795 #endif /* 0 */
796 //printf("/done => %08X.%08X\n", widget, widget->props);
797 return widget;
798 }
799
800
801
802
803
804 /*************************
805 * um... support/utility? *
806 *************************/
807
808
809 int
810 oesui_pointedcxx . . $ oesui_pointed(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
811 {
812 int x0, x1, y0, y1; /* boundary check */
813 int px, py; /* pointer location */
814
815 x0 = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "x");
816 x1 = x0 + oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "w");
817 y0 = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "y");
818 y1 = y0 + oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "h");
819 px = gui->pxcxx . . $ oesui_t#px.;
820 py = gui->pycxx . . $ oesui_t#py.;
821 //printf("has_focus: X=%d|%d|%d Y=%d|%d|%d\n", x0, px, x1, y0, py, y1);
822 if ((x0 < px) && (px < x1) && (y0 < py) && (py < y1))
823 return 1;
824 return 0;
825 }
826
827
828
829
830
831 /*******************
832 * Ownerdraw widget *
833 *******************/
834
835
836 int
837 oesui_ownerdraw_paintcxx . . $ oesui_ownerdraw_paint(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
838 {
839 SDL_Rect r;
840 const char *objtype = 0;
841 int rendertime, loadtime;
842
843 objtype = oesui_props_get_stringcxx . . $ oesui_props_get_string(2e7e486a62abc7cd).(widget->propscxx . . $ oesui_widget_t#props., "tag");
844 if (!objtype) return 0;
845 rendertime = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "rendertime");
846 loadtime = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(gui->toplevelcxx . . $ oesui_t#toplevel.->propscxx . . $ oesui_widget_t#props., "loadtime");
847 if ((loadtime) && (rendertime >= loadtime))
848 return 0;
849 //printf("Drawing ownertype '%s' (load @ %d, lastrender @ %d)\n", objtype, loadtime, rendertime);
850 r.x = r.y = r.w = r.h = 0;
851 oesui_signals_raisecxx . . $ oesui_signals_raise(c61fa0e8c4da399d).(gui->signalscxx . . $ oesui_t#signals., 5, objtype, r.x, r.y, r.w, r.h);
852 rendertime = SDL_GetTicks();
853 widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_intcxx . . $ oesui_props_set_int(bdf2c61a8b8c2010).(widget->propscxx . . $ oesui_widget_t#props., "rendertime", rendertime);
854 return 1;
855 }
856
857
858
859
860
861 /***************
862 * Label widget *
863 ***************/
864
865
866 int
867 oesui_label_paintcxx . . $ oesui_label_paint(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
868 {
869 oesui_propnode_tcxx . . $ oesui_propnode_t# *prop;
870 int col; /* color */
871 char text[256];
872 SDL_Rect br;
873
874 prop = oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305).(widget->propscxx . . $ oesui_widget_t#props., "text");
875 if (!prop) return 0;
876 *text = 0;
877 switch (prop->valtypecxx . . $ oesui_propnode_t#valtype.)
878 {
879 case OESATOM_INTcxx . . $ OESATOM_INT.:
880 snprintf(text, sizeof(text), "%d", prop->valcxx . . $ oesui_propnode_t#val..icxx . . $ oesui_atom_t#i.);
881 break;
882 case OESATOM_FLOATcxx . . $ OESATOM_FLOAT.:
883 snprintf(text, sizeof(text), "%f", prop->valcxx . . $ oesui_propnode_t#val..fcxx . . $ oesui_atom_t#f.);
884 break;
885 case OESATOM_SYMBOLcxx . . $ OESATOM_SYMBOL.:
886 snprintf(text, sizeof(text), "%s", prop->valcxx . . $ oesui_propnode_t#val..symcxx . . $ oesui_atom_t#sym.);
887 break;
888 case OESATOM_STRINGcxx . . $ OESATOM_STRING.:
889 snprintf(text, sizeof(text), "%s", prop->valcxx . . $ oesui_propnode_t#val..scxx . . $ oesui_atom_t#s.);
890 break;
891 }
892 if (!*text)
893 return 0;
894
895 br.x = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "x");
896 br.y = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "y");
897 br.w = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "w");
898 br.h = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "h");
899 col = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "color");
900
901 printcxx . . $ print(e6b86272566182ce).(br.x, br.y, col, text);
902
903 return 1;
904 }
905
906
907
908
909
910 /***************
911 * Image widget *
912 ***************/
913
914
915 int
916 oesui_image_paintcxx . . $ oesui_image_paint(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
917 {
918 oesui_propnode_tcxx . . $ oesui_propnode_t# *prop;
919 SDL_Surface *img = 0;
920 SDL_Rect br;
921
922 prop = oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305).(widget->propscxx . . $ oesui_widget_t#props., "image");
923 if (!prop) return 0;
924 switch (prop->valtypecxx . . $ oesui_propnode_t#valtype.)
925 {
926 case OESATOM_INTcxx . . $ OESATOM_INT.:
927 img = (SDL_Surface*)assetcache_idxcxx . . $ assetcache_idx(56e4b5ed68cb5597).(&assetcache1cxx . . $ assetcache1., prop->valcxx . . $ oesui_propnode_t#val..icxx . . $ oesui_atom_t#i.);
928 break;
929 case OESATOM_SYMBOLcxx . . $ OESATOM_SYMBOL.:
930 img = imgasset_registercxx . . $ imgasset_register(998637ddb3131754).(prop->valcxx . . $ oesui_propnode_t#val..symcxx . . $ oesui_atom_t#sym.);
931 break;
932 case OESATOM_STRINGcxx . . $ OESATOM_STRING.:
933 img = imgasset_registercxx . . $ imgasset_register(998637ddb3131754).(prop->valcxx . . $ oesui_propnode_t#val..scxx . . $ oesui_atom_t#s.);
934 break;
935 case OESATOM_PTRcxx . . $ OESATOM_PTR.:
936 img = (SDL_Surface*)(prop->valcxx . . $ oesui_propnode_t#val..pcxx . . $ oesui_atom_t#p.);
937 break;
938 }
939 if (!img) return 0;
940 widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_ptrcxx . . $ oesui_props_set_ptr(c5b3d00dc9fd23a0).(widget->propscxx . . $ oesui_widget_t#props., "image", img);
941
942 br.x = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "x");
943 br.y = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "y");
944 br.w = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "w");
945 br.h = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "h");
946
947 if (!br.w)
948 {
949 br.w = img->w;
950 widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_intcxx . . $ oesui_props_set_int(bdf2c61a8b8c2010).(widget->propscxx . . $ oesui_widget_t#props., "w", img->w);
951 }
952 if (!br.h)
953 {
954 br.h = img->h;
955 widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_intcxx . . $ oesui_props_set_int(bdf2c61a8b8c2010).(widget->propscxx . . $ oesui_widget_t#props., "h", img->h);
956 }
957
958 SDL_BlitSurfacecxx . . $ `<external>/3508485105195885937/SDL_video.h:262:9`!(img, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, gui->screencxx . . $ oesui_t#screen., &br);
959
960 return 0;
961 }
962
963
964 int
965 oesui_image_updatecxx . . $ oesui_image_update(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
966 {
967 //const char *objname;
968
969 // objname = oesui_props_get_string(widget->props, "name");
970 // if (!objname) return 0;
971 // if (0);
972 return 0;
973 }
974
975
976
977
978
979 /****************
980 * Button widget *
981 ****************/
982
983
984 int
985 oesui_button_paintcxx . . $ oesui_button_paint(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
986 {
987 SDL_Rect br = { 0, };
988 SDL_Surface *img = 0;
989 int focus = 0;
990 const char *field = 0;
991 //const char *imgname = 0;
992 //void *imgobj;
993 oesui_propnode_tcxx . . $ oesui_propnode_t# *prop;
994
995 // img = gButton.fullscreen;
996 // img = (SDL_Surface*)imgobj;
997 // imgobj = oesui_props_get_ptr(widget->props, field);
998 // imgname = oesui_props_get_string(widget->props, field);
999 focus = oesui_pointedcxx . . $ oesui_pointed(eb891d6b5a0ca503).(gui, widget);
1000 field = focus ? "himage" : "image";
1001 prop = oesui_props_getcxx . . $ oesui_props_get(6dace68e90207305).(widget->propscxx . . $ oesui_widget_t#props., field);
1002 if (!prop) return 0;
1003 switch (prop->valtypecxx . . $ oesui_propnode_t#valtype.)
1004 {
1005 case OESATOM_INTcxx . . $ OESATOM_INT.:
1006 img = (SDL_Surface*)assetcache_idxcxx . . $ assetcache_idx(56e4b5ed68cb5597).(&assetcache1cxx . . $ assetcache1., prop->valcxx . . $ oesui_propnode_t#val..icxx . . $ oesui_atom_t#i.);
1007 break;
1008 case OESATOM_SYMBOLcxx . . $ OESATOM_SYMBOL.:
1009 img = imgasset_registercxx . . $ imgasset_register(998637ddb3131754).(prop->valcxx . . $ oesui_propnode_t#val..symcxx . . $ oesui_atom_t#sym.);
1010 break;
1011 case OESATOM_STRINGcxx . . $ OESATOM_STRING.:
1012 img = imgasset_registercxx . . $ imgasset_register(998637ddb3131754).(prop->valcxx . . $ oesui_propnode_t#val..scxx . . $ oesui_atom_t#s.);
1013 break;
1014 case OESATOM_PTRcxx . . $ OESATOM_PTR.:
1015 img = (SDL_Surface*)(prop->valcxx . . $ oesui_propnode_t#val..pcxx . . $ oesui_atom_t#p.);
1016 break;
1017 }
1018 if (!img) return 0;
1019 widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_ptrcxx . . $ oesui_props_set_ptr(c5b3d00dc9fd23a0).(widget->propscxx . . $ oesui_widget_t#props., field, img);
1020
1021 br.x = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "x");
1022 br.y = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "y");
1023 br.w = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "w");
1024 br.h = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "h");
1025
1026 if (!br.w)
1027 {
1028 br.w = img->w;
1029 widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_intcxx . . $ oesui_props_set_int(bdf2c61a8b8c2010).(widget->propscxx . . $ oesui_widget_t#props., "w", img->w);
1030 }
1031 if (!br.h)
1032 {
1033 br.h = img->h;
1034 widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_intcxx . . $ oesui_props_set_int(bdf2c61a8b8c2010).(widget->propscxx . . $ oesui_widget_t#props., "h", img->h);
1035 }
1036
1037 //printf("button at (%d, %d), %d x %d\n", br.x, br.y, br.w, br.h);
1038
1039 SDL_BlitSurfacecxx . . $ `<external>/3508485105195885937/SDL_video.h:262:9`!(img, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, gui->screencxx . . $ oesui_t#screen., &br);
1040
1041 return 1;
1042 }
1043
1044
1045 int
1046 oesui_button_updatecxx . . $ oesui_button_update(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
1047 {
1048 const char *bname;
1049 SDL_Surface *img = 0, *himg = 0;
1050 const char *imgname = 0, *himgname = 0;
1051
1052 //printf("Button Update\n");
1053 bname = oesui_props_get_stringcxx . . $ oesui_props_get_string(2e7e486a62abc7cd).(widget->propscxx . . $ oesui_widget_t#props., "name");
1054 if (!bname) return 0;
1055 if (0);
1056 else if (0 == strcmp(bname, "Fullscreen"))
1057 {
1058 imgname = gPrefscxx . . $ gPrefs..fullscreencxx . . $ prefs_#fullscreen. ? "fullscreen.png" : "window.png";
1059 himgname = gPrefscxx . . $ gPrefs..fullscreencxx . . $ prefs_#fullscreen. ? "fullscreenh.png" : "windowh.png";
1060 }
1061 else if (0 == strcmp(bname, "Audio"))
1062 {
1063 imgname = gPrefscxx . . $ gPrefs..audiocxx . . $ prefs_#audio. ? "audioon.png" : "audiooff.png";
1064 himgname = gPrefscxx . . $ gPrefs..audiocxx . . $ prefs_#audio. ? "audioonh.png" : "audiooffh.png";
1065 //printf("Audio button should currently show: %d\n", gPrefs.audio);
1066 }
1067 else if (0 == strcmp(bname, "Difficulty"))
1068 {
1069 switch (gPrefscxx . . $ gPrefs..difficultycxx . . $ prefs_#difficulty.)
1070 {
1071 case 1: imgname = "easy.png"; himgname = "easyh.png"; break;
1072 case 2: imgname = "medium.png"; himgname = "mediumh.png"; break;
1073 case 3: default: imgname = "hard.png"; himgname = "hardh.png"; break;
1074 }
1075 }
1076 else if (0 == strcmp(bname, "Quit"))
1077 {
1078 /* do nothing */
1079 }
1080 if (imgname) img = imgasset_registercxx . . $ imgasset_register(998637ddb3131754).(imgname);
1081 if (himgname) himg = imgasset_registercxx . . $ imgasset_register(998637ddb3131754).(himgname);
1082 if (img) widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_ptrcxx . . $ oesui_props_set_ptr(c5b3d00dc9fd23a0).(widget->propscxx . . $ oesui_widget_t#props., "image", img);
1083 if (himg) widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_ptrcxx . . $ oesui_props_set_ptr(c5b3d00dc9fd23a0).(widget->propscxx . . $ oesui_widget_t#props., "himage", himg);
1084 // if (0 == oesui_props_get_int(widget->props, "w"))
1085 // widget->props = oesui_props_set_int(widget->props, "w", img->w);
1086 // if (0 == oesui_props_get_int(widget->props, "h"))
1087 // widget->props = oesui_props_set_int(widget->props, "h", img->h);
1088
1089 return 0;
1090 }
1091
1092
1093 int
1094 oesui_button_signalcxx . . $ oesui_button_signal(7199d99e2b5f4e49). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget, oesui_signal_tcxx . . $ oesui_signal_t# *sig)
1095 {
1096 const char *spit;
1097 int focus;
1098
1099 if (0);
1100 else if (0 == strcmp(UISIG_NAMEcxx . . $ `src/ui.h:83:9`!(sig), "click"))
1101 {
1102 //printf("button signal CLICK\n");
1103 if (!(oesui_pointedcxx . . $ oesui_pointed(eb891d6b5a0ca503).(gui, widget)))
1104 return 0;
1105 spit = oesui_props_get_stringcxx . . $ oesui_props_get_string(2e7e486a62abc7cd).(widget->propscxx . . $ oesui_widget_t#props., "on-click");
1106 if (!spit) return 0;
1107 // oesui_signals_raise(gui->signals, spit);
1108 oesui_signals_raisecxx . . $ oesui_signals_raise(c61fa0e8c4da399d).(gui->signalscxx . . $ oesui_t#signals., 1, spit);
1109 }
1110 else if (0 == strcmp(UISIG_NAMEcxx . . $ `src/ui.h:83:9`!(sig), "focus"))
1111 {
1112 focus = oesui_props_get_intcxx . . $ oesui_props_get_int(acccd196d28128ee).(widget->propscxx . . $ oesui_widget_t#props., "focus");
1113 if (oesui_pointedcxx . . $ oesui_pointed(eb891d6b5a0ca503).(gui, widget))
1114 {
1115 /* in focus */
1116 if (focus == 0)
1117 {
1118 /* just came into focus. */
1119 }
1120 }
1121 else
1122 {
1123 /* not in focus. */
1124 if (focus)
1125 {
1126 /* just lost focus. */
1127 }
1128 }
1129 }
1130 return 0;
1131 }
1132
1133
1134
1135
1136
1137 /******************
1138 * Toplevel widget *
1139 ******************/
1140
1141
1142 int
1143 oesui_toplevel_paintcxx . . $ oesui_toplevel_paint(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
1144 {
1145 llist_tcxx . . $ llist_t# *container;
1146 oesui_widget_tcxx . . $ oesui_widget_t# *child;
1147
1148 container = (llist_tcxx . . $ llist_t#*)oesui_props_get_ptrcxx . . $ oesui_props_get_ptr(c7650388727036bf).(widget->propscxx . . $ oesui_widget_t#props., "container");
1149 if (!container) return 0;
1150 for (; container; container = container->nextcxx . . $ llist_t#next.)
1151 {
1152 child = (oesui_widget_tcxx . . $ oesui_widget_t#*)(container->datacxx . . $ llist_t#data.);
1153 oesui_widget_paintcxx . . $ oesui_widget_paint(eb891d6b5a0ca503).(gui, child);
1154 }
1155 return 0;
1156 }
1157
1158
1159 int
1160 oesui_toplevel_updatecxx . . $ oesui_toplevel_update(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
1161 {
1162 llist_tcxx . . $ llist_t# *container;
1163 oesui_widget_tcxx . . $ oesui_widget_t# *child;
1164
1165 if (!widget) return 0;
1166 container = (llist_tcxx . . $ llist_t#*)oesui_props_get_ptrcxx . . $ oesui_props_get_ptr(c7650388727036bf).(widget->propscxx . . $ oesui_widget_t#props., "container");
1167 for (; container; container = container->nextcxx . . $ llist_t#next.)
1168 {
1169 child = (oesui_widget_tcxx . . $ oesui_widget_t#*)(container->datacxx . . $ llist_t#data.);
1170 oesui_widget_updatecxx . . $ oesui_widget_update(eb891d6b5a0ca503).(gui, child);
1171 }
1172 return 1;
1173 }
1174
1175
1176 int
1177 oesui_toplevel_signalcxx . . $ oesui_toplevel_signal(7199d99e2b5f4e49). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget, oesui_signal_tcxx . . $ oesui_signal_t# *sig)
1178 {
1179 const char *emit;
1180
1181 if (0);
1182 else if (0 == strcmp(UISIG_NAMEcxx . . $ `src/ui.h:83:9`!(sig), "esc"))
1183 {
1184 emit = oesui_props_get_stringcxx . . $ oesui_props_get_string(2e7e486a62abc7cd).(widget->propscxx . . $ oesui_widget_t#props., "on-esc");
1185 if (!emit) return 0;
1186 //printf("Toplevel got signal '%s', will emit '%s'\n", sig->data[0].s, emit);
1187 // oesui_signals_raise(gui->signals, emit);
1188 oesui_signals_raisecxx . . $ oesui_signals_raise(c61fa0e8c4da399d).(gui->signalscxx . . $ oesui_t#signals., 1, emit);
1189 }
1190 else if (0 == strcmp(UISIG_NAMEcxx . . $ `src/ui.h:83:9`!(sig), "cycle-focus"))
1191 {
1192 /* do nothing */
1193 }
1194 return 0;
1195 }
1196
1197
1198 int
1199 oesui_toplevel_opencxx . . $ oesui_toplevel_open(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
1200 {
1201 llist_tcxx . . $ llist_t# *container;
1202 oesui_widget_tcxx . . $ oesui_widget_t# *child;
1203 int loadtime;
1204
1205 loadtime = SDL_GetTicks();
1206 //printf("LOADED MENU '%s' at %d\n", menuname, loadtime);
1207 widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_intcxx . . $ oesui_props_set_int(bdf2c61a8b8c2010).(widget->propscxx . . $ oesui_widget_t#props., "loadtime", loadtime);
1208 widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_intcxx . . $ oesui_props_set_int(bdf2c61a8b8c2010).(widget->propscxx . . $ oesui_widget_t#props., "enabled", 1);
1209
1210 container = (llist_tcxx . . $ llist_t#*)oesui_props_get_ptrcxx . . $ oesui_props_get_ptr(c7650388727036bf).(widget->propscxx . . $ oesui_widget_t#props., "container");
1211 if (!container) return 0;
1212 for (; container; container = container->nextcxx . . $ llist_t#next.)
1213 {
1214 child = (oesui_widget_tcxx . . $ oesui_widget_t#*)(container->datacxx . . $ llist_t#data.);
1215 child->propscxx . . $ oesui_widget_t#props. = oesui_props_set_intcxx . . $ oesui_props_set_int(bdf2c61a8b8c2010).(child->propscxx . . $ oesui_widget_t#props., "enabled", 1);
1216 }
1217 oesui_widget_updatecxx . . $ oesui_widget_update(eb891d6b5a0ca503).(gui, widget);
1218 return 0;
1219 }
1220
1221
1222 int
1223 oesui_toplevel_closecxx . . $ oesui_toplevel_close(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
1224 {
1225 llist_tcxx . . $ llist_t# *container;
1226 oesui_widget_tcxx . . $ oesui_widget_t# *child;
1227
1228 oesui_widget_updatecxx . . $ oesui_widget_update(eb891d6b5a0ca503).(gui, widget);
1229 container = (llist_tcxx . . $ llist_t#*)oesui_props_get_ptrcxx . . $ oesui_props_get_ptr(c7650388727036bf).(widget->propscxx . . $ oesui_widget_t#props., "container");
1230 widget->propscxx . . $ oesui_widget_t#props. = oesui_props_set_intcxx . . $ oesui_props_set_int(bdf2c61a8b8c2010).(widget->propscxx . . $ oesui_widget_t#props., "enabled", 0);
1231 if (!container) return 0;
1232 for (; container; container = container->nextcxx . . $ llist_t#next.)
1233 {
1234 child = (oesui_widget_tcxx . . $ oesui_widget_t#*)(container->datacxx . . $ llist_t#data.);
1235 child->propscxx . . $ oesui_widget_t#props. = oesui_props_set_intcxx . . $ oesui_props_set_int(bdf2c61a8b8c2010).(child->propscxx . . $ oesui_widget_t#props., "enabled", 0);
1236 }
1237 return 0;
1238 }
1239
1240
1241
1242
1243
1244 /*********************************/
1245 /* Generalized widget functions. */
1246 /*********************************/
1247
1248
1249 int
1250 oesui_widget_paintcxx . . $ oesui_widget_paint(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
1251 {
1252 const char *objtype;
1253 int (*paintfunc)(oesui_tcxx . . $ oesui_t# *, oesui_widget_tcxx . . $ oesui_widget_t#*);
1254
1255 objtype = oesui_props_get_stringcxx . . $ oesui_props_get_string(2e7e486a62abc7cd).(widget->propscxx . . $ oesui_widget_t#props., "type");
1256 if (!objtype) return 0;
1257 //printf("painting objtype '%s'\n", objtype);
1258 paintfunc = 0;
1259 if (0 == strcasecmp(objtype, "toplevel"))
1260 paintfunc = oesui_toplevel_paintcxx . . $ oesui_toplevel_paint(eb891d6b5a0ca503).;
1261 else if (0 == strcasecmp(objtype, "button"))
1262 paintfunc = oesui_button_paintcxx . . $ oesui_button_paint(eb891d6b5a0ca503).;
1263 else if (0 == strcasecmp(objtype, "image"))
1264 paintfunc = oesui_image_paintcxx . . $ oesui_image_paint(eb891d6b5a0ca503).;
1265 else if (0 == strcasecmp(objtype, "ownerdraw"))
1266 paintfunc = oesui_ownerdraw_paintcxx . . $ oesui_ownerdraw_paint(eb891d6b5a0ca503).;
1267 else if (0 == strcasecmp(objtype, "label"))
1268 paintfunc = oesui_label_paintcxx . . $ oesui_label_paint(eb891d6b5a0ca503).;
1269 if (paintfunc)
1270 return paintfunc(gui, widget);
1271 return 0;
1272 }
1273
1274
1275 int
1276 oesui_widget_updatecxx . . $ oesui_widget_update(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
1277 {
1278 const char *objtype;
1279 int (*updatefunc)(oesui_tcxx . . $ oesui_t# *, oesui_widget_tcxx . . $ oesui_widget_t# *) = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1280
1281 if (!widget) return 0;
1282 objtype = oesui_props_get_stringcxx . . $ oesui_props_get_string(2e7e486a62abc7cd).(widget->propscxx . . $ oesui_widget_t#props., "type");
1283 if (!objtype) return 0;
1284 if (0 == strcasecmp(objtype, "toplevel"))
1285 updatefunc = oesui_toplevel_updatecxx . . $ oesui_toplevel_update(eb891d6b5a0ca503).;
1286 else if (0 == strcasecmp(objtype, "button"))
1287 updatefunc = oesui_button_updatecxx . . $ oesui_button_update(eb891d6b5a0ca503).;
1288 if (updatefunc)
1289 return updatefunc(gui, widget);
1290 return 0;
1291 }
1292
1293
1294 int
1295 oesui_widget_signalcxx . . $ oesui_widget_signal(7199d99e2b5f4e49). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget, oesui_signal_tcxx . . $ oesui_signal_t# *sig)
1296 {
1297 const char *objtype;
1298 int (*sigfunc)(oesui_tcxx . . $ oesui_t#*, oesui_widget_tcxx . . $ oesui_widget_t#*, oesui_signal_tcxx . . $ oesui_signal_t# *) = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1299
1300 objtype = oesui_props_get_stringcxx . . $ oesui_props_get_string(2e7e486a62abc7cd).(widget->propscxx . . $ oesui_widget_t#props., "type");
1301 //printf("widget_signal on %s\n", objtype);
1302 if (!objtype) return 0;
1303 if (0);
1304 else if (0 == strcasecmp(objtype, "toplevel"))
1305 sigfunc = oesui_toplevel_signalcxx . . $ oesui_toplevel_signal(7199d99e2b5f4e49).;
1306 else if (0 == strcasecmp(objtype, "button"))
1307 sigfunc = oesui_button_signalcxx . . $ oesui_button_signal(7199d99e2b5f4e49).;
1308 if (sigfunc)
1309 return sigfunc(gui, widget, sig);
1310 return 0;
1311 }
1312
1313
1314 int
1315 oesui_widget_opencxx . . $ oesui_widget_open(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
1316 {
1317 const char *objtype;
1318 int (*openfunc)(oesui_tcxx . . $ oesui_t# *, oesui_widget_tcxx . . $ oesui_widget_t# *) = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1319
1320 objtype = oesui_props_get_stringcxx . . $ oesui_props_get_string(2e7e486a62abc7cd).(widget->propscxx . . $ oesui_widget_t#props., "type");
1321 if (!objtype) return 0;
1322 if (0);
1323 else if (0 == strcasecmp(objtype, "toplevel"))
1324 openfunc = oesui_toplevel_opencxx . . $ oesui_toplevel_open(eb891d6b5a0ca503).;
1325 if (openfunc)
1326 return openfunc(gui, widget);
1327 return 0;
1328 }
1329
1330
1331 int
1332 oesui_widget_closecxx . . $ oesui_widget_close(eb891d6b5a0ca503). (oesui_tcxx . . $ oesui_t# *gui, oesui_widget_tcxx . . $ oesui_widget_t# *widget)
1333 {
1334 const char *objtype;
1335 int (*closefunc)(oesui_tcxx . . $ oesui_t# *, oesui_widget_tcxx . . $ oesui_widget_t# *) = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1336
1337 objtype = oesui_props_get_stringcxx . . $ oesui_props_get_string(2e7e486a62abc7cd).(widget->propscxx . . $ oesui_widget_t#props., "type");
1338 if (!objtype) return 0;
1339 if (0);
1340 else if (0 == strcasecmp(objtype, "toplevel"))
1341 closefunc = oesui_toplevel_closecxx . . $ oesui_toplevel_close(eb891d6b5a0ca503).;
1342 if (closefunc)
1343 return closefunc(gui, widget);
1344 return 0;
1345 }
1346
1347
1348
1349
1350
1351 /************
1352 * UI System *
1353 ************/
1354
1355
1356 /* Inject event into UI system. */
1357 int
1358 oesui_eventcxx . . $ oesui_event(d20ac4a2bf684293). (oesui_tcxx . . $ oesui_t# *self, int evtype, int parm)
1359 {
1360 const char *objtype;
1361
1362 objtype = oesui_props_get_stringcxx . . $ oesui_props_get_string(2e7e486a62abc7cd).(self->toplevelcxx . . $ oesui_t#toplevel.->propscxx . . $ oesui_widget_t#props., "type");
1363 //printf("toplevel objtype (%08X) = %s\n", self->toplevel, objtype);
1364
1365 switch (evtype)
1366 {
1367 case OESUI_UPDATEcxx . . $ OESUI_UPDATE.:
1368 oesui_widget_updatecxx . . $ oesui_widget_update(eb891d6b5a0ca503).(self, self->toplevelcxx . . $ oesui_t#toplevel.);
1369 break;
1370 case OESUI_REFRESHcxx . . $ OESUI_REFRESH.:
1371 oesui_widget_paintcxx . . $ oesui_widget_paint(eb891d6b5a0ca503).(self, self->toplevelcxx . . $ oesui_t#toplevel.);
1372 break;
1373 case OESUI_WHORIZcxx . . $ OESUI_WHORIZ.:
1374 self->pxcxx . . $ oesui_t#px. = 0;
1375 /* fallthrough */
1376 case OESUI_MHORIZcxx . . $ OESUI_MHORIZ.:
1377 self->pxcxx . . $ oesui_t#px. += parm;
1378 if (self->pxcxx . . $ oesui_t#px. > self->screencxx . . $ oesui_t#screen.->w)
1379 self->pxcxx . . $ oesui_t#px. = self->screencxx . . $ oesui_t#screen.->w;
1380 if (self->pxcxx . . $ oesui_t#px. < 0)
1381 self->pxcxx . . $ oesui_t#px. = 0;
1382 //printf("Pointer @ (%d, %d)\n", self->px, self->py);
1383 break;
1384 case OESUI_WVERTcxx . . $ OESUI_WVERT.:
1385 self->pycxx . . $ oesui_t#py. = 0;
1386 /* fallthrough */
1387 case OESUI_MVERTcxx . . $ OESUI_MVERT.:
1388 self->pycxx . . $ oesui_t#py. += parm;
1389 if (self->pycxx . . $ oesui_t#py. > self->screencxx . . $ oesui_t#screen.->h)
1390 self->pycxx . . $ oesui_t#py. = self->screencxx . . $ oesui_t#screen.->h;
1391 if (self->pycxx . . $ oesui_t#py. < 0)
1392 self->pycxx . . $ oesui_t#py. = 0;
1393 //printf("Pointer @ (%d, %d)\n", self->px, self->py);
1394 break;
1395 case OESUI_OPENcxx . . $ OESUI_OPEN.:
1396 oesui_widget_opencxx . . $ oesui_widget_open(eb891d6b5a0ca503).(self, self->toplevelcxx . . $ oesui_t#toplevel.);
1397 break;
1398 case OESUI_CLOSEcxx . . $ OESUI_CLOSE.:
1399 oesui_widget_closecxx . . $ oesui_widget_close(eb891d6b5a0ca503).(self, self->toplevelcxx . . $ oesui_t#toplevel.);
1400 break;
1401 case OESUI_UNKEYcxx . . $ OESUI_UNKEY.:
1402 switch (parm)
1403 {
1404 case SDLK_ESCAPEcxx . . $ SDLK_ESCAPE.:
1405 // oesui_signals_raise(self->signals, "esc");
1406 oesui_signals_raisecxx . . $ oesui_signals_raise(c61fa0e8c4da399d).(self->signalscxx . . $ oesui_t#signals., 1, "esc");
1407 break;
1408 case SDLK_TABcxx . . $ SDLK_TAB.:
1409 // oesui_signals_raise(self->signals, "cycle-focus");
1410 oesui_signals_raisecxx . . $ oesui_signals_raise(c61fa0e8c4da399d).(self->signalscxx . . $ oesui_t#signals., 1, "cycle-focus");
1411 break;
1412 }
1413 break;
1414 case OESUI_CLICKcxx . . $ OESUI_CLICK.:
1415 // return oesui_toplevel_click(self, self->toplevel, parm);
1416 if (parm)
1417 // return oesui_signals_raise(self->signals, "click");
1418 return oesui_signals_raisecxx . . $ oesui_signals_raise(c61fa0e8c4da399d).(self->signalscxx . . $ oesui_t#signals., 3, "click", self->pxcxx . . $ oesui_t#px., self->pycxx . . $ oesui_t#py.);
1419 break;
1420 }
1421
1422 return 0;
1423 }
1424
1425
1426 /* Load assets specified in data file */
1427 int
1428 oesui_cache_assetscxx . . $ oesui_cache_assets(41bdf5e8f253a9af). (oesui_tcxx . . $ oesui_t# *self, sexp_tcxx . . $ sexp_t# *se)
1429 {
1430 sexp_tcxx . . $ sexp_t# *pair;
1431 const char *objtype;
1432 char *objname;
1433 //SDL_Surface *img;
1434
1435 for (; se; se = se->nextcxx . . $ elt#next.)
1436 {
1437 pair = se->listcxx . . $ elt#list.;
1438 objtype = pair->valcxx . . $ elt#val.;
1439 if (0);
1440 else if (0 == strcasecmp(objtype, "img"))
1441 {
1442 objname = pair->nextcxx . . $ elt#next.->valcxx . . $ elt#val.;
1443 //printf("caching asset (img) '%s'\n", objname);
1444 // img = oes_load_img(objname);
1445 // assetcache_register(&assetcache1, objname, img);
1446 imgasset_registercxx . . $ imgasset_register(998637ddb3131754).(objname);
1447 }
1448 }
1449 return 0;
1450 }
1451
1452
1453 /* Select toplevel to display */
1454 int
1455 oesui_opencxx . . $ oesui_open(4540eefb18608ff5). (oesui_tcxx . . $ oesui_t# *self, const char *tlname)
1456 {
1457 /// int loadtime;
1458 // loadtime = SDL_GetTicks();
1459 // self->toplevel->props = oesui_props_set_int(self->toplevel->props, "loadtime", loadtime);
1460
1461 if (self->toplevelcxx . . $ oesui_t#toplevel.)
1462 oesui_toplevel_closecxx . . $ oesui_toplevel_close(eb891d6b5a0ca503).(self, self->toplevelcxx . . $ oesui_t#toplevel.);
1463 self->toplevelcxx . . $ oesui_t#toplevel. = (oesui_widget_tcxx . . $ oesui_widget_t#*)assetcache_getcxx . . $ assetcache_get(2d401e4c55879679).(&assetcache1cxx . . $ assetcache1., tlname);
1464 oesui_toplevel_opencxx . . $ oesui_toplevel_open(eb891d6b5a0ca503).(self, self->toplevelcxx . . $ oesui_t#toplevel.);
1465 //printf("LOADED MENU '%s' at %d\n", tlname, oesui_props_get_int(self->toplevel->props, "loadtime"));
1466 return 0;
1467 }
1468
1469
1470 /* Load UI info from file. */
1471 int
1472 oesui_loadcxx . . $ oesui_load(4540eefb18608ff5). (oesui_tcxx . . $ oesui_t# *self, const char *fname)
1473 {
1474 FILE *guifile;
1475 sexp_iowrap_tcxx . . $ sexp_iowrap_t# *io;
1476 sexp_tcxx . . $ sexp_t# *se;
1477 const char *objtype;
1478 oesui_widget_tcxx . . $ oesui_widget_t# *widget;
1479 char * menuname = "menus.cfg";
1480 char * menupath;
1481
1482 menupath=(char*)calloccxx . . $ calloc(95acc9b79bb49189).(1,strlen(GAMEDATADIRcxx . . $ `../config.h:5:9`!)+1+strlen(menuname)+1);
1483 sprintf(menupath,"%s/%s",GAMEDATADIRcxx . . $ `../config.h:5:9`!,menuname);
1484 if (!(guifile = fopen(menupath, "r"))) {
1485 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"Cannot load menu '%s'\n",menupath);
1486 exitcxx . . $ exit(44ed87f96534fad7).(1);
1487 }
1488 freecxx . . $ free(bd21765a0afc8e3c).(menupath);
1489 menupath=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1490
1491 io = init_iowrap(fileno(guifile));
1492 // self->toplevel = read_one_sexp(io);
1493 while ((se = read_one_sexp(io)))
1494 {
1495 if (se->tycxx . . $ elt#ty. == SEXP_LISTcxx . . $ SEXP_LIST.)
1496 {
1497 if (hd_sexpcxx . . $ `src/sexpr/sexp_ops.h:54:9`!(se)->tycxx . . $ elt#ty. == SEXP_VALUEcxx . . $ SEXP_VALUE.)
1498 {
1499 objtype = se->listcxx . . $ elt#list.->valcxx . . $ elt#val.;
1500 if (0);
1501 else if (0 == strcasecmp(objtype, "assets"))
1502 oesui_cache_assetscxx . . $ oesui_cache_assets(41bdf5e8f253a9af).(self, se->listcxx . . $ elt#list.->nextcxx . . $ elt#next.);
1503 }
1504 else
1505 {
1506 /* toplevel description. */
1507 widget = sexp_to_widgetcxx . . $ sexp_to_widget(d6e1caa4f9ad8b35).(self, se);
1508 objtype = oesui_props_get_stringcxx . . $ oesui_props_get_string(2e7e486a62abc7cd).(widget->propscxx . . $ oesui_widget_t#props., "name");
1509 //printf("done widget '%s'\n", objtype);
1510 assetcache_registercxx . . $ assetcache_register(84f759feddf7f47d).(&assetcache1cxx . . $ assetcache1., objtype, widget);
1511 oesui_widget_updatecxx . . $ oesui_widget_update(eb891d6b5a0ca503).(self, widget);
1512 }
1513 }
1514 // self->toplevel = sexp_to_widget(se);
1515 // oesui_widget_update (self, self->toplevel);
1516 destroy_sexp(se);
1517 }
1518 //printf("retrieving 'main'...\n");
1519 // self->toplevel = (oesui_widget_t*)assetcache_get(&assetcache1, "main");
1520 // self->toplevel = (oesui_widget_t*)assetcache_get(&assetcache1, "prefs");
1521 //printf("gui->toplevel = %08X\n", self->toplevel);
1522 // oesui_widget_update(self, self->toplevel);
1523 destroy_iowrap(io);
1524 fclose(guifile);
1525 return 1;
1526 }
1527
1528
1529 oesui_tcxx . . $ oesui_t# *
1530 oesui_initcxx . . $ oesui_init(9c3a3732f6a0842b). (oesui_tcxx . . $ oesui_t# *self)
1531 {
1532 if (!self)
1533 {
1534 self = (oesui_tcxx . . $ oesui_t#*)calloccxx . . $ calloc(95acc9b79bb49189).(1, sizeof(oesui_tcxx . . $ oesui_t#));
1535 if (!self) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1536 SET_HEAPEDcxx . . $ `src/ui.cpp:20:9`!(self);
1537 }
1538 // memset(self, 0, sizeof(*self));
1539
1540 self->screencxx . . $ oesui_t#screen. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1541 self->toplevelcxx . . $ oesui_t#toplevel. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1542 self->sighandlercxx . . $ oesui_t#sighandler. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1543
1544 self->xcxx . . $ oesui_t#x. = 0;
1545 self->ycxx . . $ oesui_t#y. = 0;
1546 // self->w = self->screen->w; /* redundant? */
1547 // self->h = self->screen->h;
1548 self->pxcxx . . $ oesui_t#px. = self->wcxx . . $ oesui_t#w. / 2;
1549 self->pycxx . . $ oesui_t#py. = self->hcxx . . $ oesui_t#h. / 2;
1550 self->pzcxx . . $ oesui_t#pz. = 0;
1551 self->signalscxx . . $ oesui_t#signals. = oesui_signals_initcxx . . $ oesui_signals_init(a4e1d1bc2b106fb3).(self->signalscxx . . $ oesui_t#signals.);
1552 self->retcodecxx . . $ oesui_t#retcode. = 0;
1553 assetcache_initcxx . . $ assetcache_init(bc28de2e07247de).(&assetcache1cxx . . $ assetcache1.);
1554 return self;
1555 }
1556
1557
1558 /* Initialize with screen. */
1559 oesui_tcxx . . $ oesui_t# *
1560 oesui_init_surfacecxx . . $ oesui_init_surface(beb0cc957d9e5acc). (oesui_tcxx . . $ oesui_t# *self, SDL_Surface *sdlscreen)
1561 {
1562 if ((self = oesui_initcxx . . $ oesui_init(9c3a3732f6a0842b).(self)))
1563 {
1564 self->screencxx . . $ oesui_t#screen. = sdlscreen;
1565 self->wcxx . . $ oesui_t#w. = self->screencxx . . $ oesui_t#screen.->w; /* redundant? */
1566 self->hcxx . . $ oesui_t#h. = self->screencxx . . $ oesui_t#screen.->h;
1567 }
1568 return self;
1569 }
1570
1571
1572 void
1573 oesui_deletecxx . . $ oesui_delete(7752674cef154eaa). (oesui_tcxx . . $ oesui_t# *self)
1574 {
1575 // destroy_sexp(gui->toplevel);
1576 if (IS_HEAPEDcxx . . $ `src/ui.cpp:19:9`!(self))
1577 freecxx . . $ free(bd21765a0afc8e3c).(self);
1578 }
1579
1580
1581 /* UI loop. */
1582 int
1583 oesui_loopcxx . . $ oesui_loop(7f84c27812e048a1). (oesui_tcxx . . $ oesui_t# *self)
1584 {
1585 int lastdraw = 0;
1586 int px, py; /* pointer (mouse) location. */
1587 int ticks;
1588 SDL_Event event;
1589
1590 SDL_ShowCursor(1);
1591 while (!self->retcodecxx . . $ oesui_t#retcode.)
1592 {
1593 ticks = SDL_GetTicks();
1594 if (ticks > lastdraw + 20)
1595 {
1596 oesui_eventcxx . . $ oesui_event(d20ac4a2bf684293).(self, OESUI_REFRESHcxx . . $ OESUI_REFRESH., 1);
1597 SDL_Flip(self->screencxx . . $ oesui_t#screen.);
1598 }
1599 while (SDL_PollEvent(&event))
1600 {
1601 switch (event.type)
1602 {
1603 case SDL_KEYUP:
1604 if (event.key.keysym.sym == SDLK_F12cxx . . $ SDLK_F12.) /* failsafe */
1605 exitcxx . . $ exit(44ed87f96534fad7).(0);
1606 else
1607 oesui_eventcxx . . $ oesui_event(d20ac4a2bf684293).(self, OESUI_UNKEYcxx . . $ OESUI_UNKEY., (int)(event.key.keysym.sym));
1608 break;
1609 case SDL_MOUSEMOTION:
1610 SDL_GetMouseState(&px, &py);
1611 oesui_eventcxx . . $ oesui_event(d20ac4a2bf684293).(self, OESUI_WHORIZcxx . . $ OESUI_WHORIZ., px);
1612 oesui_eventcxx . . $ oesui_event(d20ac4a2bf684293).(self, OESUI_WVERTcxx . . $ OESUI_WVERT., py);
1613 break;
1614 case SDL_MOUSEBUTTONDOWN:
1615 switch (event.button.button)
1616 {
1617 case SDL_BUTTON_LEFTcxx . . $ `<external>/3689087283782876844/SDL_mouse.h:56:9`!:
1618 oesui_eventcxx . . $ oesui_event(d20ac4a2bf684293).(self, OESUI_CLICKcxx . . $ OESUI_CLICK., 1);
1619 break;
1620 }
1621 case SDL_MOUSEBUTTONUP:
1622 switch (event.button.button)
1623 {
1624 case SDL_BUTTON_LEFTcxx . . $ `<external>/3689087283782876844/SDL_mouse.h:56:9`!:
1625 oesui_eventcxx . . $ oesui_event(d20ac4a2bf684293).(self, OESUI_CLICKcxx . . $ OESUI_CLICK., 0);
1626 break;
1627 }
1628 break;
1629 case SDL_QUIT:
1630 exitcxx . . $ exit(44ed87f96534fad7).(0);
1631 break;
1632 } //switch event.type
1633 } //while SDL_PollEvents
1634 /* Propagate pending signals. */
1635 oesui_signals_cyclecxx . . $ oesui_signals_cycle(eb891d6b5a0ca503).(self, self->signalscxx . . $ oesui_t#signals.);
1636 } //while !self->retcode
1637 return self->retcodecxx . . $ oesui_t#retcode.;
1638 }
1639
1640
1641 /* Set callback handler for unhandled widget signals. */
1642 int
1643 oesui_sighandlecxx . . $ oesui_sighandle(10083bca6c1c8e25). (oesui_tcxx . . $ oesui_t# *gui, int (*sighandle)(oesui_tcxx . . $ oesui_t# *, oesui_signal_tcxx . . $ oesui_signal_t#*))
1644 {
1645 gui->sighandlercxx . . $ oesui_t#sighandler. = sighandle;
1646 return 0;
1647 }