summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-10-17 11:32:57 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-10-25 10:44:16 -0400
commitf375661e0b4199a06234da8ab277a876f4c7778a (patch)
treef150a336fbfc53a987875d52c17ed91b8f48e963 /src
parentfd00e3de1a6c59d935726166031b7a4a017d6017 (diff)
wayland: use eina array for ecore-evas event handlers
thx to @jpeg for reporting how dumb this was
Diffstat (limited to 'src')
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c69
1 files changed, 42 insertions, 27 deletions
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
index 587d0f723c..f0705bd020 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
@@ -28,7 +28,7 @@ struct _EE_Wl_Device
28 28
29/* local variables */ 29/* local variables */
30static int _ecore_evas_wl_init_count = 0; 30static int _ecore_evas_wl_init_count = 0;
31static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[17]; 31static Eina_Array *_ecore_evas_wl_event_hdls;
32 32
33static void _ecore_evas_wayland_resize(Ecore_Evas *ee, int location); 33static void _ecore_evas_wayland_resize(Ecore_Evas *ee, int location);
34static void _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int resize); 34static void _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int resize);
@@ -1189,65 +1189,83 @@ _ecore_evas_wl_common_cb_iconify_state_change(void *data EINA_UNUSED, int type E
1189static int 1189static int
1190_ecore_evas_wl_common_init(void) 1190_ecore_evas_wl_common_init(void)
1191{ 1191{
1192 Ecore_Event_Handler *h;
1192 LOGFN(__FILE__, __LINE__, __FUNCTION__); 1193 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1193 1194
1194 if (++_ecore_evas_wl_init_count != 1) 1195 if (++_ecore_evas_wl_init_count != 1)
1195 return _ecore_evas_wl_init_count; 1196 return _ecore_evas_wl_init_count;
1196 1197
1197 _ecore_evas_wl_event_hdls[0] = 1198 _ecore_evas_wl_event_hdls = eina_array_new(10);
1198 ecore_event_handler_add(ECORE_EVENT_MOUSE_IN, 1199 h = ecore_event_handler_add(ECORE_EVENT_MOUSE_IN,
1199 _ecore_evas_wl_common_cb_mouse_in, NULL); 1200 _ecore_evas_wl_common_cb_mouse_in, NULL);
1200 _ecore_evas_wl_event_hdls[1] = 1201 eina_array_push(_ecore_evas_wl_event_hdls, h);
1202 h =
1201 ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, 1203 ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT,
1202 _ecore_evas_wl_common_cb_mouse_out, NULL); 1204 _ecore_evas_wl_common_cb_mouse_out, NULL);
1203 _ecore_evas_wl_event_hdls[2] = 1205 eina_array_push(_ecore_evas_wl_event_hdls, h);
1206 h =
1204 ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, 1207 ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN,
1205 _ecore_evas_wl_common_cb_focus_in, NULL); 1208 _ecore_evas_wl_common_cb_focus_in, NULL);
1206 _ecore_evas_wl_event_hdls[3] = 1209 eina_array_push(_ecore_evas_wl_event_hdls, h);
1210 h =
1207 ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, 1211 ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT,
1208 _ecore_evas_wl_common_cb_focus_out, NULL); 1212 _ecore_evas_wl_common_cb_focus_out, NULL);
1209 _ecore_evas_wl_event_hdls[4] = 1213 eina_array_push(_ecore_evas_wl_event_hdls, h);
1214 h =
1210 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, 1215 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE,
1211 _ecore_evas_wl_common_cb_window_configure, NULL); 1216 _ecore_evas_wl_common_cb_window_configure, NULL);
1212 _ecore_evas_wl_event_hdls[5] = 1217 eina_array_push(_ecore_evas_wl_event_hdls, h);
1218 h =
1213 ecore_event_handler_add(_ecore_wl2_event_window_www, 1219 ecore_event_handler_add(_ecore_wl2_event_window_www,
1214 _ecore_evas_wl_common_cb_www, NULL); 1220 _ecore_evas_wl_common_cb_www, NULL);
1215 _ecore_evas_wl_event_hdls[6] = 1221 eina_array_push(_ecore_evas_wl_event_hdls, h);
1222 h =
1216 ecore_event_handler_add(_ecore_wl2_event_window_www_drag, 1223 ecore_event_handler_add(_ecore_wl2_event_window_www_drag,
1217 _ecore_evas_wl_common_cb_www_drag, NULL); 1224 _ecore_evas_wl_common_cb_www_drag, NULL);
1218 _ecore_evas_wl_event_hdls[7] = 1225 eina_array_push(_ecore_evas_wl_event_hdls, h);
1226 h =
1219 ecore_event_handler_add(ECORE_WL2_EVENT_DISCONNECT, 1227 ecore_event_handler_add(ECORE_WL2_EVENT_DISCONNECT,
1220 _ecore_evas_wl_common_cb_disconnect, NULL); 1228 _ecore_evas_wl_common_cb_disconnect, NULL);
1221 _ecore_evas_wl_event_hdls[8] = 1229 eina_array_push(_ecore_evas_wl_event_hdls, h);
1230 h =
1222 ecore_event_handler_add(ECORE_WL2_EVENT_GLOBAL_ADDED, 1231 ecore_event_handler_add(ECORE_WL2_EVENT_GLOBAL_ADDED,
1223 _ecore_evas_wl_common_cb_global_added, NULL); 1232 _ecore_evas_wl_common_cb_global_added, NULL);
1224 _ecore_evas_wl_event_hdls[9] = 1233 eina_array_push(_ecore_evas_wl_event_hdls, h);
1234 h =
1225 ecore_event_handler_add(ECORE_WL2_EVENT_GLOBAL_REMOVED, 1235 ecore_event_handler_add(ECORE_WL2_EVENT_GLOBAL_REMOVED,
1226 _ecore_evas_wl_common_cb_global_removed, NULL); 1236 _ecore_evas_wl_common_cb_global_removed, NULL);
1227 _ecore_evas_wl_event_hdls[10] = 1237 eina_array_push(_ecore_evas_wl_event_hdls, h);
1238 h =
1228 ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_NAME_CHANGED, 1239 ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_NAME_CHANGED,
1229 _ecore_evas_wl_common_cb_seat_name_changed, NULL); 1240 _ecore_evas_wl_common_cb_seat_name_changed, NULL);
1230 _ecore_evas_wl_event_hdls[11] = 1241 eina_array_push(_ecore_evas_wl_event_hdls, h);
1242 h =
1231 ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED, 1243 ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED,
1232 _ecore_evas_wl_common_cb_seat_capabilities_changed, 1244 _ecore_evas_wl_common_cb_seat_capabilities_changed,
1233 NULL); 1245 NULL);
1234 _ecore_evas_wl_event_hdls[12] = 1246 eina_array_push(_ecore_evas_wl_event_hdls, h);
1247 h =
1235 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE, 1248 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
1236 _ecore_evas_wl_common_cb_window_configure_complete, 1249 _ecore_evas_wl_common_cb_window_configure_complete,
1237 NULL); 1250 NULL);
1238 _ecore_evas_wl_event_hdls[13] = 1251 eina_array_push(_ecore_evas_wl_event_hdls, h);
1252 h =
1239 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE, 1253 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE,
1240 _ecore_evas_wl_common_cb_window_rotate, NULL); 1254 _ecore_evas_wl_common_cb_window_rotate, NULL);
1241 _ecore_evas_wl_event_hdls[14] = 1255 eina_array_push(_ecore_evas_wl_event_hdls, h);
1256 h =
1242 ecore_event_handler_add(ECORE_WL2_EVENT_AUX_HINT_ALLOWED, 1257 ecore_event_handler_add(ECORE_WL2_EVENT_AUX_HINT_ALLOWED,
1243 _ecore_evas_wl_common_cb_aux_hint_allowed, NULL); 1258 _ecore_evas_wl_common_cb_aux_hint_allowed, NULL);
1244 _ecore_evas_wl_event_hdls[15] = 1259 eina_array_push(_ecore_evas_wl_event_hdls, h);
1260 h =
1245 ecore_event_handler_add(ECORE_WL2_EVENT_AUX_HINT_SUPPORTED, 1261 ecore_event_handler_add(ECORE_WL2_EVENT_AUX_HINT_SUPPORTED,
1246 _ecore_evas_wl_common_cb_aux_hint_supported, NULL); 1262 _ecore_evas_wl_common_cb_aux_hint_supported, NULL);
1247 _ecore_evas_wl_event_hdls[16] = 1263 eina_array_push(_ecore_evas_wl_event_hdls, h);
1264 h =
1248 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, 1265 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE,
1249 _ecore_evas_wl_common_cb_iconify_state_change, NULL); 1266 _ecore_evas_wl_common_cb_iconify_state_change, NULL);
1250 _ecore_evas_wl_event_hdls[15] = 1267 eina_array_push(_ecore_evas_wl_event_hdls, h);
1268 h =
1251 ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, 1269 ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE,
1252 _ecore_evas_wl_common_cb_aux_message, NULL); 1270 _ecore_evas_wl_common_cb_aux_message, NULL);
1253 1271
@@ -1259,18 +1277,15 @@ _ecore_evas_wl_common_init(void)
1259static int 1277static int
1260_ecore_evas_wl_common_shutdown(void) 1278_ecore_evas_wl_common_shutdown(void)
1261{ 1279{
1262 unsigned int i = 0;
1263
1264 LOGFN(__FILE__, __LINE__, __FUNCTION__); 1280 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1265 1281
1266 if (--_ecore_evas_wl_init_count != 0) 1282 if (--_ecore_evas_wl_init_count != 0)
1267 return _ecore_evas_wl_init_count; 1283 return _ecore_evas_wl_init_count;
1268 1284
1269 for (i = 0; i < EINA_C_ARRAY_LENGTH(_ecore_evas_wl_event_hdls); i++) 1285 while (eina_array_count(_ecore_evas_wl_event_hdls))
1270 { 1286 ecore_event_handler_del(eina_array_pop(_ecore_evas_wl_event_hdls));
1271 if (_ecore_evas_wl_event_hdls[i]) 1287 eina_array_free(_ecore_evas_wl_event_hdls);
1272 ecore_event_handler_del(_ecore_evas_wl_event_hdls[i]); 1288 _ecore_evas_wl_event_hdls = NULL;
1273 }
1274 1289
1275 ecore_event_evas_shutdown(); 1290 ecore_event_evas_shutdown();
1276 1291