raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=c099ede159a55198949c50606eac1b7b9609476f

commit c099ede159a55198949c50606eac1b7b9609476f
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Thu Jun 15 12:17:39 2017 +0900

    examples: fix ecore_exe_child example to work properly on Windows
    
    Summary: ecore_main_fd_handler_add is not working on Windows
    
    Reviewers: vtorri, raster
    
    Subscribers: cedric, jpeg
    
    Differential Revision: https://phab.enlightenment.org/D4470
---
 src/examples/ecore/ecore_exe_example_child.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/examples/ecore/ecore_exe_example_child.c 
b/src/examples/ecore/ecore_exe_example_child.c
index c22a7e5034..b59ff815ee 100644
--- a/src/examples/ecore/ecore_exe_example_child.c
+++ b/src/examples/ecore/ecore_exe_example_child.c
@@ -8,8 +8,14 @@
 
 #define BUFFER_SIZE 1024
 
+#ifdef _WIN32
+#define HANDLER_TYPE Ecore_Win32_Handler
+#else
+#define HANDLER_TYPE Ecore_Fd_Handler
+#endif
+
 static Eina_Bool
-_fd_handler_cb(void *data EINA_UNUSED, Ecore_Fd_Handler *fd_handler 
EINA_UNUSED)
+_fd_handler_cb(void *data EINA_UNUSED, HANDLER_TYPE *fd_handler EINA_UNUSED)
 {
    static int numberOfMessages = 0;
    char message[BUFFER_SIZE];
@@ -40,10 +46,22 @@ main(void)
    if (!ecore_init())
      goto error;
 
+#ifdef _WIN32
+   /* note that stdin fd's on windows don't work the same
+    * as on unixes. this uses stdin just as a quick
+    * example that's simple instead of a more complex
+    * one, so this won't actually work on windows unless
+    * you use a fd that comes from somewhere that is
+    * select()able. */
+   ecore_main_win32_handler_add(GetStdHandle(STD_INPUT_HANDLE),
+                                _fd_handler_cb,
+                                NULL);
+#else
    ecore_main_fd_handler_add(STDIN_FILENO,
                              ECORE_FD_READ,
                              _fd_handler_cb,
                              NULL, NULL, NULL);
+#endif
    ecore_main_loop_begin();
 
    ecore_shutdown();

-- 


Reply via email to