Mercurial > MadButterfly
comparison examples/calculator/main.c @ 271:c990a9a9648f
Fix bug of calculator.
- calc can not handle button press event.
- It caused by miss-understanding event_t::cur_tgt.
It is a subject, not a shape that calc think.
- event_t::cur_tgt::obj is a shape that calc want.
It is a the subject that the subject stands for.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 25 Jan 2009 23:03:18 +0800 |
parents | 54fdc2a65242 |
children | c8b6ca46950b |
comparison
equal
deleted
inserted
replaced
270:cd6af7da32c9 | 271:c990a9a9648f |
---|---|
142 static void buttons_handler(event_t *evt, void *arg) { | 142 static void buttons_handler(event_t *evt, void *arg) { |
143 calc_data_t *calc_data = (calc_data_t *)arg; | 143 calc_data_t *calc_data = (calc_data_t *)arg; |
144 | 144 |
145 switch(evt->type) { | 145 switch(evt->type) { |
146 case EVT_MOUSE_BUT_PRESS: | 146 case EVT_MOUSE_BUT_PRESS: |
147 compute(calc_data, (coord_t *)evt->cur_tgt); | 147 compute(calc_data, (coord_t *)evt->cur_tgt->obj); |
148 break; | 148 break; |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 static void setup_observers(calc_data_t *calc_data) { | 152 static void setup_observers(calc_data_t *calc_data) { |