summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-10-22 10:16:57 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-10-22 10:16:57 -0500
commite23854eb6ae6012afdb82dacc01e297f9f455c9f (patch)
treecef33006872b787762bb1acfb3d32bd28b1efdff
parent549f16700242841a9f212e3a209b579920c3240c (diff)
Revert "ecore_wl2: Kill the wl idle enterer"
This reverts commit 57d5b5921e8a4a05f4a1b468f1cfed74d28b95f9. We need the dispatch, not the flush...
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_display.c41
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h1
2 files changed, 42 insertions, 0 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c
index 37f4b92051..eeb7e09768 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -10,6 +10,7 @@
10static Eina_Hash *_server_displays = NULL; 10static Eina_Hash *_server_displays = NULL;
11static Eina_Hash *_client_displays = NULL; 11static Eina_Hash *_client_displays = NULL;
12 12
13static Eina_Bool _cb_connect_idle(void *data);
13static Eina_Bool _cb_connect_data(void *data, Ecore_Fd_Handler *hdl); 14static Eina_Bool _cb_connect_data(void *data, Ecore_Fd_Handler *hdl);
14static Eina_Bool _ecore_wl2_display_connect(Ecore_Wl2_Display *ewd, Eina_Bool sync); 15static Eina_Bool _ecore_wl2_display_connect(Ecore_Wl2_Display *ewd, Eina_Bool sync);
15 16
@@ -449,6 +450,8 @@ _recovery_timer_add(Ecore_Wl2_Display *ewd)
449 Ecore_Wl2_Window *window; 450 Ecore_Wl2_Window *window;
450 451
451 eina_hash_free_buckets(ewd->globals); 452 eina_hash_free_buckets(ewd->globals);
453 ecore_idle_enterer_del(ewd->idle_enterer);
454 ewd->idle_enterer = NULL;
452 455
453 ecore_main_fd_handler_del(ewd->fd_hdl); 456 ecore_main_fd_handler_del(ewd->fd_hdl);
454 ewd->fd_hdl = NULL; 457 ewd->fd_hdl = NULL;
@@ -539,6 +542,40 @@ _cb_globals_hash_del(void *data)
539 free(global); 542 free(global);
540} 543}
541 544
545static Eina_Bool
546_cb_connect_idle(void *data)
547{
548 Ecore_Wl2_Display *ewd = data;
549 int ret = 0, code;
550
551 ret = wl_display_get_error(ewd->wl.display);
552 code = errno;
553 if (ret < 0) goto err;
554
555 ret = wl_display_dispatch_pending(ewd->wl.display);
556 code = errno;
557 if (ret < 0) goto err;
558
559 ret = wl_display_flush(ewd->wl.display);
560 code = errno;
561 if ((ret < 0) && (code == EAGAIN))
562 ecore_main_fd_handler_active_set(ewd->fd_hdl,
563 (ECORE_FD_READ | ECORE_FD_WRITE));
564
565 return ECORE_CALLBACK_RENEW;
566
567err:
568 if ((ret < 0) && (code != EAGAIN))
569 {
570 ewd->idle_enterer = NULL;
571 _begin_recovery_maybe(ewd, code);
572
573 return ECORE_CALLBACK_CANCEL;
574 }
575
576 return ECORE_CALLBACK_RENEW;
577}
578
542static Ecore_Wl2_Global * 579static Ecore_Wl2_Global *
543_ecore_wl2_global_find(Ecore_Wl2_Display *ewd, const char *interface) 580_ecore_wl2_global_find(Ecore_Wl2_Display *ewd, const char *interface)
544{ 581{
@@ -661,6 +698,8 @@ _ecore_wl2_display_connect(Ecore_Wl2_Display *ewd, Eina_Bool sync)
661 ECORE_FD_READ | ECORE_FD_WRITE | ECORE_FD_ERROR, 698 ECORE_FD_READ | ECORE_FD_WRITE | ECORE_FD_ERROR,
662 _cb_connect_data, ewd, NULL, NULL); 699 _cb_connect_data, ewd, NULL, NULL);
663 700
701 ewd->idle_enterer = ecore_idle_enterer_add(_cb_connect_idle, ewd);
702
664 _ecore_wl2_display_event(ewd, ECORE_WL2_EVENT_CONNECT); 703 _ecore_wl2_display_event(ewd, ECORE_WL2_EVENT_CONNECT);
665 ecore_wl2_display_flush(ewd); 704 ecore_wl2_display_flush(ewd);
666 return EINA_TRUE; 705 return EINA_TRUE;
@@ -683,6 +722,8 @@ _ecore_wl2_display_cleanup(Ecore_Wl2_Display *ewd)
683 EINA_INLIST_FOREACH_SAFE(ewd->outputs, tmp, output) 722 EINA_INLIST_FOREACH_SAFE(ewd->outputs, tmp, output)
684 _ecore_wl2_output_del(output); 723 _ecore_wl2_output_del(output);
685 724
725 if (ewd->idle_enterer) ecore_idle_enterer_del(ewd->idle_enterer);
726
686 if (ewd->fd_hdl) ecore_main_fd_handler_del(ewd->fd_hdl); 727 if (ewd->fd_hdl) ecore_main_fd_handler_del(ewd->fd_hdl);
687 728
688 eina_hash_free(ewd->globals); 729 eina_hash_free(ewd->globals);
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index 6c14ce5f2a..e8e95b6a57 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -100,6 +100,7 @@ struct _Ecore_Wl2_Display
100 100
101 struct xkb_context *xkb_context; 101 struct xkb_context *xkb_context;
102 102
103 Ecore_Idle_Enterer *idle_enterer;
103 Ecore_Fd_Handler *fd_hdl; 104 Ecore_Fd_Handler *fd_hdl;
104 105
105 Eina_Hash *globals; 106 Eina_Hash *globals;