summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-02-07 12:03:41 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2018-02-07 12:12:22 -0500
commit9cf61c2f6d215e3adfa1567154a229eb49116769 (patch)
tree127e89c4df549b8967cc9467f7e150ff817d58ad
parentc4e5bbe441648f94fd7202cd3a26f545de6f78cd (diff)
elm: move ecore-x and ecore-wl2 connection init to selection manager
this seems to be the only place where the related components are explicitly used neither of these components have fork-safe connections, so there is no benefit to calling them during quicklaunch init
-rw-r--r--src/lib/elementary/efl_selection_manager.c141
-rw-r--r--src/lib/elementary/elm_config.c72
2 files changed, 141 insertions, 72 deletions
diff --git a/src/lib/elementary/efl_selection_manager.c b/src/lib/elementary/efl_selection_manager.c
index 2c59de9580..a5a7c82325 100644
--- a/src/lib/elementary/efl_selection_manager.c
+++ b/src/lib/elementary/efl_selection_manager.c
@@ -28,6 +28,8 @@ void efl_selection_manager_drop_target_del(Eo *obj, Efl_Object *target_obj, Efl_
28void efl_selection_manager_selection_clear(Eo *obj, Efl_Object *owner, Efl_Selection_Type type, unsigned int seat); 28void efl_selection_manager_selection_clear(Eo *obj, Efl_Object *owner, Efl_Selection_Type type, unsigned int seat);
29void efl_selection_manager_drag_start(Eo *obj, Efl_Object *drag_obj, Efl_Selection_Format format, Eina_Slice data, Efl_Selection_Action action, void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, Eina_Free_Cb icon_func_free_cb, unsigned int seat); 29void efl_selection_manager_drag_start(Eo *obj, Efl_Object *drag_obj, Efl_Selection_Format format, Eina_Slice data, Efl_Selection_Action action, void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, Eina_Free_Cb icon_func_free_cb, unsigned int seat);
30 30
31static unsigned int managers;
32
31#ifdef HAVE_ELEMENTARY_X 33#ifdef HAVE_ELEMENTARY_X
32static void _set_selection_list(Sel_Manager_Selection *sel_list, Sel_Manager_Seat_Selection *seat_sel); 34static void _set_selection_list(Sel_Manager_Selection *sel_list, Sel_Manager_Seat_Selection *seat_sel);
33static Ecore_X_Atom _x11_dnd_action_rev_map(Efl_Selection_Action action); 35static Ecore_X_Atom _x11_dnd_action_rev_map(Efl_Selection_Action action);
@@ -4968,6 +4970,80 @@ _efl_selection_manager_container_drag_item_del(Eo *obj EINA_UNUSED, Efl_Selectio
4968static Eo * 4970static Eo *
4969_efl_selection_manager_efl_object_constructor(Eo *obj, Efl_Selection_Manager_Data *pd) 4971_efl_selection_manager_efl_object_constructor(Eo *obj, Efl_Selection_Manager_Data *pd)
4970{ 4972{
4973#if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_WL2)
4974 const char *ev = getenv("ELM_DISPLAY");
4975#endif
4976
4977#ifdef HAVE_ELEMENTARY_X
4978 Eina_Bool init_x = EINA_FALSE;
4979 Eina_Bool have_display = !!getenv("DISPLAY");
4980
4981 if (ev) /* If ELM_DISPLAY is specified */
4982 {
4983 if (!strcmp(ev, "x11")) /* and it is X11 */
4984 {
4985 if (!have_display) /* if there is no $DISPLAY */
4986 {
4987 ERR("$ELM_DISPLAY is set to x11 but $DISPLAY is not set");
4988 init_x = EINA_FALSE;
4989 }
4990 else /* if there is */
4991 init_x = EINA_TRUE;
4992 }
4993 else /* not X11 */
4994 init_x = EINA_FALSE;
4995 }
4996 else /* ELM_DISPLAY not specified */
4997 {
4998 if (have_display) /* If there is a $DISPLAY */
4999 init_x = EINA_TRUE;
5000 else /* No $DISPLAY */
5001 init_x = EINA_FALSE;
5002 }
5003 if (init_x)
5004 {
5005 ecore_x_init(NULL);
5006 }
5007#endif
5008#ifdef HAVE_ELEMENTARY_WL2
5009 Eina_Bool init_wl = EINA_FALSE;
5010 Eina_Bool have_wl_display = !!getenv("WAYLAND_DISPLAY");
5011
5012 if (ev) /* If ELM_DISPLAY is specified */
5013 {
5014 if (!strcmp(ev, "wl")) /* and it is WL */
5015 {
5016 /* always try to connect to wl when it is enforced */
5017 init_wl = EINA_TRUE;
5018 }
5019 else /* not wl */
5020 init_wl = EINA_FALSE;
5021 }
5022 else /* ELM_DISPLAY not specified */
5023 {
5024 /* If there is a $WAYLAND_DISPLAY */
5025 if ((have_wl_display) && (!getenv("DISPLAY")))
5026 init_wl = EINA_TRUE;
5027 else /* No $WAYLAND_DISPLAY */
5028 init_wl = EINA_FALSE;
5029 }
5030 if (init_wl)
5031 {
5032 if (!ecore_wl2_init())
5033 {
5034 ERR("Could not initialize Ecore_Wl2");
5035 return NULL;
5036 }
5037 _elm_wl_display = ecore_wl2_display_connect(NULL);
5038 if (!_elm_wl_display)
5039 {
5040 ERR("Could not connect to Wayland Display");
5041 ecore_wl2_shutdown();
5042 return NULL;
5043 }
5044 }
5045#endif
5046
4971 obj = efl_constructor(efl_super(obj, MY_CLASS)); 5047 obj = efl_constructor(efl_super(obj, MY_CLASS));
4972 5048
4973 pd->sel_man = obj; 5049 pd->sel_man = obj;
@@ -5214,6 +5290,7 @@ _efl_selection_manager_efl_object_constructor(Eo *obj, Efl_Selection_Manager_Dat
5214 pd->end_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_END, 5290 pd->end_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_END,
5215 _wl_dnd_end, pd); 5291 _wl_dnd_end, pd);
5216#endif 5292#endif
5293 managers++;
5217 return obj; 5294 return obj;
5218} 5295}
5219 5296
@@ -5264,6 +5341,70 @@ _efl_selection_manager_efl_object_destructor(Eo *obj, Efl_Selection_Manager_Data
5264 eina_stringshare_del(pd->text_uri); 5341 eina_stringshare_del(pd->text_uri);
5265 5342
5266 efl_destructor(efl_super(obj, MY_CLASS)); 5343 efl_destructor(efl_super(obj, MY_CLASS));
5344 managers--;
5345#if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_WL2) || defined(HAVE_ELEMENTARY_WIN32)
5346 const char *ev = getenv("ELM_DISPLAY");
5347#endif
5348
5349#ifdef HAVE_ELEMENTARY_X
5350 Eina_Bool init_x = EINA_FALSE;
5351 Eina_Bool have_display = !!getenv("DISPLAY");
5352
5353 if (ev) /* If ELM_DISPLAY is specified */
5354 {
5355 if (!strcmp(ev, "x11")) /* and it is X11 */
5356 {
5357 if (!have_display) /* if there is no $DISPLAY */
5358 {
5359 ERR("$ELM_DISPLAY is set to x11 but $DISPLAY is not set");
5360 init_x = EINA_FALSE;
5361 }
5362 else /* if there is */
5363 init_x = EINA_TRUE;
5364 }
5365 else /* not X11 */
5366 init_x = EINA_FALSE;
5367 }
5368 else /* ELM_DISPLAY not specified */
5369 {
5370 if (have_display) /* If there is a $DISPLAY */
5371 init_x = EINA_TRUE;
5372 else /* No $DISPLAY */
5373 init_x = EINA_FALSE;
5374 }
5375 if (init_x)
5376 {
5377 ecore_x_shutdown();
5378 }
5379#endif
5380#ifdef HAVE_ELEMENTARY_WL2
5381 Eina_Bool init_wl = EINA_FALSE;
5382 Eina_Bool have_wl_display = !!getenv("WAYLAND_DISPLAY");
5383
5384 if (ev) /* If ELM_DISPLAY is specified */
5385 {
5386 if (!strcmp(ev, "wl")) /* and it is WL */
5387 {
5388 /* always try to connect to wl when it is enforced */
5389 init_wl = EINA_TRUE;
5390 }
5391 else /* not wl */
5392 init_wl = EINA_FALSE;
5393 }
5394 else /* ELM_DISPLAY not specified */
5395 {
5396 /* If there is a $WAYLAND_DISPLAY */
5397 if ((have_wl_display) && (!getenv("DISPLAY")))
5398 init_wl = EINA_TRUE;
5399 else /* No $WAYLAND_DISPLAY */
5400 init_wl = EINA_FALSE;
5401 }
5402 if (init_wl)
5403 {
5404 if (!managers) ecore_wl2_display_disconnect(_elm_wl_display);
5405 ecore_wl2_shutdown();
5406 }
5407#endif
5267} 5408}
5268 5409
5269#ifdef HAVE_ELEMENTARY_X 5410#ifdef HAVE_ELEMENTARY_X
diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c
index ac1fae0262..51ef483e4b 100644
--- a/src/lib/elementary/elm_config.c
+++ b/src/lib/elementary/elm_config.c
@@ -4244,78 +4244,6 @@ _elm_config_file_monitor_cb(void *data EINA_UNUSED,
4244void 4244void
4245_elm_config_sub_init(void) 4245_elm_config_sub_init(void)
4246{ 4246{
4247#if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_WL2) || defined(HAVE_ELEMENTARY_WIN32)
4248 const char *ev = getenv("ELM_DISPLAY");
4249#endif
4250
4251#ifdef HAVE_ELEMENTARY_X
4252 Eina_Bool init_x = EINA_FALSE;
4253 Eina_Bool have_display = !!getenv("DISPLAY");
4254
4255 if (ev) /* If ELM_DISPLAY is specified */
4256 {
4257 if (!strcmp(ev, "x11")) /* and it is X11 */
4258 {
4259 if (!have_display) /* if there is no $DISPLAY */
4260 {
4261 ERR("$ELM_DISPLAY is set to x11 but $DISPLAY is not set");
4262 init_x = EINA_FALSE;
4263 }
4264 else /* if there is */
4265 init_x = EINA_TRUE;
4266 }
4267 else /* not X11 */
4268 init_x = EINA_FALSE;
4269 }
4270 else /* ELM_DISPLAY not specified */
4271 {
4272 if (have_display) /* If there is a $DISPLAY */
4273 init_x = EINA_TRUE;
4274 else /* No $DISPLAY */
4275 init_x = EINA_FALSE;
4276 }
4277 if (init_x)
4278 {
4279 ecore_x_init(NULL);
4280 }
4281#endif
4282#ifdef HAVE_ELEMENTARY_WL2
4283 Eina_Bool init_wl = EINA_FALSE;
4284 Eina_Bool have_wl_display = !!getenv("WAYLAND_DISPLAY");
4285
4286 if (ev) /* If ELM_DISPLAY is specified */
4287 {
4288 if (!strcmp(ev, "wl")) /* and it is WL */
4289 {
4290 /* always try to connect to wl when it is enforced */
4291 init_wl = EINA_TRUE;
4292 }
4293 else /* not wl */
4294 init_wl = EINA_FALSE;
4295 }
4296 else /* ELM_DISPLAY not specified */
4297 {
4298 /* If there is a $WAYLAND_DISPLAY */
4299 if ((have_wl_display) && (!getenv("DISPLAY")))
4300 init_wl = EINA_TRUE;
4301 else /* No $WAYLAND_DISPLAY */
4302 init_wl = EINA_FALSE;
4303 }
4304 if (init_wl)
4305 {
4306 if (!ecore_wl2_init())
4307 {
4308 ERR("Could not initialize Ecore_Wl2");
4309 goto end;
4310 }
4311 _elm_wl_display = ecore_wl2_display_connect(NULL);
4312 if (!_elm_wl_display)
4313 {
4314 ERR("Could not connect to Wayland Display");
4315 goto end;
4316 }
4317 }
4318#endif
4319#ifdef HAVE_ELEMENTARY_COCOA 4247#ifdef HAVE_ELEMENTARY_COCOA
4320 ecore_cocoa_init(); 4248 ecore_cocoa_init();
4321#endif 4249#endif