Mercurial > MadButterfly
comparison src/prop.c @ 224:29e1b2bffe4c
X backend only sent EVT_MOUSE_MOVE_RAW to MadButterfly.
- backend does not interpret mouse events (over/out/move), now.
- redraw manager, now, interpret mouse events to make it backend independent.
- The task (interpret mouse events) should be moved to somewhere in futhure.
- backend only sent MotionNotify as EVT_MOUSE_MOVE_RAW.
- EVT_MOUSE_MOVE_RAW is interpreted by backend independent code.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Mon, 15 Dec 2008 10:13:03 +0800 |
parents | |
children | f08b3ba9c1d8 |
comparison
equal
deleted
inserted
replaced
223:8be36a0d4239 | 224:29e1b2bffe4c |
---|---|
1 #include "mb_prop.h" | |
2 | |
3 #define ASSERT(x) | |
4 | |
5 | |
6 static | |
7 mb_prop_entry_t *_mb_prop_find(mb_prop_store_t *prop_store, int id) { | |
8 mb_prop_entry_t *entry; | |
9 | |
10 for(entry = STAILQ_HEAD(prop_store->entries); | |
11 entry != NULL; | |
12 entry = STAILQ_NEXT(mb_prop_entry_t, next, entry)) { | |
13 if(entry->id == id) | |
14 return entry; | |
15 } | |
16 | |
17 return NULL; | |
18 } | |
19 | |
20 void mb_prop_store_destroy(mb_prop_store_t *prop_store) { | |
21 mb_prop_entry_t *entry, *last; | |
22 | |
23 last = STAILQ_HEAD(prop_store->entries); | |
24 if(last == NULL) | |
25 return; | |
26 | |
27 for(entry = STAILQ_NEXT(mb_prop_entry_t, next, entry); | |
28 entry != NULL; | |
29 entry = STAILQ_NEXT(mb_prop_entry_t, next, entry)) { | |
30 STAILQ_REMOVE(prop_store->entries, mb_prop_entry_t, next, last); | |
31 elmpool_elm_free(prop_store->entry_pool, last); | |
32 last = entry; | |
33 } | |
34 STAILQ_REMOVE(prop_store->entries, mb_prop_entry_t, next, last); | |
35 elmpool_elm_free(prop_store->entry_pool, last); | |
36 } | |
37 | |
38 void *mb_prop_set(mb_prop_store_t *prop_store, int id, void *value) { | |
39 mb_prop_entry_t *entry; | |
40 void *old; | |
41 | |
42 entry = _mb_prop_find(prop_store, id); | |
43 if(entry) { | |
44 old = entry->value; | |
45 entry->value = value; | |
46 return old; | |
47 } | |
48 | |
49 entry = elmpool_elm_alloc(prop_store->entry_pool); | |
50 ASSERT(entry != NULL); | |
51 entry->id = id; | |
52 entry->value = value; | |
53 STAILQ_INS(prop_store->entries, mb_prop_entry_t, next, entry); | |
54 | |
55 return NULL; | |
56 } | |
57 | |
58 void *mb_prop_get(mb_prop_store_t *prop_store, int id) { | |
59 mb_prop_entry_t *entry; | |
60 | |
61 entry = _mb_prop_find(prop_store, id); | |
62 if(entry) | |
63 return entry->value; | |
64 | |
65 return NULL; | |
66 } | |
67 | |
68 void mb_prop_del(mb_prop_store_t *prop_store, int id) { | |
69 mb_prop_entry_t *entry; | |
70 | |
71 entry = _mb_prop_find(prop_store, id); | |
72 if(entry) | |
73 STAILQ_REMOVE(prop_store->entries, mb_prop_entry_t, next, entry); | |
74 } | |
75 | |
76 int mb_prop_has(mb_prop_store_t *prop_store, int id) { | |
77 mb_prop_entry_t *entry; | |
78 | |
79 entry = _mb_prop_find(prop_store, id); | |
80 if(entry) | |
81 return 1; | |
82 | |
83 return 0; | |
84 } |