summaryrefslogtreecommitdiff
path: root/src/lib/ecore_sdl
diff options
context:
space:
mode:
authorCedric BAIL <c.bail@partner.samsung.com>2014-07-25 20:23:42 +0200
committerCedric BAIL <c.bail@partner.samsung.com>2014-07-25 20:24:29 +0200
commit3c179cdb87446f58b7eec3b467c9142c9a97df96 (patch)
tree21d05b1e03f6473110201d3109d495b7dbedc2a6 /src/lib/ecore_sdl
parent9a9d78dfcbe2aa75ecc72d0fe303a174d0ed457a (diff)
evas: move to SDL2 and use GL_Generic infrastructure.
Diffstat (limited to 'src/lib/ecore_sdl')
-rw-r--r--src/lib/ecore_sdl/Ecore_Sdl.h31
-rw-r--r--src/lib/ecore_sdl/Ecore_Sdl_Keys.h139
-rw-r--r--src/lib/ecore_sdl/ecore_sdl.c163
3 files changed, 136 insertions, 197 deletions
diff --git a/src/lib/ecore_sdl/Ecore_Sdl.h b/src/lib/ecore_sdl/Ecore_Sdl.h
index 359e974718..ed4bd0f0a9 100644
--- a/src/lib/ecore_sdl/Ecore_Sdl.h
+++ b/src/lib/ecore_sdl/Ecore_Sdl.h
@@ -41,6 +41,26 @@ EAPI extern int ECORE_SDL_EVENT_LOST_FOCUS;
41EAPI extern int ECORE_SDL_EVENT_RESIZE; 41EAPI extern int ECORE_SDL_EVENT_RESIZE;
42EAPI extern int ECORE_SDL_EVENT_EXPOSE; 42EAPI extern int ECORE_SDL_EVENT_EXPOSE;
43 43
44typedef struct _Ecore_Sdl_Event_Video_Resize Ecore_Sdl_Event_Video_Resize;
45struct _Ecore_Sdl_Event_Video_Resize
46{
47 unsigned int windowID;
48 int w;
49 int h;
50};
51
52typedef struct _Ecore_Sdl_Event_Window Ecore_Sdl_Event_Window;
53struct _Ecore_Sdl_Event_Window
54{
55 unsigned int windowID;
56};
57
58EAPI int ecore_sdl_init(const char *name);
59EAPI int ecore_sdl_shutdown(void);
60EAPI void ecore_sdl_feed_events(void);
61
62 /* The following data structure have been deprecated since a long time */
63
44typedef struct _Ecore_Sdl_Event_Key_Down Ecore_Sdl_Event_Key_Down; 64typedef struct _Ecore_Sdl_Event_Key_Down Ecore_Sdl_Event_Key_Down;
45struct _Ecore_Sdl_Event_Key_Down /** SDL Key Down event */ 65struct _Ecore_Sdl_Event_Key_Down /** SDL Key Down event */
46{ 66{
@@ -96,17 +116,6 @@ struct _Ecore_Sdl_Event_Mouse_Wheel /** SDL Mouse Wheel event */
96 unsigned int time; 116 unsigned int time;
97}; 117};
98 118
99typedef struct _Ecore_Sdl_Event_Video_Resize Ecore_Sdl_Event_Video_Resize;
100struct _Ecore_Sdl_Event_Video_Resize
101{
102 int w;
103 int h;
104};
105
106EAPI int ecore_sdl_init(const char *name);
107EAPI int ecore_sdl_shutdown(void);
108EAPI void ecore_sdl_feed_events(void);
109
110#ifdef __cplusplus 119#ifdef __cplusplus
111} 120}
112#endif 121#endif
diff --git a/src/lib/ecore_sdl/Ecore_Sdl_Keys.h b/src/lib/ecore_sdl/Ecore_Sdl_Keys.h
index 4e298d77ea..2ca2069901 100644
--- a/src/lib/ecore_sdl/Ecore_Sdl_Keys.h
+++ b/src/lib/ecore_sdl/Ecore_Sdl_Keys.h
@@ -3,7 +3,7 @@
3 3
4struct _ecore_sdl_keys_s 4struct _ecore_sdl_keys_s
5{ 5{
6 unsigned int code; 6 SDL_Keycode code;
7 const char* name; 7 const char* name;
8 const char* compose; 8 const char* compose;
9}; 9};
@@ -11,9 +11,6 @@ struct _ecore_sdl_keys_s
11static const struct _ecore_sdl_keys_s keystable[] = 11static const struct _ecore_sdl_keys_s keystable[] =
12{ 12{
13 { SDLK_UNKNOWN, "0x00", "" }, 13 { SDLK_UNKNOWN, "0x00", "" },
14#ifndef BUILD_ECORE_EVAS_SDL_130
15 { SDLK_FIRST, "First", "First" },
16#endif
17 { SDLK_BACKSPACE, "BackSpace", "\010" }, 14 { SDLK_BACKSPACE, "BackSpace", "\010" },
18 { SDLK_TAB, "Tab", "\011" }, 15 { SDLK_TAB, "Tab", "\011" },
19 { SDLK_CLEAR, "Clear", "Clear" }, 16 { SDLK_CLEAR, "Clear", "Clear" },
@@ -89,116 +86,17 @@ static const struct _ecore_sdl_keys_s keystable[] =
89 { SDLK_DELETE, "Delete", "\177" }, 86 { SDLK_DELETE, "Delete", "\177" },
90 /* End of ASCII mapped keysyms */ 87 /* End of ASCII mapped keysyms */
91 88
92#ifndef BUILD_ECORE_EVAS_SDL_130
93 /* International keyboard syms */
94 { SDLK_WORLD_0, "w0", "" }, /* 0xA0 */
95 { SDLK_WORLD_1, "w1", "" },
96 { SDLK_WORLD_2, "w2", "" },
97 { SDLK_WORLD_3, "w3", "" },
98 { SDLK_WORLD_4, "w4", "" },
99 { SDLK_WORLD_5, "w5", "" },
100 { SDLK_WORLD_6, "w6", "" },
101 { SDLK_WORLD_7, "w7", "" },
102 { SDLK_WORLD_8, "w8", "" },
103 { SDLK_WORLD_9, "w9", "" },
104 { SDLK_WORLD_10, "w10", "" },
105 { SDLK_WORLD_11, "w11", "" },
106 { SDLK_WORLD_12, "w12", "" },
107 { SDLK_WORLD_13, "w13", "" },
108 { SDLK_WORLD_14, "w14", "" },
109 { SDLK_WORLD_15, "w15", "" },
110 { SDLK_WORLD_16, "w16", "" },
111 { SDLK_WORLD_17, "w17", "" },
112 { SDLK_WORLD_18, "w18", "" },
113 { SDLK_WORLD_19, "w19", "" },
114 { SDLK_WORLD_20, "w20", "" },
115 { SDLK_WORLD_21, "w21", "" },
116 { SDLK_WORLD_22, "w22", "" },
117 { SDLK_WORLD_23, "w23", "" },
118 { SDLK_WORLD_24, "w24", "" },
119 { SDLK_WORLD_25, "w25", "" },
120 { SDLK_WORLD_26, "w26", "" },
121 { SDLK_WORLD_27, "w27", "" },
122 { SDLK_WORLD_28, "w28", "" },
123 { SDLK_WORLD_29, "w29", "" },
124 { SDLK_WORLD_30, "w30", "" },
125 { SDLK_WORLD_31, "w31", "" },
126 { SDLK_WORLD_32, "w32", "" },
127 { SDLK_WORLD_33, "w33", "" },
128 { SDLK_WORLD_34, "w34", "" },
129 { SDLK_WORLD_35, "w35", "" },
130 { SDLK_WORLD_36, "w36", "" },
131 { SDLK_WORLD_37, "w37", "" },
132 { SDLK_WORLD_38, "w38", "" },
133 { SDLK_WORLD_39, "w39", "" },
134 { SDLK_WORLD_40, "w40", "" },
135 { SDLK_WORLD_41, "w41", "" },
136 { SDLK_WORLD_42, "w42", "" },
137 { SDLK_WORLD_43, "w43", "" },
138 { SDLK_WORLD_44, "w44", "" },
139 { SDLK_WORLD_45, "w45", "" },
140 { SDLK_WORLD_46, "w46", "" },
141 { SDLK_WORLD_47, "w47", "" },
142 { SDLK_WORLD_48, "w48", "" },
143 { SDLK_WORLD_49, "w49", "" },
144 { SDLK_WORLD_50, "w50", "" },
145 { SDLK_WORLD_51, "w51", "" },
146 { SDLK_WORLD_52, "w52", "" },
147 { SDLK_WORLD_53, "w53", "" },
148 { SDLK_WORLD_54, "w54", "" },
149 { SDLK_WORLD_55, "w55", "" },
150 { SDLK_WORLD_56, "w56", "" },
151 { SDLK_WORLD_57, "w57", "" },
152 { SDLK_WORLD_58, "w58", "" },
153 { SDLK_WORLD_59, "w59", "" },
154 { SDLK_WORLD_60, "w60", "" },
155 { SDLK_WORLD_61, "w61", "" },
156 { SDLK_WORLD_62, "w62", "" },
157 { SDLK_WORLD_63, "w63", "" },
158 { SDLK_WORLD_64, "w64", "" },
159 { SDLK_WORLD_65, "w65", "" },
160 { SDLK_WORLD_66, "w66", "" },
161 { SDLK_WORLD_67, "w67", "" },
162 { SDLK_WORLD_68, "w68", "" },
163 { SDLK_WORLD_69, "w69", "" },
164 { SDLK_WORLD_70, "w70", "" },
165 { SDLK_WORLD_71, "w71", "" },
166 { SDLK_WORLD_72, "w72", "" },
167 { SDLK_WORLD_73, "w73", "" },
168 { SDLK_WORLD_74, "w74", "" },
169 { SDLK_WORLD_75, "w75", "" },
170 { SDLK_WORLD_76, "w76", "" },
171 { SDLK_WORLD_77, "w77", "" },
172 { SDLK_WORLD_78, "w78", "" },
173 { SDLK_WORLD_79, "w79", "" },
174 { SDLK_WORLD_80, "w80", "" },
175 { SDLK_WORLD_81, "w81", "" },
176 { SDLK_WORLD_82, "w82", "" },
177 { SDLK_WORLD_83, "w83", "" },
178 { SDLK_WORLD_84, "w84", "" },
179 { SDLK_WORLD_85, "w85", "" },
180 { SDLK_WORLD_86, "w86", "" },
181 { SDLK_WORLD_87, "w87", "" },
182 { SDLK_WORLD_88, "w88", "" },
183 { SDLK_WORLD_89, "w89", "" },
184 { SDLK_WORLD_90, "w90", "" },
185 { SDLK_WORLD_91, "w91", "" },
186 { SDLK_WORLD_92, "w92", "" },
187 { SDLK_WORLD_93, "w93", "" },
188 { SDLK_WORLD_94, "w94", "" },
189 { SDLK_WORLD_95, "w95", "" },
190#endif
191 /* Numeric keypad */ 89 /* Numeric keypad */
192 { SDLK_KP0, "KP0", "0" }, 90 { SDLK_KP_0, "KP0", "0" },
193 { SDLK_KP1, "KP1", "1" }, 91 { SDLK_KP_1, "KP1", "1" },
194 { SDLK_KP2, "KP2", "2" }, 92 { SDLK_KP_2, "KP2", "2" },
195 { SDLK_KP3, "KP3", "3" }, 93 { SDLK_KP_3, "KP3", "3" },
196 { SDLK_KP4, "KP4", "4" }, 94 { SDLK_KP_4, "KP4", "4" },
197 { SDLK_KP5, "KP5", "5" }, 95 { SDLK_KP_5, "KP5", "5" },
198 { SDLK_KP6, "KP6", "6" }, 96 { SDLK_KP_6, "KP6", "6" },
199 { SDLK_KP7, "KP7", "7" }, 97 { SDLK_KP_7, "KP7", "7" },
200 { SDLK_KP8, "KP8", "8" }, 98 { SDLK_KP_8, "KP8", "8" },
201 { SDLK_KP9, "KP9", "9" }, 99 { SDLK_KP_9, "KP9", "9" },
202 { SDLK_KP_PERIOD, "period", "." }, 100 { SDLK_KP_PERIOD, "period", "." },
203 { SDLK_KP_DIVIDE, "KP_Divide", "/" }, 101 { SDLK_KP_DIVIDE, "KP_Divide", "/" },
204 { SDLK_KP_MULTIPLY, "KP_Multiply", "*" }, 102 { SDLK_KP_MULTIPLY, "KP_Multiply", "*" },
@@ -236,30 +134,25 @@ static const struct _ecore_sdl_keys_s keystable[] =
236 { SDLK_F15, "F15", "F15" }, 134 { SDLK_F15, "F15", "F15" },
237 135
238 /* Key state modifier keys */ 136 /* Key state modifier keys */
239 { SDLK_NUMLOCK, "Num_Lock", "Num_Lock" }, 137 { SDLK_NUMLOCKCLEAR, "Num_Lock", "Num_Lock" },
240 { SDLK_CAPSLOCK, "Caps_Lock", "Caps_Lock" }, 138 { SDLK_CAPSLOCK, "Caps_Lock", "Caps_Lock" },
241 { SDLK_SCROLLOCK, "Scroll_Lock", "Scroll_Lock" }, 139 { SDLK_SCROLLLOCK, "Scroll_Lock", "Scroll_Lock" },
242 { SDLK_RSHIFT, "Shift_R", "Shift_R" }, 140 { SDLK_RSHIFT, "Shift_R", "Shift_R" },
243 { SDLK_LSHIFT, "Shift_L", "Shift_L" }, 141 { SDLK_LSHIFT, "Shift_L", "Shift_L" },
244 { SDLK_RCTRL, "Control_R", "Control_R" }, 142 { SDLK_RCTRL, "Control_R", "Control_R" },
245 { SDLK_LCTRL, "Control_L", "Control_L" }, 143 { SDLK_LCTRL, "Control_L", "Control_L" },
246 { SDLK_RALT, "Alt_R", "Alt_R" }, 144 { SDLK_RALT, "Alt_R", "Alt_R" },
247 { SDLK_LALT, "Alt_L", "Alt_L" }, 145 { SDLK_LALT, "Alt_L", "Alt_L" },
248 { SDLK_RMETA, "Meta_R", "Meta_R" }, 146 { SDLK_LGUI, "Super_L", "Super_L" }, /* Left "Windows" key */
249 { SDLK_LMETA, "Meta_L", "Meta_L" }, 147 { SDLK_RGUI, "Super_R", "Super_R" }, /* Right "Windows" key */
250 { SDLK_LSUPER, "Super_L", "Super_L" }, /* Left "Windows" key */
251 { SDLK_RSUPER, "Super_R", "Super_R" }, /* Right "Windows" key */
252 { SDLK_MODE, "Mode", "Mode" }, /* "Alt Gr" key */ 148 { SDLK_MODE, "Mode", "Mode" }, /* "Alt Gr" key */
253 { SDLK_COMPOSE, "Compose", "Compose" }, /* Multi-key compose key */
254 149
255 /* Miscellaneous function keys */ 150 /* Miscellaneous function keys */
256 { SDLK_HELP, "Help", "Help" }, 151 { SDLK_HELP, "Help", "Help" },
257 { SDLK_PRINT, "Print", "Print" }, 152 { SDLK_PRINTSCREEN, "Print", "Print" },
258 { SDLK_SYSREQ, "SysReq", "SysReq" }, 153 { SDLK_SYSREQ, "SysReq", "SysReq" },
259 { SDLK_BREAK, "Break", "Break" },
260 { SDLK_MENU, "Menu", "Menu" }, 154 { SDLK_MENU, "Menu", "Menu" },
261 { SDLK_POWER, "Power", "Power" }, /* Power Macintosh power key */ 155 { SDLK_POWER, "Power", "Power" }, /* Power Macintosh power key */
262 { SDLK_EURO, "Euro", "\200" }, /* Some european keyboards */
263 { SDLK_UNDO, "Undo", "Undo" } /* Atari keyboard has Undo */ 156 { SDLK_UNDO, "Undo", "Undo" } /* Atari keyboard has Undo */
264}; 157};
265 158
diff --git a/src/lib/ecore_sdl/ecore_sdl.c b/src/lib/ecore_sdl/ecore_sdl.c
index ab85c75370..8b5897794b 100644
--- a/src/lib/ecore_sdl/ecore_sdl.c
+++ b/src/lib/ecore_sdl/ecore_sdl.c
@@ -2,7 +2,7 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#include <SDL/SDL.h> 5#include <SDL2/SDL.h>
6 6
7#include <Eina.h> 7#include <Eina.h>
8#include <Ecore.h> 8#include <Ecore.h>
@@ -19,7 +19,7 @@ struct _Ecore_SDL_Pressed
19{ 19{
20 EINA_RBTREE; 20 EINA_RBTREE;
21 21
22 SDLKey key; 22 SDL_Keycode key;
23}; 23};
24 24
25EAPI int ECORE_SDL_EVENT_GOT_FOCUS = 0; 25EAPI int ECORE_SDL_EVENT_GOT_FOCUS = 0;
@@ -40,7 +40,7 @@ _ecore_sdl_pressed_key(const Ecore_SDL_Pressed *left,
40 40
41static int 41static int
42_ecore_sdl_pressed_node(const Ecore_SDL_Pressed *node, 42_ecore_sdl_pressed_node(const Ecore_SDL_Pressed *node,
43 const SDLKey *key, 43 const SDL_Keycode *key,
44 EINA_UNUSED int length, 44 EINA_UNUSED int length,
45 EINA_UNUSED void *data) 45 EINA_UNUSED void *data)
46{ 46{
@@ -76,13 +76,13 @@ ecore_sdl_init(const char *name EINA_UNUSED)
76 if (!ecore_event_init()) 76 if (!ecore_event_init())
77 return --_ecore_sdl_init_count; 77 return --_ecore_sdl_init_count;
78 78
79 SDL_Init(SDL_INIT_EVENTS);
80
79 ECORE_SDL_EVENT_GOT_FOCUS = ecore_event_type_new(); 81 ECORE_SDL_EVENT_GOT_FOCUS = ecore_event_type_new();
80 ECORE_SDL_EVENT_LOST_FOCUS = ecore_event_type_new(); 82 ECORE_SDL_EVENT_LOST_FOCUS = ecore_event_type_new();
81 ECORE_SDL_EVENT_RESIZE = ecore_event_type_new(); 83 ECORE_SDL_EVENT_RESIZE = ecore_event_type_new();
82 ECORE_SDL_EVENT_EXPOSE = ecore_event_type_new(); 84 ECORE_SDL_EVENT_EXPOSE = ecore_event_type_new();
83 85
84 SDL_EnableKeyRepeat(200, 100);
85
86 return _ecore_sdl_init_count; 86 return _ecore_sdl_init_count;
87} 87}
88 88
@@ -98,6 +98,8 @@ ecore_sdl_shutdown(void)
98 if (--_ecore_sdl_init_count != 0) 98 if (--_ecore_sdl_init_count != 0)
99 return _ecore_sdl_init_count; 99 return _ecore_sdl_init_count;
100 100
101 SDL_Quit();
102
101 ecore_event_shutdown(); 103 ecore_event_shutdown();
102 eina_log_domain_unregister(_ecore_sdl_log_dom); 104 eina_log_domain_unregister(_ecore_sdl_log_dom);
103 _ecore_sdl_log_dom = -1; 105 _ecore_sdl_log_dom = -1;
@@ -131,7 +133,7 @@ _ecore_sdl_event_key(SDL_Event *event, double timestamp)
131 if (!ev) return NULL; 133 if (!ev) return NULL;
132 134
133 ev->timestamp = timestamp; 135 ev->timestamp = timestamp;
134 ev->window = 0; 136 ev->window = event->key.windowID;
135 ev->event_window = 0; 137 ev->event_window = 0;
136 ev->modifiers = _ecore_sdl_event_modifiers(SDL_GetModState()); 138 ev->modifiers = _ecore_sdl_event_modifiers(SDL_GetModState());
137 ev->key = NULL; 139 ev->key = NULL;
@@ -169,8 +171,8 @@ ecore_sdl_feed_events(void)
169 if (!ev) return; 171 if (!ev) return;
170 172
171 ev->timestamp = timestamp; 173 ev->timestamp = timestamp;
172 ev->window = 0; 174 ev->window = event.motion.windowID;
173 ev->event_window = 0; 175 ev->event_window = event.motion.windowID;
174 ev->modifiers = 0; /* FIXME: keep modifier around. */ 176 ev->modifiers = 0; /* FIXME: keep modifier around. */
175 ev->x = event.motion.x; 177 ev->x = event.motion.x;
176 ev->y = event.motion.y; 178 ev->y = event.motion.y;
@@ -188,46 +190,44 @@ ecore_sdl_feed_events(void)
188 } 190 }
189 case SDL_MOUSEBUTTONDOWN: 191 case SDL_MOUSEBUTTONDOWN:
190 { 192 {
191 if (event.button.button == SDL_BUTTON_WHEELUP || 193 Ecore_Event_Mouse_Button *ev;
192 event.button.button == SDL_BUTTON_WHEELDOWN)
193 {
194 Ecore_Event_Mouse_Wheel *ev;
195 194
196 ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)); 195 ev = malloc(sizeof(Ecore_Event_Mouse_Button));
197 if (!ev) return; 196 if (!ev) return;
198 197
199 ev->timestamp = timestamp; 198 ev->timestamp = timestamp;
200 ev->window = 0; 199 ev->window = event.button.windowID;
201 ev->event_window = 0; 200 ev->event_window = event.button.windowID;
202 ev->modifiers = 0; /* FIXME: keep modifier around. */ 201 ev->modifiers = 0; /* FIXME: keep modifier around. */
203 ev->direction = 0; 202 ev->buttons = event.button.button;
204 ev->z = event.button.button == SDL_BUTTON_WHEELDOWN ? -1 : 1; 203 ev->double_click = 0;
204 ev->triple_click = 0;
205 205
206 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL); 206 /* Must set multi touch device to 0 or it will get ignored */
207 } 207 ev->multi.device = 0;
208 else 208 ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0;
209 { 209 ev->multi.pressure = ev->multi.angle = 0;
210 Ecore_Event_Mouse_Button *ev; 210 ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0;
211 211
212 ev = malloc(sizeof(Ecore_Event_Mouse_Button)); 212 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
213 if (!ev) return; 213 break;
214 214 }
215 ev->timestamp = timestamp; 215 case SDL_MOUSEWHEEL:
216 ev->window = 0; 216 {
217 ev->event_window = 0; 217 Ecore_Event_Mouse_Wheel *ev;
218 ev->modifiers = 0; /* FIXME: keep modifier around. */ 218
219 ev->buttons = event.button.button; 219 ev = malloc(sizeof(Ecore_Event_Mouse_Wheel));
220 ev->double_click = 0; 220 if (!ev) return;
221 ev->triple_click = 0; 221
222 222 ev->timestamp = timestamp;
223 /* Must set multi touch device to 0 or it will get ignored */ 223 ev->window = event.wheel.windowID;
224 ev->multi.device = 0; 224 ev->event_window = event.wheel.windowID;
225 ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0; 225 ev->modifiers = 0; /* FIXME: keep modifier around. */
226 ev->multi.pressure = ev->multi.angle = 0; 226 ev->direction = 0;
227 ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0; 227 ev->z = event.wheel.x != 0 ? event.wheel.x : event.wheel.y;
228 228 ev->direction = event.wheel.x != 0 ? 0 : 1;
229 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); 229
230 } 230 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
231 break; 231 break;
232 } 232 }
233 case SDL_MOUSEBUTTONUP: 233 case SDL_MOUSEBUTTONUP:
@@ -237,8 +237,8 @@ ecore_sdl_feed_events(void)
237 ev = malloc(sizeof(Ecore_Event_Mouse_Button)); 237 ev = malloc(sizeof(Ecore_Event_Mouse_Button));
238 if (!ev) return; 238 if (!ev) return;
239 ev->timestamp = timestamp; 239 ev->timestamp = timestamp;
240 ev->window = 0; 240 ev->window = event.button.windowID;
241 ev->event_window = 0; 241 ev->event_window = event.button.windowID;
242 ev->modifiers = 0; /* FIXME: keep modifier around. */ 242 ev->modifiers = 0; /* FIXME: keep modifier around. */
243 ev->buttons = event.button.button; 243 ev->buttons = event.button.button;
244 ev->double_click = 0; 244 ev->double_click = 0;
@@ -253,20 +253,6 @@ ecore_sdl_feed_events(void)
253 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); 253 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
254 break; 254 break;
255 } 255 }
256 case SDL_VIDEORESIZE:
257 {
258 Ecore_Sdl_Event_Video_Resize *ev;
259
260 ev = malloc(sizeof (Ecore_Sdl_Event_Video_Resize));
261 ev->w = event.resize.w;
262 ev->h = event.resize.h;
263
264 ecore_event_add(ECORE_SDL_EVENT_RESIZE, ev, NULL, NULL);
265 break;
266 }
267 case SDL_VIDEOEXPOSE:
268 ecore_event_add(ECORE_SDL_EVENT_EXPOSE, NULL, NULL, NULL);
269 break;
270 case SDL_QUIT: 256 case SDL_QUIT:
271 ecore_main_loop_quit(); 257 ecore_main_loop_quit();
272 break; 258 break;
@@ -317,8 +303,59 @@ ecore_sdl_feed_events(void)
317 if (ev) ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL); 303 if (ev) ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL);
318 break; 304 break;
319 } 305 }
320 case SDL_ACTIVEEVENT: 306 case SDL_WINDOWEVENT:
321 /* FIXME: Focus gain. */ 307 switch (event.window.event)
308 {
309 case SDL_WINDOWEVENT_RESIZED:
310 {
311 Ecore_Sdl_Event_Video_Resize *ev;
312
313 ev = calloc(1, sizeof (Ecore_Sdl_Event_Video_Resize));
314 ev->windowID = event.window.windowID;
315 ev->w = event.window.data1;
316 ev->h = event.window.data2;
317
318 ecore_event_add(ECORE_SDL_EVENT_RESIZE, ev, NULL, NULL);
319 break;
320 }
321 case SDL_WINDOWEVENT_EXPOSED:
322 {
323 Ecore_Sdl_Event_Window *ev;
324
325 ev = calloc(1, sizeof (Ecore_Sdl_Event_Window));
326 ev->windowID = event.window.windowID;
327
328 ecore_event_add(ECORE_SDL_EVENT_EXPOSE, ev, NULL, NULL);
329 break;
330 }
331 case SDL_WINDOWEVENT_ENTER:
332 case SDL_WINDOWEVENT_LEAVE:
333 {
334 Ecore_Event_Mouse_IO *ev;
335
336 ev = calloc(1, sizeof (Ecore_Event_Mouse_IO));
337 ev->window = event.window.windowID;
338 ev->event_window = event.window.windowID;
339
340 ecore_event_add(event.window.event == SDL_WINDOWEVENT_ENTER ?
341 ECORE_EVENT_MOUSE_IN : ECORE_EVENT_MOUSE_OUT,
342 ev, NULL, NULL);
343 break;
344 }
345 case SDL_WINDOWEVENT_FOCUS_GAINED:
346 case SDL_WINDOWEVENT_FOCUS_LOST:
347 {
348 Ecore_Sdl_Event_Window *ev;
349
350 ev = calloc(1, sizeof (Ecore_Sdl_Event_Window));
351 ev->windowID = event.window.windowID;
352
353 ecore_event_add(event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED ?
354 ECORE_SDL_EVENT_GOT_FOCUS : ECORE_SDL_EVENT_LOST_FOCUS,
355 ev, NULL, NULL);
356 break;
357 }
358 }
322 break; 359 break;
323 case SDL_SYSWMEVENT: 360 case SDL_SYSWMEVENT:
324 case SDL_USEREVENT: 361 case SDL_USEREVENT: