Mercurial > MadButterfly
comparison examples/drag/main.c @ 1044:5d4bc2a93c09
Merge from refine_backend_if branch
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 23 Nov 2010 11:58:04 +0800 |
parents | 7f49b501ac4d |
children |
comparison
equal
deleted
inserted
replaced
1035:18329b6f77a4 | 1044:5d4bc2a93c09 |
---|---|
8 #include <mb.h> | 8 #include <mb.h> |
9 #include "menu.h" | 9 #include "menu.h" |
10 | 10 |
11 typedef struct _engine engine_t; | 11 typedef struct _engine engine_t; |
12 struct _engine { | 12 struct _engine { |
13 X_MB_runtime_t *rt; | 13 mb_rt_t *rt; |
14 redraw_man_t *rdman; | 14 redraw_man_t *rdman; |
15 menu_t *menu; | 15 menu_t *menu; |
16 int state; | 16 int state; |
17 co_aix orx,ory; | 17 co_aix orx,ory; |
18 int start_x,start_y; | 18 int start_x,start_y; |
19 coord_t *cursor; | 19 coord_t *cursor; |
20 }; | 20 }; |
21 engine_t *engine_init() | 21 engine_t *engine_init() |
22 { | 22 { |
23 | 23 |
24 X_MB_runtime_t *rt; | 24 mb_rt_t *rt; |
25 rt = X_MB_new(":0.0", 800, 600); | 25 rt = mb_runtime_new(":0.0", 800, 600); |
26 engine_t *en = (engine_t *) malloc(sizeof(engine_t)); | 26 engine_t *en = (engine_t *) malloc(sizeof(engine_t)); |
27 | 27 |
28 en->rt = rt; | 28 en->rt = rt; |
29 en->rdman = X_MB_rdman(rt); | 29 en->rdman = mb_runtime_rdman(rt); |
30 en->state = 0; | 30 en->state = 0; |
31 return en; | 31 return en; |
32 } | 32 } |
33 void engine_close(engine_t *en) | 33 void engine_close(engine_t *en) |
34 { | 34 { |
35 /* | 35 /* |
36 * Start handle connections, includes one to X server. | 36 * Start handle connections, includes one to X server. |
37 * User start to interact with the application. | 37 * User start to interact with the application. |
38 */ | 38 */ |
39 X_MB_handle_connection(en->rt); | 39 mb_runtime_event_loop(en->rt); |
40 | 40 |
41 /* | 41 /* |
42 * Clean | 42 * Clean |
43 */ | 43 */ |
44 menu_free(en->menu); | 44 menu_free(en->menu); |
45 X_MB_free(en->rt); | 45 mb_runtime_free(en->rt); |
46 free(en); | 46 free(en); |
47 } | 47 } |
48 #define COORD_SHOW(group) coord_show(group);rdman_coord_changed(X_MB_rdman(ex_rt->rt), group) | 48 #define COORD_SHOW(group) coord_show(group);rdman_coord_changed(X_MB_rdman(ex_rt->rt), group) |
49 #define COORD_HIDE(group) coord_hide(group);rdman_coord_changed(X_MB_rdman(ex_rt->rt), group) | 49 #define COORD_HIDE(group) coord_hide(group);rdman_coord_changed(X_MB_rdman(ex_rt->rt), group) |
50 | 50 |